MCPcopy Create free account
hub / github.com/DFHack/dfhack / recfield

Function recfield

depends/lua/src/lparser.c:647–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645
646
647static void recfield (LexState *ls, struct ConsControl *cc) {
648 /* recfield -> (NAME | '['exp1']') = exp1 */
649 FuncState *fs = ls->fs;
650 int reg = ls->fs->freereg;
651 expdesc key, val;
652 int rkkey;
653 if (ls->t.token == TK_NAME) {
654 checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
655 checkname(ls, &key);
656 }
657 else /* ls->t.token == '[' */
658 yindex(ls, &key);
659 cc->nh++;
660 checknext(ls, '=');
661 rkkey = luaK_exp2RK(fs, &key);
662 expr(ls, &val);
663 luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val));
664 fs->freereg = reg; /* free registers */
665}
666
667
668static void closelistfield (FuncState *fs, struct ConsControl *cc) {

Callers 1

fieldFunction · 0.85

Calls 7

checklimitFunction · 0.85
checknameFunction · 0.85
yindexFunction · 0.85
checknextFunction · 0.85
luaK_exp2RKFunction · 0.85
exprFunction · 0.85
luaK_codeABCFunction · 0.85

Tested by

no test coverage detected