From f3e1f7002dbbfa73724cd57b2e86e9864ec71e13 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 13 Nov 2013 16:29:05 +0100 Subject: [PATCH] vbscript: Store variables in declaration order. --- dlls/vbscript/compile.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index ccf7700f88e..7353c2270a5 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -54,6 +54,7 @@ typedef struct { unsigned prop_end_label; dim_decl_t *dim_decls; + dim_decl_t *dim_decls_tail; dynamic_var_t *global_vars; const_decl_t *const_decls; @@ -945,8 +946,11 @@ static HRESULT compile_dim_statement(compile_ctx_t *ctx, dim_statement_t *stat) dim_decl = dim_decl->next; } - dim_decl->next = ctx->dim_decls; - ctx->dim_decls = stat->dim_decls; + if(ctx->dim_decls_tail) + ctx->dim_decls_tail->next = stat->dim_decls; + else + ctx->dim_decls = stat->dim_decls; + ctx->dim_decls_tail = dim_decl; return S_OK; } @@ -1239,7 +1243,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f } ctx->func = func; - ctx->dim_decls = NULL; + ctx->dim_decls = ctx->dim_decls_tail = NULL; ctx->const_decls = NULL; hres = compile_statement(ctx, NULL, stat); ctx->func = NULL; @@ -1668,7 +1672,6 @@ HRESULT compile_script(script_ctx_t *script, const WCHAR *src, const WCHAR *deli ctx.funcs = NULL; ctx.func_decls = NULL; ctx.global_vars = NULL; - ctx.dim_decls = NULL; ctx.classes = NULL; ctx.labels = NULL; ctx.global_consts = NULL;