MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / constructor

Function constructor

ThirdParty/lua/lua/lparser.c:718–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716
717
718static void constructor (LexState *ls, expdesc *t) {
719 /* constructor -> '{' [ field { sep field } [sep] ] '}'
720 sep -> ',' | ';' */
721 FuncState *fs = ls->fs;
722 int line = ls->linenumber;
723 int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
724 struct ConsControl cc;
725 cc.na = cc.nh = cc.tostore = 0;
726 cc.t = t;
727 init_exp(t, VRELOCABLE, pc);
728 init_exp(&cc.v, VVOID, 0); /* no value (yet) */
729 luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */
730 checknext(ls, '{');
731 do {
732 lua_assert(cc.v.k == VVOID || cc.tostore > 0);
733 if (ls->t.token == '}') break;
734 closelistfield(fs, &cc);
735 field(ls, &cc);
736 } while (testnext(ls, ',') || testnext(ls, ';'));
737 check_match(ls, '}', '{', line);
738 lastlistfield(fs, &cc);
739 SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */
740 SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */
741}
742
743/* }====================================================================== */
744

Callers 2

funcargsFunction · 0.85
simpleexpFunction · 0.85

Calls 10

luaK_codeABCFunction · 0.85
init_expFunction · 0.85
luaK_exp2nextregFunction · 0.85
checknextFunction · 0.85
closelistfieldFunction · 0.85
fieldFunction · 0.85
testnextFunction · 0.85
lastlistfieldFunction · 0.85
luaO_int2fbFunction · 0.85
check_matchFunction · 0.70

Tested by

no test coverage detected