diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 96117f20744..c9db8e656c0 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -537,11 +537,11 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, js return S_OK; if(flags & EXPR_NEWREF) { - hres = jsdisp_get_id(ctx->var_disp, identifier, fdexNameEnsure, &id); + hres = jsdisp_get_id(ctx->parser->script->script_disp, identifier, fdexNameEnsure, &id); if(FAILED(hres)) return hres; - exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->var_disp), id); + exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->script_disp), id); return S_OK; } diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index 56f71d6d2da..b0e90fc0e05 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -907,4 +907,7 @@ function () {} nosemicolon(); ok(typeof(doesnotexist) === "undefined", "typeof(doesnotexist) = " + typeof(doesnotexist)); +(function() { newValue = 1; })(); +ok(newValue === 1, "newValue = " + newValue); + reportSuccess();