MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / recfield

Function recfield

deps/lua/src/lparser.c:443–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441
442
443static void recfield (LexState *ls, struct ConsControl *cc) {
444 /* recfield -> (NAME | `['exp1`]') = exp1 */
445 FuncState *fs = ls->fs;
446 int reg = ls->fs->freereg;
447 expdesc key, val;
448 int rkkey;
449 if (ls->t.token == TK_NAME) {
450 luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
451 checkname(ls, &key);
452 }
453 else /* ls->t.token == '[' */
454 yindex(ls, &key);
455 cc->nh++;
456 checknext(ls, '=');
457 rkkey = luaK_exp2RK(fs, &key);
458 expr(ls, &val);
459 luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));
460 fs->freereg = reg; /* free registers */
461}
462
463
464static 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