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

Function fxListLocal

xs/sources/xsDebug.c:2391–2459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2389}
2390
2391void fxListLocal(txMachine* the)
2392{
2393 txInspectorNameList aList = { C_NULL, C_NULL };
2394 txSlot* frame = fxFindFrame(the);
2395 txSlot* scope = C_NULL;
2396 if (!frame) // @@
2397 return;
2398 fxEcho(the, "<local");
2399 fxEcho(the, " name=\"");
2400 fxEchoFrameName(the, frame);
2401 fxEcho(the, "\"");
2402 fxEchoAddress(the, frame);
2403 fxEchoFramePathLine(the, frame);
2404 fxEcho(the, ">");
2405 fxEchoProperty(the, frame + 1, &aList, "(return)", -1, C_NULL);
2406 fxEchoProperty(the, frame + 2, &aList, "(function)", -1, C_NULL);
2407 fxEchoProperty(the, frame + 3, &aList, "this", -1, C_NULL);
2408 if (frame->flag & XS_TARGET_FLAG)
2409 fxEchoProperty(the, frame + 4, &aList, "new.target", -1, C_NULL);
2410 if (frame == the->frame)
2411 scope = the->scope;
2412 else {
2413 txSlot* current = the->frame;
2414 while (current->next != frame)
2415 current = current->next;
2416 if (current)
2417 scope = current->value.frame.scope;
2418 }
2419 if (frame->flag & XS_C_FLAG) {
2420 txInteger aCount, anIndex;
2421 aCount = (txInteger)(frame->ID);
2422 for (anIndex = 0; anIndex < aCount; anIndex++) {
2423 fxEchoProperty(the, (frame - 1 - anIndex), &aList, "arg(", anIndex, ")");
2424 }
2425 if (scope) {
2426 aCount = scope->value.environment.variable.count;
2427 for (anIndex = 0; anIndex < aCount; anIndex++) {
2428 fxEchoProperty(the, (scope - 1 - anIndex), &aList, "var(", anIndex, ")");
2429 }
2430 }
2431 }
2432 else {
2433 if (scope) {
2434 txSlot* aSlot = mxFrameToEnvironment(frame);
2435 txID id;
2436 while (aSlot > scope) {
2437 aSlot--;
2438 id = aSlot->ID;
2439 if ((0 < id) && (id < the->keyCount)) {
2440 txSlot* key;
2441 if (id < the->keyOffset)
2442 key = the->keyArrayHost[id];
2443 else
2444 key = the->keyArray[id - the->keyOffset];
2445 if (key) {
2446 txKind kind = mxGetKeySlotKind(key);
2447 if ((kind == XS_KEY_KIND) || (kind == XS_KEY_X_KIND)) {
2448 if (key->value.key.string[0] != '#')

Callers 3

fxDebugEvalFunction · 0.85
fxDebugLoopFunction · 0.85
fxDebugPushTagFunction · 0.85

Calls 6

fxFindFrameFunction · 0.85
fxEchoFunction · 0.85
fxEchoFrameNameFunction · 0.85
fxEchoAddressFunction · 0.85
fxEchoFramePathLineFunction · 0.85
fxEchoPropertyFunction · 0.85

Tested by

no test coverage detected