Correction in line info for semantic errors

Semantic errors should refer the last used token, not the next one.
This commit is contained in:
Roberto I
2025-11-11 14:36:16 -03:00
parent e44f3a2ffc
commit 81f4def54f
2 changed files with 43 additions and 22 deletions

View File

@@ -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);
}