(proto, methodName, humanName)
| 2146 | var registeredPointers = {}; |
| 2147 | |
| 2148 | function ensureOverloadTable(proto, methodName, humanName) { |
| 2149 | if (undefined === proto[methodName].overloadTable) { |
| 2150 | var prevFunc = proto[methodName]; |
| 2151 | // Inject an overload resolver function that routes to the appropriate overload based on the number of arguments. |
| 2152 | proto[methodName] = function() { |
| 2153 | // TODO This check can be removed in -O3 level "unsafe" optimizations. |
| 2154 | if (!proto[methodName].overloadTable.hasOwnProperty(arguments.length)) { |
| 2155 | throwBindingError("Function '" + humanName + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + proto[methodName].overloadTable + ")!"); |
| 2156 | } |
| 2157 | return proto[methodName].overloadTable[arguments.length].apply(this, arguments); |
| 2158 | }; |
| 2159 | // Move the previous function into the overload table. |
| 2160 | proto[methodName].overloadTable = []; |
| 2161 | proto[methodName].overloadTable[prevFunc.argCount] = prevFunc; |
| 2162 | } |
| 2163 | } |
| 2164 | /** @param {number=} numArguments */ |
| 2165 | function exposePublicSymbol(name, value, numArguments) { |
| 2166 | if (Module.hasOwnProperty(name)) { |
no test coverage detected