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

Function fxCheckInstanceAliases

xs/tools/xslSlot.c:259–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259void fxCheckInstanceAliases(txMachine* the, txSlot* instance, txAliasIDList* list)
260{
261 txSlot* property = instance->next;
262 if (instance->flag & XS_LEVEL_FLAG)
263 return;
264 instance->flag |= XS_LEVEL_FLAG;
265 if (instance->value.instance.prototype) {
266 mxPushLink(propertyLink, mxID(___proto__), XSL_PROPERTY_FLAG);
267 fxCheckInstanceAliases(the, instance->value.instance.prototype, list);
268 mxPopLink(propertyLink);
269 }
270 if (instance->ID != XS_NO_ID) {
271 if (list->aliases[instance->ID] == 0) {
272 list->aliases[instance->ID] = 1;
273 fxCheckAliasesError(the, list, 1);
274 }
275 }
276 while (property && (property->flag & XS_INTERNAL_FLAG)) {
277 if (property->kind == XS_ARRAY_KIND) {
278 txSlot* item = property->value.array.address;
279 txInteger length = (txInteger)fxGetIndexSize(the, property);
280 while (length > 0) {
281 mxPushLink(propertyLink, *((txInteger*)item), XSL_ITEM_FLAG);
282 fxCheckPropertyAliases(the, item, list);
283 mxPopLink(propertyLink);
284 item++;
285 length--;
286 }
287 }
288 else if ((property->kind == XS_CODE_KIND) || (property->kind == XS_CODE_X_KIND)) {
289 if (property->value.code.closures)
290 fxCheckEnvironmentAliases(the, property->value.code.closures, list);
291 }
292 else if (property->kind == XS_PRIVATE_KIND) {
293 txSlot* item = property->value.private.first;
294 while (item) {
295 mxPushLink(propertyLink, item->ID, XSL_PROPERTY_FLAG);
296 fxCheckPropertyAliases(the, item, list);
297 mxPopLink(propertyLink);
298 item = item->next;
299 }
300 }
301 else if (property->kind == XS_PROXY_KIND) {
302 if (property->value.proxy.handler) {
303 mxPushLink(propertyLink, XS_NO_ID, XSL_PROXY_HANDLER_FLAG);
304 fxCheckInstanceAliases(the, property->value.proxy.handler, list);
305 mxPopLink(propertyLink);
306 }
307 if (property->value.proxy.target) {
308 mxPushLink(propertyLink, XS_NO_ID, XSL_PROXY_TARGET_FLAG);
309 fxCheckInstanceAliases(the, property->value.proxy.target, list);
310 mxPopLink(propertyLink);
311 }
312 }
313 else if (property->kind == XS_STACK_KIND) {
314 fxCheckAliasesError(the, list, 3);
315 }
316 property = property->next;

Callers 3

fxCheckAliasesFunction · 0.85
fxCheckPropertyAliasesFunction · 0.85

Calls 4

fxCheckAliasesErrorFunction · 0.85
fxGetIndexSizeFunction · 0.85
fxCheckPropertyAliasesFunction · 0.85

Tested by

no test coverage detected