Jacek Caban : jscript: Fallback to begin of input in script_parse if error location was not recorded.
Alexandre Julliard
julliard at winehq.org
Wed Mar 24 16:20:42 CDT 2021
Module: wine
Branch: master
Commit: bb61c8d338c825c31057014b3c46d322f402ec27
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bb61c8d338c825c31057014b3c46d322f402ec27
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 24 16:41:45 2021 +0100
jscript: Fallback to begin of input in script_parse if error location was not recorded.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/parser.y | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 716c9688201..bfc83912ba1 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1595,7 +1595,8 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
heap_pool_clear(mark);
hres = parser_ctx->hres;
if(FAILED(hres)) {
- const WCHAR *line_start = code->source + parser_ctx->error_loc, *line_end = line_start;
+ unsigned int error_loc = parser_ctx->error_loc == -1 ? 0 : parser_ctx->error_loc;
+ const WCHAR *line_start = code->source + error_loc, *line_end = line_start;
jsstr_t *line_str;
while(line_start > code->source && line_start[-1] != '\n')
@@ -1609,7 +1610,7 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
debugstr_jsstr(line_str));
throw_error(ctx, hres, NULL);
- set_error_location(ctx->ei, code, parser_ctx->error_loc, IDS_COMPILATION_ERROR, line_str);
+ set_error_location(ctx->ei, code, error_loc, IDS_COMPILATION_ERROR, line_str);
parser_release(parser_ctx);
if(line_str)
jsstr_release(line_str);
More information about the wine-cvs
mailing list