MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxNewHostConstructor

Function fxNewHostConstructor

xs/sources/xsAPI.c:570–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570txSlot* fxNewHostConstructor(txMachine* the, txCallback theCallback, txInteger theLength, txInteger name)
571{
572 txSlot* aStack;
573 txSlot* instance;
574 txSlot* property;
575
576 fxToInstance(the, the->stack);
577 aStack = the->stack;
578 instance = fxNewHostFunction(the, theCallback, theLength, name, XS_NO_ID);
579 instance->flag |= XS_CAN_CONSTRUCT_FLAG;
580 property = fxLastProperty(the, instance);
581 fxNextSlotProperty(the, property, aStack, mxID(_prototype), XS_GET_ONLY);
582 property = mxBehaviorSetProperty(the, fxGetInstance(the, aStack), mxID(_constructor), 0, XS_OWN);
583 property->flag = XS_DONT_ENUM_FLAG;
584 property->kind = the->stack->kind;
585 property->value = the->stack->value;
586 *aStack = *the->stack;
587 mxPop();
588 return instance;
589}
590
591txSlot* fxNewHostFunction(txMachine* the, txCallback theCallback, txInteger theLength, txInteger name, txInteger profileID)
592{

Callers 2

fxBuildHostConstructorFunction · 0.85
fxBuildGeneratorFunction · 0.85

Calls 5

fxToInstanceFunction · 0.85
fxNewHostFunctionFunction · 0.85
fxLastPropertyFunction · 0.85
fxNextSlotPropertyFunction · 0.85
fxGetInstanceFunction · 0.85

Tested by

no test coverage detected