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

Function fxGetPrototypeFromConstructor

xs/sources/xsFunction.c:182–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182txSlot* fxGetPrototypeFromConstructor(txMachine* the, txSlot* defaultPrototype)
183{
184 txSlot* result = the->stack;
185 fxCheckCallable(the, result);
186 mxDub();
187 mxGetID(mxID(_prototype));
188 if (!mxIsReference(the->stack)) {
189 txSlot* instance = result->value.reference;
190 txSlot* proxy = instance->next;
191 if (proxy->kind == XS_PROXY_KIND) {
192 if (!proxy->value.proxy.handler)
193 mxTypeError("(proxy).%s: no handler", fxName(the, mxID(_prototype)));
194 if (!proxy->value.proxy.target)
195 mxTypeError("(proxy).%s: no target", fxName(the, mxID(_prototype)));
196 }
197 the->stack->kind = defaultPrototype->kind;
198 the->stack->value = defaultPrototype->value;
199 }
200 mxPullSlot(result);
201 return result->value.reference;
202}
203
204#ifndef mxLink
205txSlot* fxNewFunctionLength(txMachine* the, txSlot* instance, txNumber length)

Callers 15

fx_CompartmentFunction · 0.85
fx_ModuleSourceFunction · 0.85
fx_ModuleStuffFunction · 0.85
fx_MapFunction · 0.85
fx_SetFunction · 0.85
fx_WeakMapFunction · 0.85
fx_WeakSetFunction · 0.85
fx_WeakRefFunction · 0.85
fx_FinalizationRegistryFunction · 0.85
fxRunConstructorFunction · 0.85
fx_IteratorFunction · 0.85
fx_GeneratorFunctionFunction · 0.85

Calls 2

fxCheckCallableFunction · 0.85
fxNameFunction · 0.85

Tested by

no test coverage detected