Jacek Caban : vbscript: Clean up lookup_identifier.

Alexandre Julliard julliard at winehq.org
Tue Nov 5 16:11:44 CST 2019


Module: wine
Branch: master
Commit: ae1291cbe0c7fbe0dd4aeffbe214388c4ebecb2f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ae1291cbe0c7fbe0dd4aeffbe214388c4ebecb2f

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov  5 14:09:20 2019 +0100

vbscript: Clean up lookup_identifier.

Be more explicit about what applies only to non-global code.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/interp.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 211a5af5f8..89f9d359da 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -109,26 +109,26 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
         return S_OK;
     }
 
-    for(i=0; i < ctx->func->var_cnt; i++) {
-        if(!wcsicmp(ctx->func->vars[i].name, name)) {
-            ref->type = REF_VAR;
-            ref->u.v = ctx->vars+i;
-            return TRUE;
+    if(ctx->func->type != FUNC_GLOBAL) {
+        for(i=0; i < ctx->func->var_cnt; i++) {
+            if(!wcsicmp(ctx->func->vars[i].name, name)) {
+                ref->type = REF_VAR;
+                ref->u.v = ctx->vars+i;
+                return TRUE;
+            }
         }
-    }
 
-    for(i=0; i < ctx->func->arg_cnt; i++) {
-        if(!wcsicmp(ctx->func->args[i].name, name)) {
-            ref->type = REF_VAR;
-            ref->u.v = ctx->args+i;
-            return S_OK;
+        for(i=0; i < ctx->func->arg_cnt; i++) {
+            if(!wcsicmp(ctx->func->args[i].name, name)) {
+                ref->type = REF_VAR;
+                ref->u.v = ctx->args+i;
+                return S_OK;
+            }
         }
-    }
 
-    if(lookup_dynamic_vars(ctx->func->type == FUNC_GLOBAL ? ctx->script->global_vars : ctx->dynamic_vars, name, ref))
-        return S_OK;
+        if(lookup_dynamic_vars(ctx->dynamic_vars, name, ref))
+            return S_OK;
 
-    if(ctx->func->type != FUNC_GLOBAL) {
         if(ctx->vbthis) {
             /* FIXME: Bind such identifier while generating bytecode. */
             for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) {
@@ -159,7 +159,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
         }
     }
 
-    if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
+    if(lookup_dynamic_vars(ctx->script->global_vars, name, ref))
         return S_OK;
 
     for(i = 0; i < ctx->script->global_funcs_cnt; i++) {




More information about the wine-cvs mailing list