diff options
-rw-r--r-- | lparser.c | 12 | ||||
-rw-r--r-- | testes/errors.lua | 8 |
2 files changed, 10 insertions, 10 deletions
@@ -1022,10 +1022,11 @@ static int explist (LexState *ls, expdesc *v) { | |||
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | 1024 | ||
1025 | static void funcargs (LexState *ls, expdesc *f, int line) { | 1025 | static void funcargs (LexState *ls, expdesc *f) { |
1026 | FuncState *fs = ls->fs; | 1026 | FuncState *fs = ls->fs; |
1027 | expdesc args; | 1027 | expdesc args; |
1028 | int base, nparams; | 1028 | int base, nparams; |
1029 | int line = ls->linenumber; | ||
1029 | switch (ls->t.token) { | 1030 | switch (ls->t.token) { |
1030 | case '(': { /* funcargs -> '(' [ explist ] ')' */ | 1031 | case '(': { /* funcargs -> '(' [ explist ] ')' */ |
1031 | luaX_next(ls); | 1032 | luaX_next(ls); |
@@ -1063,8 +1064,8 @@ static void funcargs (LexState *ls, expdesc *f, int line) { | |||
1063 | } | 1064 | } |
1064 | init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); | 1065 | init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); |
1065 | luaK_fixline(fs, line); | 1066 | luaK_fixline(fs, line); |
1066 | fs->freereg = base+1; /* call remove function and arguments and leaves | 1067 | fs->freereg = base+1; /* call removes function and arguments and leaves |
1067 | (unless changed) one result */ | 1068 | one result (unless changed later) */ |
1068 | } | 1069 | } |
1069 | 1070 | ||
1070 | 1071 | ||
@@ -1103,7 +1104,6 @@ static void suffixedexp (LexState *ls, expdesc *v) { | |||
1103 | /* suffixedexp -> | 1104 | /* suffixedexp -> |
1104 | primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ | 1105 | primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ |
1105 | FuncState *fs = ls->fs; | 1106 | FuncState *fs = ls->fs; |
1106 | int line = ls->linenumber; | ||
1107 | primaryexp(ls, v); | 1107 | primaryexp(ls, v); |
1108 | for (;;) { | 1108 | for (;;) { |
1109 | switch (ls->t.token) { | 1109 | switch (ls->t.token) { |
@@ -1123,12 +1123,12 @@ static void suffixedexp (LexState *ls, expdesc *v) { | |||
1123 | luaX_next(ls); | 1123 | luaX_next(ls); |
1124 | codename(ls, &key); | 1124 | codename(ls, &key); |
1125 | luaK_self(fs, v, &key); | 1125 | luaK_self(fs, v, &key); |
1126 | funcargs(ls, v, line); | 1126 | funcargs(ls, v); |
1127 | break; | 1127 | break; |
1128 | } | 1128 | } |
1129 | case '(': case TK_STRING: case '{': { /* funcargs */ | 1129 | case '(': case TK_STRING: case '{': { /* funcargs */ |
1130 | luaK_exp2nextreg(fs, v); | 1130 | luaK_exp2nextreg(fs, v); |
1131 | funcargs(ls, v, line); | 1131 | funcargs(ls, v); |
1132 | break; | 1132 | break; |
1133 | } | 1133 | } |
1134 | default: return; | 1134 | default: return; |
diff --git a/testes/errors.lua b/testes/errors.lua index bf6f389d..b777a329 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
@@ -392,19 +392,19 @@ lineerror("a\n=\n-\n\nprint\n;", 3) | |||
392 | 392 | ||
393 | lineerror([[ | 393 | lineerror([[ |
394 | a | 394 | a |
395 | ( | 395 | ( -- << |
396 | 23) | 396 | 23) |
397 | ]], 1) | 397 | ]], 2) |
398 | 398 | ||
399 | lineerror([[ | 399 | lineerror([[ |
400 | local a = {x = 13} | 400 | local a = {x = 13} |
401 | a | 401 | a |
402 | . | 402 | . |
403 | x | 403 | x |
404 | ( | 404 | ( -- << |
405 | 23 | 405 | 23 |
406 | ) | 406 | ) |
407 | ]], 2) | 407 | ]], 5) |
408 | 408 | ||
409 | lineerror([[ | 409 | lineerror([[ |
410 | local a = {x = 13} | 410 | local a = {x = 13} |