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

Function fxProxyGetOwnProperty

xs/sources/xsProxy.c:342–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342txBoolean fxProxyGetOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* slot)
343{
344 txBoolean result;
345 mxProxyDeclarations(_getOwnPropertyDescriptor);
346 if (function) {
347 txFlag mask;
348 /* THIS */
349 mxPushSlot(handler);
350 /* FUNCTION */
351 mxPushSlot(function);
352 mxCall();
353 /* ARGUMENTS */
354 mxPushSlot(target);
355 mxPushUndefined();
356 fxKeyAt(the, id, index, the->stack);
357 mxRunCount(2);
358 mxPullSlot(slot);
359 mxPushUndefined();
360 if (slot->kind == XS_UNDEFINED_KIND) {
361 if (mxBehaviorGetOwnProperty(the, target->value.reference, id, index, the->stack)) {
362 if (the->stack->flag & XS_DONT_DELETE_FLAG)
363 mxTypeError("(proxy).getOwnPropertyDescriptor: no descriptor for non-configurable property");
364 if (!mxBehaviorIsExtensible(the, target->value.reference))
365 mxTypeError("(proxy).getOwnPropertyDescriptor: no descriptor for existent property of non-extensible object");
366 }
367 result = 0;
368 }
369 else {
370 mask = fxDescriptorToSlot(the, slot);
371 if (!(mask & XS_DONT_DELETE_FLAG)) {
372 mask |= XS_DONT_DELETE_FLAG;
373 slot->flag |= XS_DONT_DELETE_FLAG;
374 }
375 if (!(mask & XS_DONT_ENUM_FLAG)) {
376 mask |= XS_DONT_ENUM_FLAG;
377 slot->flag |= XS_DONT_ENUM_FLAG;
378 }
379 if (!(mask & (XS_GETTER_FLAG | XS_SETTER_FLAG))) {
380 if (!(mask & XS_DONT_SET_FLAG)) {
381 mask |= XS_DONT_SET_FLAG;
382 slot->flag |= XS_DONT_SET_FLAG;
383 }
384 if (slot->kind == XS_UNINITIALIZED_KIND)
385 slot->kind = XS_UNDEFINED_KIND;
386 }
387 if (mxBehaviorGetOwnProperty(the, target->value.reference, id, index, the->stack)) {
388 if (fxIsPropertyCompatible(the, the->stack, slot, mask)) {
389 if ((mask & XS_DONT_DELETE_FLAG) && (slot->flag & XS_DONT_DELETE_FLAG)) {
390 if (!(the->stack->flag & XS_DONT_DELETE_FLAG))
391 mxTypeError("(proxy).getOwnPropertyDescriptor: non-configurable descriptor for configurable property");
392 }
393 if (the->stack->flag & XS_DONT_DELETE_FLAG) {
394 if ((mask & XS_DONT_SET_FLAG) && (slot->flag & XS_DONT_SET_FLAG) && !(the->stack->flag & XS_DONT_SET_FLAG))
395 mxTypeError("(proxy).getOwnPropertyDescriptor: true with non-writable descriptor for non-configurable writable property");
396 }
397 }
398 else
399 mxTypeError("(proxy).getOwnPropertyDescriptor: incompatible descriptor for existent property");

Callers

nothing calls this directly

Calls 3

fxKeyAtFunction · 0.85
fxDescriptorToSlotFunction · 0.85
fxIsPropertyCompatibleFunction · 0.85

Tested by

no test coverage detected