vbscript: Pass parser error location to compiler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
12b1bcdb95
commit
eb73571fe9
|
@ -1917,27 +1917,25 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
|
|||
vbscode_t *code;
|
||||
HRESULT hres;
|
||||
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
code = ctx.code = alloc_vbscode(&ctx, src, cookie, start_line);
|
||||
if(!ctx.code)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hres = parse_script(&ctx.parser, code->source, delimiter, flags);
|
||||
if(FAILED(hres)) {
|
||||
if(ctx.parser.error_loc != -1)
|
||||
ctx.loc = ctx.parser.error_loc;
|
||||
hres = compile_error(script, hres);
|
||||
release_vbscode(code);
|
||||
return hres;
|
||||
}
|
||||
|
||||
ctx.func_decls = NULL;
|
||||
ctx.labels = NULL;
|
||||
ctx.global_consts = NULL;
|
||||
ctx.stat_ctx = NULL;
|
||||
ctx.labels_cnt = ctx.labels_size = 0;
|
||||
|
||||
hres = compile_func(&ctx, ctx.parser.stats, &ctx.code->main_code);
|
||||
if(FAILED(hres)) {
|
||||
hres = compile_error(script, hres);
|
||||
release_compiler(&ctx);
|
||||
return compile_error(script, hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
ctx.global_consts = ctx.const_decls;
|
||||
|
@ -1947,8 +1945,9 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
|
|||
for(func_decl = ctx.func_decls; func_decl; func_decl = func_decl->next) {
|
||||
hres = create_function(&ctx, func_decl, &new_func);
|
||||
if(FAILED(hres)) {
|
||||
hres = compile_error(script, hres);
|
||||
release_compiler(&ctx);
|
||||
return compile_error(script, hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
new_func->next = ctx.code->funcs;
|
||||
|
|
|
@ -286,6 +286,7 @@ typedef struct {
|
|||
BOOL option_explicit;
|
||||
BOOL is_html;
|
||||
HRESULT hres;
|
||||
int error_loc;
|
||||
|
||||
int last_token;
|
||||
unsigned last_nl;
|
||||
|
|
|
@ -505,6 +505,8 @@ StSep
|
|||
|
||||
static int parser_error(unsigned *loc, parser_ctx_t *ctx, const char *str)
|
||||
{
|
||||
if(ctx->error_loc == -1)
|
||||
ctx->error_loc = *loc;
|
||||
if(ctx->hres == S_OK) {
|
||||
FIXME("%s: %s\n", debugstr_w(ctx->code + *loc), debugstr_a(str));
|
||||
ctx->hres = E_FAIL;
|
||||
|
@ -1142,6 +1144,7 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
|
|||
heap_pool_init(&ctx->heap);
|
||||
|
||||
ctx->hres = S_OK;
|
||||
ctx->error_loc = -1;
|
||||
ctx->last_token = tNL;
|
||||
ctx->last_nl = 0;
|
||||
ctx->stats = ctx->stats_tail = NULL;
|
||||
|
|
Loading…
Reference in New Issue