MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / recfield

Function recfield

lua/lparser.c:474–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472
473
474static void recfield (LexState *ls, struct ConsControl *cc) {
475 /* recfield -> (NAME | `['exp1`]') = exp1 */
476 FuncState *fs = ls->fs;
477 int reg = ls->fs->freereg;
478 expdesc key, val;
479 int rkkey;
480 if (ls->t.token == TK_NAME) {
481 luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
482 checkname(ls, &key);
483 }
484 else /* ls->t.token == '[' */
485 yindex(ls, &key);
486 cc->nh++;
487 checknext(ls, '=');
488 rkkey = luaK_exp2RK(fs, &key);
489 expr(ls, &val);
490 luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));
491 fs->freereg = reg; /* free registers */
492}
493
494
495static void closelistfield (FuncState *fs, struct ConsControl *cc) {

Callers 1

constructorFunction · 0.85

Calls 6

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