MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / basicgetobjname

Function basicgetobjname

lib/lua/src/ldebug.c:495–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493
494
495static const char *basicgetobjname (const Proto *p, int *ppc, int reg,
496 const char **name) {
497 int pc = *ppc;
498 *name = luaF_getlocalname(p, reg + 1, pc);
499 if (*name) /* is a local? */
500 return "local";
501 /* else try symbolic execution */
502 *ppc = pc = findsetreg(p, pc, reg);
503 if (pc != -1) { /* could find instruction? */
504 Instruction i = p->code[pc];
505 OpCode op = GET_OPCODE(i);
506 switch (op) {
507 case OP_MOVE: {
508 int b = GETARG_B(i); /* move from 'b' to 'a' */
509 if (b < GETARG_A(i))
510 return basicgetobjname(p, ppc, b, name); /* get name for 'b' */
511 break;
512 }
513 case OP_GETUPVAL: {
514 *name = upvalname(p, GETARG_B(i));
515 return "upvalue";
516 }
517 case OP_LOADK: return kname(p, GETARG_Bx(i), name);
518 case OP_LOADKX: return kname(p, GETARG_Ax(p->code[pc + 1]), name);
519 default: break;
520 }
521 }
522 return NULL; /* could not find reasonable name */
523}
524
525
526/*

Callers 3

rnameFunction · 0.85
isEnvFunction · 0.85
getobjnameFunction · 0.85

Calls 4

luaF_getlocalnameFunction · 0.85
findsetregFunction · 0.85
upvalnameFunction · 0.85
knameFunction · 0.85

Tested by

no test coverage detected