aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2014-05-02 16:17:55 -0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-05-21 22:57:28 +0700
commit95a583b28ac063c3e813e61ea938bb93de910d66 (patch)
treef46864326ca8460672e46de24332d559a747c35d /system
parent6ce9851175ef56f894bd537fbf871c363f8bd402 (diff)
make optional methods work
Diffstat (limited to 'system')
-rw-r--r--system/include/emscripten/bind.h2
-rw-r--r--system/include/emscripten/val.h9
2 files changed, 7 insertions, 4 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index 3c2d7097..e03523c0 100644
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -899,7 +899,7 @@ namespace emscripten {
template<typename ReturnType, typename... Args, typename Default>
ReturnType optional_call(const char* name, Default def, Args&&... args) const {
- if (wrapped.has_function(name)) {
+ if (wrapped.has_implementation_defined_function<T>(name)) {
return call<ReturnType>(name, std::forward<Args>(args)...);
} else {
return def();
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h
index 8bcc30c4..31f5923e 100644
--- a/system/include/emscripten/val.h
+++ b/system/include/emscripten/val.h
@@ -61,7 +61,8 @@ namespace emscripten {
EM_VAR_ARGS argv);
bool _emval_has_function(
EM_VAL value,
- const char* methodName);
+ const char* methodName,
+ internal::TYPEID filter);
EM_VAL _emval_typeof(EM_VAL value);
}
@@ -392,8 +393,10 @@ namespace emscripten {
return MethodCaller<ReturnValue, Args...>::call(handle, name, std::forward<Args>(args)...);
}
- bool has_function(const char* name) const {
- return _emval_has_function(handle, name);
+ template<typename ClassType>
+ bool has_implementation_defined_function(const char* name) const {
+ using namespace internal;
+ return _emval_has_function(handle, name, TypeID<ClassType>::get());
}
template<typename T>