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

Function fxNextHostAccessorProperty

xs/tools/xslSlot.c:560–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558}
559
560txSlot* fxNextHostAccessorProperty(txMachine* the, txSlot* property, txCallback get, txCallback set, txID id, txFlag flag)
561{
562 txLinker* linker = (txLinker*)(the->context);
563 txSlot *getter = NULL, *setter = NULL, *home = the->stack, *slot;
564 if (get) {
565 fxNewLinkerBuilder(linker, get, 0, id);
566 getter = fxNewHostFunction(the, get, 0, XS_NO_ID, XS_NO_ID);
567 slot = mxFunctionInstanceHome(getter);
568 slot->value.home.object = home->value.reference;
569 fxRenameFunction(the, getter, id, 0, XS_NO_ID, "get ");
570 }
571 if (set) {
572 fxNewLinkerBuilder(linker, set, 1, id);
573 setter = fxNewHostFunction(the, set, 1, XS_NO_ID, XS_NO_ID);
574 slot = mxFunctionInstanceHome(setter);
575 slot->value.home.object = home->value.reference;
576 fxRenameFunction(the, setter, id, 0, XS_NO_ID, "set ");
577 }
578 property = property->next = fxNewSlot(the);
579 property->flag = flag;
580 property->ID = id;
581 property->kind = XS_ACCESSOR_KIND;
582 property->value.accessor.getter = getter;
583 property->value.accessor.setter = setter;
584 if (set)
585 mxPop();
586 if (get)
587 mxPop();
588 return property;
589}
590
591txSlot* fxNextHostFunctionProperty(txMachine* the, txSlot* property, txCallback call, txInteger length, txID id, txFlag flag)
592{

Callers

nothing calls this directly

Calls 4

fxNewLinkerBuilderFunction · 0.85
fxNewHostFunctionFunction · 0.85
fxRenameFunctionFunction · 0.85
fxNewSlotFunction · 0.85

Tested by

no test coverage detected