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

Function getobjname

third-party/lua-5.5.0/src/ldebug.c:569–606  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 2

funcnamefromcodeFunction · 0.70
varinfoFunction · 0.70

Calls 4

basicgetobjnameFunction · 0.70
knameFunction · 0.70
isEnvFunction · 0.70
rnameFunction · 0.70

Tested by

no test coverage detected