vbscript: Store the compiled classes list head into vbscode_t.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2019-11-11 14:34:22 +02:00 committed by Alexandre Julliard
parent 83e520f556
commit 8b30b86765
2 changed files with 8 additions and 10 deletions

View File

@ -63,8 +63,6 @@ typedef struct {
function_t *func; function_t *func;
function_t *funcs; function_t *funcs;
function_decl_t *func_decls; function_decl_t *func_decls;
class_desc_t *classes;
} compile_ctx_t; } compile_ctx_t;
static HRESULT compile_expression(compile_ctx_t*,expression_t*); static HRESULT compile_expression(compile_ctx_t*,expression_t*);
@ -1586,7 +1584,7 @@ static BOOL lookup_class_name(compile_ctx_t *ctx, const WCHAR *name)
{ {
class_desc_t *iter; class_desc_t *iter;
for(iter = ctx->classes; iter; iter = iter->next) { for(iter = ctx->code->classes; iter; iter = iter->next) {
if(!wcsicmp(iter->name, name)) if(!wcsicmp(iter->name, name))
return TRUE; return TRUE;
} }
@ -1754,8 +1752,8 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
} }
} }
class_desc->next = ctx->classes; class_desc->next = ctx->code->classes;
ctx->classes = class_desc; ctx->code->classes = class_desc;
return S_OK; return S_OK;
} }
@ -1795,7 +1793,7 @@ static HRESULT check_script_collisions(compile_ctx_t *ctx, script_ctx_t *script)
} }
} }
for(class = ctx->classes; class; class = class->next) { for(class = ctx->code->classes; class; class = class->next) {
if(lookup_script_identifier(script, class->name)) { if(lookup_script_identifier(script, class->name)) {
FIXME("%s: redefined\n", debugstr_w(class->name)); FIXME("%s: redefined\n", debugstr_w(class->name));
return E_FAIL; return E_FAIL;
@ -1888,7 +1886,6 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
ctx.funcs = NULL; ctx.funcs = NULL;
ctx.func_decls = NULL; ctx.func_decls = NULL;
ctx.classes = NULL;
ctx.labels = NULL; ctx.labels = NULL;
ctx.global_consts = NULL; ctx.global_consts = NULL;
ctx.stat_ctx = NULL; ctx.stat_ctx = NULL;
@ -1985,8 +1982,8 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
script->global_funcs[script->global_funcs_cnt++] = func_iter; script->global_funcs[script->global_funcs_cnt++] = func_iter;
} }
if(ctx.classes) { if(ctx.code->classes) {
class_desc_t *class = ctx.classes; class_desc_t *class = ctx.code->classes;
while(1) { while(1) {
class->ctx = script; class->ctx = script;
@ -1996,7 +1993,7 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli
} }
class->next = script->classes; class->next = script->classes;
script->classes = ctx.classes; script->classes = ctx.code->classes;
code->last_class = class; code->last_class = class;
} }

View File

@ -350,6 +350,7 @@ struct _vbscode_t {
unsigned bstr_cnt; unsigned bstr_cnt;
heap_pool_t heap; heap_pool_t heap;
class_desc_t *classes;
class_desc_t *last_class; class_desc_t *last_class;
struct list entry; struct list entry;