diff options
author | Bill Welden <bwelden@imvu.com> | 2013-01-10 09:57:32 -0800 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:23:05 +0300 |
commit | c59bb0d3975d7e15faaab87f785ae66bf6730f35 (patch) | |
tree | e51efb7826ca4d97ea2fe05eaab070619f18ac81 | |
parent | 34d32868ad6f6efdf466f90370a38dc26eb01159 (diff) |
Minor clean-up of auto upcasting.
-rwxr-xr-x | src/embind/embind.js | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index c755e22b..c37ef55b 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -211,6 +211,9 @@ function runDestructors(destructors) { } function makeInvoker(name, argCount, argTypes, invoker, fn) { + if (!FUNCTION_TABLE[fn]) { + throw new BindingError('function '+name+' is not defined'); + } return function() { if (arguments.length !== argCount - 1) { throw new BindingError('function ' + name + ' called with ' + arguments.length + ' arguments, expected ' + (argCount - 1)); @@ -219,11 +222,7 @@ function makeInvoker(name, argCount, argTypes, invoker, fn) { var args = new Array(argCount); args[0] = fn; for (var i = 1; i < argCount; ++i) { - if (argTypes[i].toWireTypeAutoUpcast) { - args[i] = argTypes[i].toWireTypeAutoUpcast(destructors, arguments[i-1]); - } else { - args[i] = argTypes[i].toWireType(destructors, arguments[i-1]); - } + args[i] = argTypes[i].toWireType(destructors, arguments[i-1]); } var rv = invoker.apply(null, args); if (argTypes[0].fromWireTypeAutoDowncast) { @@ -429,20 +428,7 @@ function RegisteredPointer(Handle, isPolymorphic, isSmartPointer, rawGetPointee, this.rawDestructor = rawDestructor; } -// todo: this will go away -RegisteredPointer.prototype.toWireType = function(destructors, o) { - if (null === o) { - return 0; - } else { - if (this.isSmartPointer) { - return o.smartPointer; - } else { - return o.ptr; // this allows passing a smart pointer to a raw pointer parameter (but it's not much of a conversion!)s/r - } - } -}; - -RegisteredPointer.prototype.toWireTypeAutoUpcast = function(destructors, handle) { +RegisteredPointer.prototype.toWireType = function(destructors, handle) { var fromRawType; if (!handle) { return null; |