From 652a0121a9cf55d47bce176bcbb7e55c6927ec04 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 9 Sep 2008 01:24:49 +0200 Subject: [PATCH] jscript: Added variable object handling. --- dlls/jscript/engine.c | 15 ++++++++++++--- dlls/jscript/engine.h | 3 ++- dlls/jscript/jscript.c | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index db13aef5c05..b3ae71f3ab3 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -108,7 +108,7 @@ void scope_release(scope_chain_t *scope) heap_free(scope); } -HRESULT create_exec_ctx(scope_chain_t *scope, exec_ctx_t **ret) +HRESULT create_exec_ctx(DispatchEx *var_disp, scope_chain_t *scope, exec_ctx_t **ret) { exec_ctx_t *ctx; @@ -116,6 +116,9 @@ HRESULT create_exec_ctx(scope_chain_t *scope, exec_ctx_t **ret) if(!ctx) return E_OUTOFMEMORY; + IDispatchEx_AddRef(_IDispatchEx_(var_disp)); + ctx->var_disp = var_disp; + if(scope) { scope_addref(scope); ctx->scope_chain = scope; @@ -132,6 +135,8 @@ void exec_release(exec_ctx_t *ctx) if(ctx->scope_chain) scope_release(ctx->scope_chain); + if(ctx->var_disp) + IDispatchEx_Release(_IDispatchEx_(ctx->var_disp)); heap_free(ctx); } @@ -300,8 +305,12 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex } if(flags & EXPR_NEWREF) { - FIXME("create ref\n"); - return E_NOTIMPL; + hres = dispex_get_id(_IDispatchEx_(ctx->var_disp), identifier, fdexNameEnsure, &id); + if(FAILED(hres)) + return hres; + + exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->var_disp), id); + return S_OK; } WARN("Could not find identifier %s\n", debugstr_w(identifier)); diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 964e2b70ee5..ce9253d8bd6 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -75,6 +75,7 @@ struct _exec_ctx_t { parser_ctx_t *parser; scope_chain_t *scope_chain; + DispatchEx *var_disp; }; static inline void exec_addref(exec_ctx_t *ctx) @@ -83,7 +84,7 @@ static inline void exec_addref(exec_ctx_t *ctx) } void exec_release(exec_ctx_t*); -HRESULT create_exec_ctx(scope_chain_t*,exec_ctx_t**); +HRESULT create_exec_ctx(DispatchEx*,scope_chain_t*,exec_ctx_t**); HRESULT exec_source(exec_ctx_t*,parser_ctx_t*,source_elements_t*,jsexcept_t*,VARIANT*); typedef struct _statement_t statement_t; diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 50ba18cbed8..a104aa9aadf 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -80,7 +80,7 @@ static HRESULT exec_global_code(JScript *This, parser_ctx_t *parser_ctx) VARIANT var; HRESULT hres; - hres = create_exec_ctx(NULL, &exec_ctx); + hres = create_exec_ctx(This->ctx->script_disp, NULL, &exec_ctx); if(FAILED(hres)) return hres; -- 2.11.4.GIT