jscript: Don't lookup global members for bytecodes with a named item.
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:
parent
982f99d3d9
commit
5b28c43dd4
|
@ -3019,6 +3019,8 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
|
|||
}
|
||||
|
||||
if(flags & (EXEC_GLOBAL | EXEC_EVAL)) {
|
||||
BOOL lookup_globals = (flags & EXEC_GLOBAL) && !bytecode->named_item;
|
||||
|
||||
for(i=0; i < function->var_cnt; i++) {
|
||||
TRACE("[%d] %s %d\n", i, debugstr_w(function->variables[i].name), function->variables[i].func_id);
|
||||
if(function->variables[i].func_id != -1) {
|
||||
|
@ -3030,7 +3032,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
|
|||
|
||||
hres = jsdisp_propput_name(variable_obj, function->variables[i].name, jsval_obj(func_obj));
|
||||
jsdisp_release(func_obj);
|
||||
}else if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i].name, NULL)) {
|
||||
}else if(!lookup_globals || !lookup_global_members(ctx, function->variables[i].name, NULL)) {
|
||||
DISPID id = 0;
|
||||
|
||||
hres = jsdisp_get_id(variable_obj, function->variables[i].name, fdexNameEnsure, &id);
|
||||
|
|
|
@ -1301,7 +1301,6 @@ static void test_named_items(void)
|
|||
|
||||
SET_EXPECT(OnEnterScript);
|
||||
SET_EXPECT(OnLeaveScript);
|
||||
SET_EXPECT(GetIDsOfNames);
|
||||
hr = IActiveScriptParse_ParseScriptText(parse, L""
|
||||
"var testVar = 42;\n"
|
||||
"testVar_global = 5;\n"
|
||||
|
@ -1310,7 +1309,6 @@ static void test_named_items(void)
|
|||
ok(hr == S_OK, "ParseScriptText failed: %08x\n", hr);
|
||||
CHECK_CALLED(OnEnterScript);
|
||||
CHECK_CALLED(OnLeaveScript);
|
||||
todo_wine CHECK_NOT_CALLED(GetIDsOfNames);
|
||||
|
||||
SET_EXPECT(OnEnterScript);
|
||||
SET_EXPECT(OnLeaveScript);
|
||||
|
|
Loading…
Reference in New Issue