MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / constructor

Function constructor

src/Chain/libraries/glua/lparser.cpp:752–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750
751
752static void constructor(LexState *ls, expdesc *t) {
753 /* constructor -> '{' [ field { sep field } [sep] ] '}'
754 sep -> ',' | ';' */
755 FuncState *fs = ls->fs;
756 int line = ls->linenumber;
757 int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
758 struct ConsControl cc;
759 cc.na = cc.nh = cc.tostore = 0;
760 cc.t = t;
761 init_exp(t, VRELOCABLE, pc);
762 init_exp(&cc.v, VVOID, 0); /* no value (yet) */
763 luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */
764 checknext(ls, '{');
765 do {
766 lua_assert(cc.v.k == VVOID || cc.tostore > 0);
767 if (ls->t.token == '}') break;
768 closelistfield(fs, &cc);
769 field(ls, &cc);
770 } while (testnext(ls, ',') || testnext(ls, ';'));
771 check_match(ls, '}', '{', line);
772 lastlistfield(fs, &cc);
773 SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */
774 SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */
775}
776
777/* }====================================================================== */
778

Callers 2

funcargsFunction · 0.70
simpleexpFunction · 0.70

Calls 10

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

Tested by

no test coverage detected