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

Function fxDefinePrivateProperty

xs/sources/xsProperty.c:468–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468txBoolean fxDefinePrivateProperty(txMachine* the, txSlot* instance, txSlot* check, txID id, txSlot* slot, txFlag mask)
469{
470 txSlot** address;
471 txSlot* property;
472 mxCheck(the, instance->kind == XS_INSTANCE_KIND);
473#if mxAliasInstance
474 if (instance->ID) {
475 txSlot* alias = the->aliasArray[instance->ID];
476 if (alias)
477 instance = alias;
478 else
479 instance = fxAliasInstance(the, instance);
480 }
481 if (instance->flag & XS_MARK_FLAG)
482 return 0;
483#else
484 if (instance->flag & XS_DONT_MARSHALL_FLAG)
485 return 0;
486#endif
487 address = &(instance->next);
488 while ((property = *address)) {
489 if (!(property->flag & XS_INTERNAL_FLAG)) {
490 property = C_NULL;
491 break;
492 }
493 if (property->kind == XS_PRIVATE_KIND) {
494 if (property->value.private.check == check) {
495 break;
496 }
497 }
498 address = &(property->next);
499 }
500 if (!property) {
501 property = fxNewSlot(the);
502 property->next = *address;
503 property->flag = XS_INTERNAL_FLAG;
504 property->kind = XS_PRIVATE_KIND;
505 property->value.private.check = check;
506 property->value.private.first = C_NULL;
507 *address = property;
508 }
509 address = &(property->value.private.first);
510 while ((property = *address)) {
511 if (property->ID == id)
512 break;
513 address = &(property->next);
514 }
515 if (mask & XS_ACCESSOR_FLAG) {
516 if (property) {
517 if (property->kind != XS_ACCESSOR_KIND)
518 return 0;
519 }
520 else {
521 *address = property = fxNewSlot(the);
522 property->ID = id;
523 property->kind = XS_ACCESSOR_KIND;
524 property->value.accessor.getter = C_NULL;
525 property->value.accessor.setter = C_NULL;

Callers

nothing calls this directly

Calls 3

fxAliasInstanceFunction · 0.85
fxNewSlotFunction · 0.85
fxRenameFunctionFunction · 0.85

Tested by

no test coverage detected