** Check whether table being indexed by instruction 'i' is the ** environment '_ENV' */
| 548 | ** environment '_ENV' |
| 549 | */ |
| 550 | static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) { |
| 551 | int t = GETARG_B(i); /* table index */ |
| 552 | const char *name; /* name of indexed variable */ |
| 553 | if (isup) /* is 't' an upvalue? */ |
| 554 | name = upvalname(p, t); |
| 555 | else { /* 't' is a register */ |
| 556 | const char *what = basicgetobjname(p, &pc, t, &name); |
| 557 | /* 'name' must be the name of a local variable (at the current |
| 558 | level or an upvalue) */ |
| 559 | if (what != strlocal && what != strupval) |
| 560 | name = NULL; /* cannot be the variable _ENV */ |
| 561 | } |
| 562 | return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field"; |
| 563 | } |
| 564 | |
| 565 | |
| 566 | /* |
no test coverage detected