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

Function fxDescriptorToSlot

xs/sources/xsType.c:962–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

960}
961
962txFlag fxDescriptorToSlot(txMachine* the, txSlot* descriptor)
963{
964 txSlot* stack = the->stack;
965 txSlot* configurable = C_NULL;
966 txSlot* enumerable = C_NULL;
967 txSlot* get = C_NULL;
968 txSlot* set = C_NULL;
969 txSlot* value = C_NULL;
970 txSlot* writable = C_NULL;
971 txSlot* getFunction = C_NULL;
972 txSlot* setFunction = C_NULL;
973 txFlag mask = 0;
974 if (!mxIsReference(descriptor))
975 mxTypeError("descriptor: not an object");
976 mxPushSlot(descriptor);
977 if (mxHasID(mxID(_enumerable))) {
978 mxPushSlot(descriptor);
979 mxGetID(mxID(_enumerable));
980 enumerable = the->stack;
981 }
982 mxPushSlot(descriptor);
983 if (mxHasID(mxID(_configurable))) {
984 mxPushSlot(descriptor);
985 mxGetID(mxID(_configurable));
986 configurable = the->stack;
987 }
988 mxPushSlot(descriptor);
989 if (mxHasID(mxID(_value))) {
990 mxPushSlot(descriptor);
991 mxGetID(mxID(_value));
992 value = the->stack;
993 }
994 mxPushSlot(descriptor);
995 if (mxHasID(mxID(_writable))) {
996 mxPushSlot(descriptor);
997 mxGetID(mxID(_writable));
998 writable = the->stack;
999 }
1000 mxPushSlot(descriptor);
1001 if (mxHasID(mxID(_get))) {
1002 mxPushSlot(descriptor);
1003 mxGetID(mxID(_get));
1004 get = the->stack;
1005 }
1006 mxPushSlot(descriptor);
1007 if (mxHasID(mxID(_set))) {
1008 mxPushSlot(descriptor);
1009 mxGetID(mxID(_set));
1010 set = the->stack;
1011 }
1012 if (get) {
1013 if (value)
1014 mxTypeError("descriptor: get and value properties");
1015 if (writable)
1016 mxTypeError("descriptor: get and writable properties");
1017 if (get->kind != XS_UNDEFINED_KIND) {
1018 getFunction = fxToInstance(the, get);
1019 if (!getFunction || !mxIsFunction(getFunction))

Callers 5

fx_Object_createFunction · 0.85
fx_Object_definePropertyFunction · 0.85
fxProxyGetOwnPropertyFunction · 0.85

Calls 2

fxToInstanceFunction · 0.85
fxToBooleanFunction · 0.85

Tested by

no test coverage detected