MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / constructor

Function constructor

extlibs/lua/src/lparser.c:906–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

904
905
906static void constructor (LexState *ls, expdesc *t) {
907 /* constructor -> '{' [ field { sep field } [sep] ] '}'
908 sep -> ',' | ';' */
909 FuncState *fs = ls->fs;
910 int line = ls->linenumber;
911 int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
912 ConsControl cc;
913 luaK_code(fs, 0); /* space for extra arg. */
914 cc.na = cc.nh = cc.tostore = 0;
915 cc.t = t;
916 init_exp(t, VNONRELOC, fs->freereg); /* table will be at stack top */
917 luaK_reserveregs(fs, 1);
918 init_exp(&cc.v, VVOID, 0); /* no value (yet) */
919 checknext(ls, '{');
920 do {
921 lua_assert(cc.v.k == VVOID || cc.tostore > 0);
922 if (ls->t.token == '}') break;
923 closelistfield(fs, &cc);
924 field(ls, &cc);
925 } while (testnext(ls, ',') || testnext(ls, ';'));
926 check_match(ls, '}', '{', line);
927 lastlistfield(fs, &cc);
928 luaK_settablesize(fs, pc, t->u.info, cc.na, cc.nh);
929}
930
931/* }====================================================================== */
932

Callers 2

funcargsFunction · 0.85
simpleexpFunction · 0.85

Calls 10

luaK_codeFunction · 0.85
init_expFunction · 0.85
luaK_reserveregsFunction · 0.85
checknextFunction · 0.85
closelistfieldFunction · 0.85
testnextFunction · 0.85
lastlistfieldFunction · 0.85
luaK_settablesizeFunction · 0.85
fieldFunction · 0.70
check_matchFunction · 0.70

Tested by

no test coverage detected