|
18 | 18 | /*global floatReadValueFromPointer, integerReadValueFromPointer, enumReadValueFromPointer, replacePublicSymbol, craftInvokerFunction, tupleRegistrations*/ |
19 | 19 | /*global finalizationRegistry, attachFinalizer, detachFinalizer, releaseClassHandle, runDestructor*/ |
20 | 20 | /*global ClassHandle, makeClassHandle, structRegistrations, whenDependentTypesAreResolved, BindingError, deletionQueue, delayFunction:true, upcastPointer*/ |
21 | | -/*global exposePublicSymbol, heap32VectorToArray, newFunc, char_0, char_9*/ |
| 21 | +/*global exposePublicSymbol, heap32VectorToArray, char_0, char_9*/ |
22 | 22 | /*global getInheritedInstanceCount, getLiveInheritedInstances, setDelayFunction, InternalError, runDestructors*/ |
23 | 23 | /*global requireRegisteredType, unregisterInheritedInstance, registerInheritedInstance, PureVirtualError, throwUnboundTypeError*/ |
24 | 24 | /*global assert, validateThis, downcastPointer, registeredPointers, RegisteredClass, getInheritedInstance */ |
@@ -705,42 +705,14 @@ var LibraryEmbind = { |
705 | 705 | } |
706 | 706 | }, |
707 | 707 |
|
708 | | -#if DYNAMIC_EXECUTION |
709 | | - $newFunc__deps: ['$createNamedFunction'], |
710 | | - $newFunc: function(constructor, argumentList) { |
711 | | - if (!(constructor instanceof Function)) { |
712 | | - throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`); |
713 | | - } |
714 | | - /* |
715 | | - * Previously, the following line was just: |
716 | | - * function dummy() {}; |
717 | | - * Unfortunately, Chrome was preserving 'dummy' as the object's name, even |
718 | | - * though at creation, the 'dummy' has the correct constructor name. Thus, |
719 | | - * objects created with IMVU.new would show up in the debugger as 'dummy', |
720 | | - * which isn't very helpful. Using IMVU.createNamedFunction addresses the |
721 | | - * issue. Doubly-unfortunately, there's no way to write a test for this |
722 | | - * behavior. -NRD 2013.02.22 |
723 | | - */ |
724 | | - var dummy = createNamedFunction(constructor.name || 'unknownFunctionName', function(){}); |
725 | | - dummy.prototype = constructor.prototype; |
726 | | - var obj = new dummy; |
727 | | - |
728 | | - var r = constructor.apply(obj, argumentList); |
729 | | - return (r instanceof Object) ? r : obj; |
730 | | - }, |
731 | | -#endif |
732 | | - |
733 | 708 | // The path to interop from JS code to C++ code: |
734 | 709 | // (hand-written JS code) -> (autogenerated JS invoker) -> (template-generated C++ invoker) -> (target C++ function) |
735 | 710 | // craftInvokerFunction generates the JS invoker function for each function exposed to JS through embind. |
736 | 711 | $craftInvokerFunction__deps: [ |
737 | 712 | '$createNamedFunction', '$runDestructors', '$throwBindingError', '$usesDestructorStack', |
738 | | -#if DYNAMIC_EXECUTION |
739 | | - '$newFunc', |
740 | 713 | #if !EMBIND_AOT |
741 | 714 | '$createJsInvoker', |
742 | 715 | #endif |
743 | | -#endif |
744 | 716 | #if EMBIND_AOT |
745 | 717 | '$InvokerFunctions', |
746 | 718 | '$createJsInvokerSignature', |
@@ -878,9 +850,11 @@ var LibraryEmbind = { |
878 | 850 | var signature = createJsInvokerSignature(argTypes, isClassMethodFunc, returns, isAsync); |
879 | 851 | var invokerFn = InvokerFunctions[signature](...closureArgs); |
880 | 852 | #else |
| 853 | + |
881 | 854 | let [args, invokerFnBody] = createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync); |
882 | 855 | args.push(invokerFnBody); |
883 | | - var invokerFn = newFunc(Function, args)(...closureArgs); |
| 856 | + var invokerFn = new Function(...args)(...closureArgs); |
| 857 | + |
884 | 858 | #endif |
885 | 859 | #endif |
886 | 860 | return createNamedFunction(humanName, invokerFn); |
|
0 commit comments