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

Function fxModuleDefineOwnProperty

xs/sources/xsModule.c:2594–2624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2592}
2593
2594txBoolean fxModuleDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* slot, txFlag mask)
2595{
2596 txSlot* property = fxModuleFindProperty(the, instance, id, index);
2597 if (property) {
2598 if ((mask & XS_DONT_DELETE_FLAG) && !(slot->flag & XS_DONT_DELETE_FLAG))
2599 return 0;
2600 if ((mask & XS_DONT_ENUM_FLAG) && ((property->flag & XS_DONT_ENUM_FLAG) != (slot->flag & XS_DONT_ENUM_FLAG)))
2601 return 0;
2602 if (mask & XS_ACCESSOR_FLAG) {
2603 if (property->kind != XS_ACCESSOR_KIND)
2604 return 0;
2605 if (mask & XS_GETTER_FLAG) {
2606 if (property->value.accessor.getter != slot->value.accessor.getter)
2607 return 0;
2608 }
2609 if (mask & XS_SETTER_FLAG) {
2610 if (property->value.accessor.setter != slot->value.accessor.setter)
2611 return 0;
2612 }
2613 return 1;
2614 }
2615 if ((mask & XS_DONT_SET_FLAG) && ((property->flag & XS_DONT_SET_FLAG) != (slot->flag & XS_DONT_SET_FLAG)))
2616 return 0;
2617 if (property->kind == XS_ACCESSOR_KIND)
2618 return 0;
2619 if ((slot->kind != XS_UNINITIALIZED_KIND) && !fxIsSameValue(the, property, slot, 0))
2620 return 0;
2621 return 1;
2622 }
2623 return 0;
2624}
2625
2626txBoolean fxModuleDeleteProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
2627{

Callers

nothing calls this directly

Calls 2

fxModuleFindPropertyFunction · 0.85
fxIsSameValueFunction · 0.85

Tested by

no test coverage detected