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

Function fxBuildGlobal

xs/sources/xsGlobal.c:108–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106};
107
108void fxBuildGlobal(txMachine* the)
109{
110 txSlot* slot;
111
112 fxNewInstance(the);
113 mxPull(mxObjectPrototype);
114
115 mxPush(mxObjectPrototype);
116 fxNewFunctionInstance(the, XS_NO_ID);
117 mxPull(mxFunctionPrototype);
118
119 mxPush(mxObjectPrototype);
120 slot = fxNewObjectInstance(the);
121 mxPull(mxIteratorPrototype);
122
123 fxBuildHostFunction(the, mxCallback(fx_isFinite), 1, mxID(_isFinite));
124 mxPull(mxIsFiniteFunction);
125 fxBuildHostFunction(the, mxCallback(fx_isNaN), 1, mxID(_isNaN));
126 mxPull(mxIsNaNFunction);
127 fxBuildHostFunction(the, mxCallback(fx_parseFloat), 1, mxID(_parseFloat));
128 mxPull(mxParseFloatFunction);
129 fxBuildHostFunction(the, mxCallback(fx_parseInt), 2, mxID(_parseInt));
130 mxPull(mxParseIntFunction);
131 fxBuildHostFunction(the, mxCallback(fx_decodeURI), 1, mxID(_decodeURI));
132 mxPull(mxDecodeURIFunction);
133 fxBuildHostFunction(the, mxCallback(fx_decodeURIComponent), 1, mxID(_decodeURIComponent));
134 mxPull(mxDecodeURIComponentFunction);
135 fxBuildHostFunction(the, mxCallback(fx_encodeURI), 1, mxID(_encodeURI));
136 mxPull(mxEncodeURIFunction);
137 fxBuildHostFunction(the, mxCallback(fx_encodeURIComponent), 1, mxID(_encodeURIComponent));
138 mxPull(mxEncodeURIComponentFunction);
139 fxBuildHostFunction(the, mxCallback(fx_escape), 1, mxID(_escape));
140 mxPull(mxEscapeFunction);
141 fxBuildHostFunction(the, mxCallback(fx_eval), 1, mxID(_eval));
142 mxPull(mxEvalFunction);
143 fxBuildHostFunction(the, mxCallback(fx_unescape), 1, mxID(_unescape));
144 mxPull(mxUnescapeFunction);
145
146 slot = fxBuildHostFunction(the, mxCallback(fx_trace), 1, mxID(_trace));
147 slot = fxLastProperty(the, slot);
148 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_trace_center), 1, mxID(_center), XS_DONT_ENUM_FLAG);
149 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_trace_left), 1, mxID(_left), XS_DONT_ENUM_FLAG);
150 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_trace_right), 1, mxID(_right), XS_DONT_ENUM_FLAG);
151 mxPull(mxTraceFunction);
152
153#if mxNative
154 fxBuildHostFunction(the, mxCallback(fx_Native), 1, mxID(_Native));
155 mxPull(mxNativeConstructor);
156 fxBuildHostFunction(the, mxCallback(fx_native), 1, mxID(_native));
157 mxPull(mxNativeFunction);
158#endif
159
160 fxNewHostFunction(the, mxCallback(fxThrowTypeError), 0, XS_NO_ID, XS_NO_ID);
161 mxThrowTypeErrorFunction = *the->stack;
162 slot = the->stack->value.reference;
163 slot->flag |= XS_DONT_PATCH_FLAG;
164 slot = slot->next;
165 while (slot) {

Callers 1

fxCreateMachineFunction · 0.85

Calls 7

fxNewInstanceFunction · 0.85
fxNewFunctionInstanceFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxBuildHostFunctionFunction · 0.85
fxLastPropertyFunction · 0.85
fxNewHostFunctionFunction · 0.85

Tested by

no test coverage detected