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

Function fxCheckAliases

xs/tools/xslSlot.c:117–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117txInteger fxCheckAliases(txMachine* the)
118{
119 txLinker* linker = xsGetContext(the);
120 txAliasIDList _list = { C_NULL, C_NULL }, *list = &_list;
121 txSlot* module = mxProgram.value.reference->next; //@@
122 list->aliases = fxNewLinkerChunkClear(linker, the->aliasCount * sizeof(txFlag));
123 while (module) {
124 txSlot* export = mxModuleExports(module)->value.reference->next;
125 if (export) {
126 mxPushLink(moduleLink, module->ID, XSL_MODULE_FLAG);
127 while (export) {
128 txSlot* closure = export->value.export.closure;
129 if (closure) {
130 mxPushLink(exportLink, export->ID, XSL_EXPORT_FLAG);
131 if (closure->ID != XS_NO_ID) {
132 if (list->aliases[closure->ID] == 0) {
133 list->aliases[closure->ID] = 1;
134 fxCheckAliasesError(the, list, 0);
135 }
136 }
137 if (closure->kind == XS_REFERENCE_KIND) {
138 fxCheckInstanceAliases(the, closure->value.reference, list);
139 }
140 mxPopLink(exportLink);
141 }
142 export = export->next;
143 }
144 mxPopLink(moduleLink);
145 }
146 module = module->next;
147 }
148 {
149 txSlot* global = mxGlobal.value.reference->next->next;
150 while (global) {
151 if ((global->ID != mxID(_global)) && (global->ID != mxID(_globalThis))) {
152 mxPushLink(globalLink, global->ID, XSL_GLOBAL_FLAG);
153 if (global->kind == XS_REFERENCE_KIND) {
154 fxCheckInstanceAliases(the, global->value.reference, list);
155 }
156 mxPopLink(globalLink);
157 }
158 global = global->next;
159 }
160 }
161 {
162 txSlot *heap, *slot, *limit;
163 heap = the->firstHeap;
164 while (heap) {
165 slot = heap + 1;
166 limit = heap->value.reference;
167 while (slot < limit) {
168 if (slot->kind == XS_INSTANCE_KIND)
169 slot->flag &= ~XS_LEVEL_FLAG;
170 slot++;
171 }
172 heap = heap->next;
173 }
174 }

Callers 1

mainFunction · 0.85

Calls 3

fxNewLinkerChunkClearFunction · 0.85
fxCheckAliasesErrorFunction · 0.85
fxCheckInstanceAliasesFunction · 0.85

Tested by

no test coverage detected