mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Correction in line info for semantic errors
Semantic errors should refer the last used token, not the next one.
This commit is contained in:
parent
e44f3a2ffc
commit
81f4def54f
2 changed files with 43 additions and 22 deletions
1
lcode.c
1
lcode.c
|
|
@ -45,6 +45,7 @@ l_noret luaK_semerror (LexState *ls, const char *fmt, ...) {
|
|||
va_list argp;
|
||||
pushvfstring(ls->L, argp, fmt, msg);
|
||||
ls->t.token = 0; /* remove "near <token>" from final message */
|
||||
ls->linenumber = ls->lastline; /* back to line of last used token */
|
||||
luaX_syntaxerror(ls, msg);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue