diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-18 10:33:54 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-18 10:33:54 -0200 |
commit | 3064edead20a04ac29dfb315fe7ff87d8c6b164d (patch) | |
tree | 6f4fa5216aaef09e4ee9a3a984f60bf7333dc528 /lparser.c | |
parent | f8c1c1469aac2253f0787c0cb7cc228b1a57e738 (diff) | |
download | lua-3064edead20a04ac29dfb315fe7ff87d8c6b164d.tar.gz lua-3064edead20a04ac29dfb315fe7ff87d8c6b164d.tar.bz2 lua-3064edead20a04ac29dfb315fe7ff87d8c6b164d.zip |
details (cleaning uses of 'exp1')
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.171 2017/12/14 14:24:02 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.172 2017/12/15 13:07:10 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -654,7 +654,7 @@ struct ConsControl { | |||
654 | 654 | ||
655 | 655 | ||
656 | static void recfield (LexState *ls, struct ConsControl *cc) { | 656 | static void recfield (LexState *ls, struct ConsControl *cc) { |
657 | /* recfield -> (NAME | '['exp1']') = exp1 */ | 657 | /* recfield -> (NAME | '['exp']') = exp */ |
658 | FuncState *fs = ls->fs; | 658 | FuncState *fs = ls->fs; |
659 | int reg = ls->fs->freereg; | 659 | int reg = ls->fs->freereg; |
660 | expdesc tab, key, val; | 660 | expdesc tab, key, val; |
@@ -916,7 +916,7 @@ static void suffixedexp (LexState *ls, expdesc *v) { | |||
916 | fieldsel(ls, v); | 916 | fieldsel(ls, v); |
917 | break; | 917 | break; |
918 | } | 918 | } |
919 | case '[': { /* '[' exp1 ']' */ | 919 | case '[': { /* '[' exp ']' */ |
920 | expdesc key; | 920 | expdesc key; |
921 | luaK_exp2anyregup(fs, v); | 921 | luaK_exp2anyregup(fs, v); |
922 | yindex(ls, &key); | 922 | yindex(ls, &key); |
@@ -1313,14 +1313,11 @@ static void repeatstat (LexState *ls, int line) { | |||
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | 1315 | ||
1316 | static int exp1 (LexState *ls) { | 1316 | static void exp1 (LexState *ls) { |
1317 | expdesc e; | 1317 | expdesc e; |
1318 | int reg; | ||
1319 | expr(ls, &e); | 1318 | expr(ls, &e); |
1320 | luaK_exp2nextreg(ls->fs, &e); | 1319 | luaK_exp2nextreg(ls->fs, &e); |
1321 | lua_assert(e.k == VNONRELOC); | 1320 | lua_assert(e.k == VNONRELOC); |
1322 | reg = e.u.info; | ||
1323 | return reg; | ||
1324 | } | 1321 | } |
1325 | 1322 | ||
1326 | 1323 | ||
@@ -1369,7 +1366,7 @@ static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { | |||
1369 | 1366 | ||
1370 | 1367 | ||
1371 | static void fornum (LexState *ls, TString *varname, int line) { | 1368 | static void fornum (LexState *ls, TString *varname, int line) { |
1372 | /* fornum -> NAME = exp1,exp1[,exp1] forbody */ | 1369 | /* fornum -> NAME = exp,exp[,exp] forbody */ |
1373 | FuncState *fs = ls->fs; | 1370 | FuncState *fs = ls->fs; |
1374 | int base = fs->freereg; | 1371 | int base = fs->freereg; |
1375 | new_localvarliteral(ls, "(for index)"); | 1372 | new_localvarliteral(ls, "(for index)"); |