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

Function fxProxyGetPrototype

xs/sources/xsProxy.c:464–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464txBoolean fxProxyGetPrototype(txMachine* the, txSlot* instance, txSlot* slot)
465{
466 txBoolean result;
467 mxProxyDeclarations(_getPrototypeOf);
468 if (function) {
469 /* THIS */
470 mxPushSlot(handler);
471 /* FUNCTION */
472 mxPushSlot(function);
473 mxCall();
474 /* ARGUMENTS */
475 mxPushSlot(target);
476 mxRunCount(1);
477 mxPullSlot(slot);
478 if ((slot->kind == XS_NULL_KIND) || (slot->kind == XS_REFERENCE_KIND)) {
479 if (!mxBehaviorIsExtensible(the, target->value.reference)) {
480 mxPushUndefined();
481 mxBehaviorGetPrototype(the, target->value.reference, the->stack);
482 if (!fxIsSameValue(the, slot, the->stack, 0))
483 mxTypeError("(proxy).getPrototypeOf: different prototype for non-extensible object");
484 mxPop();
485 }
486 }
487 else
488 mxTypeError("(proxy).getPrototypeOf: neither object nor null");
489 result = (slot->kind == XS_NULL_KIND) ? 0 : 1;
490 }
491 else
492 result = mxBehaviorGetPrototype(the, target->value.reference, slot);
493 mxProxyPop();
494 return result;
495}
496
497txBoolean fxProxyHasProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
498{

Callers

nothing calls this directly

Calls 1

fxIsSameValueFunction · 0.85

Tested by

no test coverage detected