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

Function getobjname

lib/lua/src/ldebug.c:566–602  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 2

funcnamefromcodeFunction · 0.85
varinfoFunction · 0.85

Calls 5

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

Tested by

no test coverage detected