vbscript: Added object member call implementation.
This commit is contained in:
parent
9848d6be2e
commit
a6ee830fd2
|
@ -318,8 +318,11 @@ static HRESULT compile_member_expression(compile_ctx_t *ctx, member_expression_t
|
|||
return hres;
|
||||
|
||||
if(expr->obj_expr) {
|
||||
FIXME("obj_expr not implemented\n");
|
||||
hres = E_NOTIMPL;
|
||||
hres = compile_expression(ctx, expr->obj_expr);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = push_instr_bstr_uint(ctx, ret_val ? OP_mcall : OP_mcallv, expr->identifier, arg_cnt);
|
||||
}else {
|
||||
hres = push_instr_bstr_uint(ctx, ret_val ? OP_icall : OP_icallv, expr->identifier, arg_cnt);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,57 @@ static HRESULT interp_icallv(exec_ctx_t *ctx)
|
|||
return do_icall(ctx, NULL);
|
||||
}
|
||||
|
||||
static HRESULT do_mcall(exec_ctx_t *ctx, VARIANT *res)
|
||||
{
|
||||
const BSTR identifier = ctx->instr->arg1.bstr;
|
||||
const unsigned arg_cnt = ctx->instr->arg2.uint;
|
||||
IDispatch *obj;
|
||||
DISPPARAMS dp;
|
||||
DISPID id;
|
||||
HRESULT hres;
|
||||
|
||||
hres = stack_pop_disp(ctx, &obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!obj) {
|
||||
FIXME("NULL obj\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
vbstack_to_dp(ctx, arg_cnt, &dp);
|
||||
|
||||
hres = disp_get_id(obj, identifier, &id);
|
||||
if(SUCCEEDED(hres))
|
||||
hres = disp_call(ctx->script, obj, id, &dp, res);
|
||||
IDispatch_Release(obj);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
stack_popn(ctx, arg_cnt);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT interp_mcall(exec_ctx_t *ctx)
|
||||
{
|
||||
VARIANT res;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hres = do_mcall(ctx, &res);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return stack_push(ctx, &res);
|
||||
}
|
||||
|
||||
static HRESULT interp_mcallv(exec_ctx_t *ctx)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, VARIANT *val, BOOL own_val)
|
||||
{
|
||||
ref_t ref;
|
||||
|
|
|
@ -146,6 +146,8 @@ typedef enum {
|
|||
X(jmp, 0, ARG_ADDR, 0) \
|
||||
X(jmp_false, 0, ARG_ADDR, 0) \
|
||||
X(long, 1, ARG_INT, 0) \
|
||||
X(mcall, 1, ARG_BSTR, ARG_UINT) \
|
||||
X(mcallv, 1, ARG_BSTR, ARG_UINT) \
|
||||
X(mod, 1, 0, 0) \
|
||||
X(mul, 1, 0, 0) \
|
||||
X(neg, 1, 0, 0) \
|
||||
|
|
Loading…
Reference in New Issue