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

Function declarestat

lua/lparser.c:1239–1262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237
1238
1239static void declarestat (LexState *ls) {
1240 /* stat -> DECLARE NAME {',' NAME} expr */
1241 int nvars = 0;
1242 int nexps;
1243 expdesc e1, e2;
1244 do {
1245 new_localvar(ls, str_checkname(ls), nvars++);
1246 } while (testnext(ls, ','));
1247
1248 /* get the type */
1249 expr(ls, &e1);
1250 init_exp(&e2, VNIL, 0);
1251 codearith(ls->fs, OP_CAST, &e2, &e1);
1252
1253 /* generate typed assingnment */
1254 for (nexps = 1; nexps < nvars; ++nexps) {
1255 luaK_exp2nextreg(ls->fs, &e2);
1256 init_exp(&e2, VNIL, 0);
1257 codearith(ls->fs, OP_CAST, &e2, &e1);
1258 }
1259
1260 adjust_assign(ls, nvars, nexps, &e2);
1261 adjustlocalvars(ls, nvars);
1262}
1263
1264
1265static void localstat (LexState *ls) {

Callers 1

statementFunction · 0.85

Calls 9

new_localvarFunction · 0.85
str_checknameFunction · 0.85
testnextFunction · 0.85
exprFunction · 0.85
init_expFunction · 0.85
codearithFunction · 0.85
luaK_exp2nextregFunction · 0.85
adjust_assignFunction · 0.85
adjustlocalvarsFunction · 0.85

Tested by

no test coverage detected