diff options
author | Chad Austin <caustin@gmail.com> | 2014-03-24 02:16:42 -0700 |
---|---|---|
committer | Chad Austin <chad@chadaustin.me> | 2014-03-28 23:56:42 -0700 |
commit | 0ee1cab6034ce6ef51e9f612873603182dffa248 (patch) | |
tree | ddb0180330bba0ee012ba2375017eefe57c4ce7d | |
parent | 8770323ba3a088c9b557344c18123650a6eef409 (diff) |
Make val::val(T&&) compatible with asm.js
-rw-r--r-- | src/embind/emval.js | 4 | ||||
-rw-r--r-- | system/include/emscripten/val.h | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/embind/emval.js b/src/embind/emval.js index 1c1365ec..24c42c3d 100644 --- a/src/embind/emval.js +++ b/src/embind/emval.js @@ -106,9 +106,9 @@ function __emval_new_cstring(v) { return __emval_register(getStringOrSymbol(v)); } -function __emval_take_value(type, v) { +function __emval_take_value(type, argv) { type = requireRegisteredType(type, '_emval_take_value'); - v = type['fromWireType'](v); + var v = type['readValueFromVarArg'](argv); return __emval_register(v); } diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index 3d956f24..74e4e702 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -26,8 +26,7 @@ namespace emscripten { EM_VAL _emval_null(); EM_VAL _emval_new_cstring(const char*); - // TODO: make compatible with asm.js - void _emval_take_value(TYPEID type/*, ...*/); + EM_VAL _emval_take_value(TYPEID type, ...); EM_VAL _emval_new( EM_VAL value, @@ -216,9 +215,12 @@ namespace emscripten { template<typename T> explicit val(T&& value) { + using namespace internal; + typedef internal::BindingType<T> BT; - auto taker = reinterpret_cast<internal::EM_VAL (*)(internal::TYPEID, typename BT::WireType)>(&internal::_emval_take_value); - handle = taker(internal::TypeID<T>::get(), BT::toWireType(std::forward<T>(value))); + handle = _emval_take_value( + internal::TypeID<T>::get(), + BT::toWireType(std::forward<T>(value))); } val() = delete; |