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

Function fxBuildProxy

xs/sources/xsProxy.c:77–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75};
76
77void fxBuildProxy(txMachine* the)
78{
79 txSlot* slot;
80
81 fxNewHostFunction(the, mxCallback(fxProxyGetter), 0, XS_NO_ID, XS_NO_ID);
82 fxNewHostFunction(the, mxCallback(fxProxySetter), 1, XS_NO_ID, XS_NO_ID);
83 mxPushUndefined();
84 the->stack->flag = XS_DONT_DELETE_FLAG;
85 the->stack->kind = XS_ACCESSOR_KIND;
86 the->stack->value.accessor.getter = (the->stack + 2)->value.reference;
87 the->stack->value.accessor.setter = (the->stack + 1)->value.reference;
88 mxPull(mxProxyAccessor);
89 the->stack += 2;
90
91 slot = fxBuildHostFunction(the, mxCallback(fx_Proxy), 2, mxID(_Proxy));
92 slot->flag |= XS_CAN_CONSTRUCT_FLAG;
93 mxProxyConstructor = *the->stack;
94 slot = fxLastProperty(the, slot);
95 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Proxy_revocable), 2, mxID(_revocable), XS_DONT_ENUM_FLAG);
96 mxPop();
97
98 mxPush(mxObjectPrototype);
99 slot = fxLastProperty(the, fxNewObjectInstance(the));
100 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_apply), 3, mxID(_apply), XS_DONT_ENUM_FLAG);
101 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_construct), 2, mxID(_construct), XS_DONT_ENUM_FLAG);
102 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_defineProperty), 3, mxID(_defineProperty), XS_DONT_ENUM_FLAG);
103 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_deleteProperty), 2, mxID(_deleteProperty), XS_DONT_ENUM_FLAG);
104 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_get), 2, mxID(_get), XS_DONT_ENUM_FLAG);
105 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_getOwnPropertyDescriptor), 2, mxID(_getOwnPropertyDescriptor), XS_DONT_ENUM_FLAG);
106 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_getPrototypeOf), 1, mxID(_getPrototypeOf), XS_DONT_ENUM_FLAG);
107 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_has), 2, mxID(_has), XS_DONT_ENUM_FLAG);
108 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_isExtensible), 1, mxID(_isExtensible), XS_DONT_ENUM_FLAG);
109 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_ownKeys), 1, mxID(_ownKeys), XS_DONT_ENUM_FLAG);
110 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_preventExtensions), 1, mxID(_preventExtensions), XS_DONT_ENUM_FLAG);
111 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_set), 3, mxID(_set), XS_DONT_ENUM_FLAG);
112 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Reflect_setPrototypeOf), 2, mxID(_setPrototypeOf), XS_DONT_ENUM_FLAG);
113 slot = fxNextStringXProperty(the, slot, "Reflect", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG);
114 mxPull(mxReflectObject);
115}
116
117txSlot* fxNewProxyInstance(txMachine* the)
118{

Callers 1

fxCreateMachineFunction · 0.85

Calls 6

fxNewHostFunctionFunction · 0.85
fxBuildHostFunctionFunction · 0.85
fxLastPropertyFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxNextStringXPropertyFunction · 0.85

Tested by

no test coverage detected