MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / getobjname

Function getobjname

third-party/lua-5.4.6/src/ldebug.c:575–611  ·  view source on GitHub ↗

** Extend 'basicgetobjname' to handle table accesses */

Source from the content-addressed store, hash-verified

573** Extend 'basicgetobjname' to handle table accesses
574*/
575static const char *getobjname (const Proto *p, int lastpc, int reg,
576 const char **name) {
577 const char *kind = basicgetobjname(p, &lastpc, reg, name);
578 if (kind != NULL)
579 return kind;
580 else if (lastpc != -1) { /* could find instruction? */
581 Instruction i = p->code[lastpc];
582 OpCode op = GET_OPCODE(i);
583 switch (op) {
584 case OP_GETTABUP: {
585 int k = GETARG_C(i); /* key index */
586 kname(p, k, name);
587 return isEnv(p, lastpc, i, 1);
588 }
589 case OP_GETTABLE: {
590 int k = GETARG_C(i); /* key index */
591 rname(p, lastpc, k, name);
592 return isEnv(p, lastpc, i, 0);
593 }
594 case OP_GETI: {
595 *name = "integer index";
596 return "field";
597 }
598 case OP_GETFIELD: {
599 int k = GETARG_C(i); /* key index */
600 kname(p, k, name);
601 return isEnv(p, lastpc, i, 0);
602 }
603 case OP_SELF: {
604 rkname(p, lastpc, i, name);
605 return "method";
606 }
607 default: break; /* go through to return NULL */
608 }
609 }
610 return NULL; /* could not find reasonable name */
611}
612
613
614/*

Callers 2

funcnamefromcodeFunction · 0.70
varinfoFunction · 0.70

Calls 5

rknameFunction · 0.85
basicgetobjnameFunction · 0.70
knameFunction · 0.70
isEnvFunction · 0.70
rnameFunction · 0.70

Tested by

no test coverage detected