jscript: Added variable object handling.

This commit is contained in:
Jacek Caban 2008-09-09 01:24:49 +02:00 committed by Alexandre Julliard
parent fc5a8836e9
commit 652a0121a9
3 changed files with 15 additions and 5 deletions

View file

@ -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));

View file

@ -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;

View file

@ -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;