diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-10 16:14:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-04-10 16:14:45 -0300 |
commit | 11c63bc3aff94a79137e45fd8a1883df465c68d5 (patch) | |
tree | 23597018ab13ac4a04257cab3a7547f6466d26ca /lparser.c | |
parent | f1f271ae76e626d1e6ffe71d5589d9e0d995bac1 (diff) | |
download | lua-11c63bc3aff94a79137e45fd8a1883df465c68d5.tar.gz lua-11c63bc3aff94a79137e45fd8a1883df465c68d5.tar.bz2 lua-11c63bc3aff94a79137e45fd8a1883df465c68d5.zip |
error in calls signalled in first line (instead of last)
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.174 2002/04/02 20:34:15 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.175 2002/04/09 19:47:44 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 | */ |
@@ -475,9 +475,9 @@ static void funcargs (LexState *ls, expdesc *f) { | |||
475 | FuncState *fs = ls->fs; | 475 | FuncState *fs = ls->fs; |
476 | expdesc args; | 476 | expdesc args; |
477 | int base, nparams; | 477 | int base, nparams; |
478 | int line = ls->linenumber; | ||
478 | switch (ls->t.token) { | 479 | switch (ls->t.token) { |
479 | case '(': { /* funcargs -> `(' [ explist1 ] `)' */ | 480 | case '(': { /* funcargs -> `(' [ explist1 ] `)' */ |
480 | int line = ls->linenumber; | ||
481 | if (line != ls->lastline) | 481 | if (line != ls->lastline) |
482 | luaK_error(ls, "ambiguous syntax (function call x new statement)"); | 482 | luaK_error(ls, "ambiguous syntax (function call x new statement)"); |
483 | next(ls); | 483 | next(ls); |
@@ -514,6 +514,7 @@ static void funcargs (LexState *ls, expdesc *f) { | |||
514 | nparams = fs->freereg - (base+1); | 514 | nparams = fs->freereg - (base+1); |
515 | } | 515 | } |
516 | init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); | 516 | init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); |
517 | fs->f->lineinfo[f->info] = line; | ||
517 | fs->freereg = base+1; /* call remove function and arguments and leaves | 518 | fs->freereg = base+1; /* call remove function and arguments and leaves |
518 | (unless changed) one result */ | 519 | (unless changed) one result */ |
519 | } | 520 | } |