vbscript: Added compiler support for parametrized assignment statements.

This commit is contained in:
Jacek Caban 2011-12-27 16:17:21 +01:00 committed by Alexandre Julliard
parent b54f3e711f
commit edd5ca71b2
3 changed files with 37 additions and 12 deletions

View File

@ -687,28 +687,29 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st
static HRESULT compile_assign_statement(compile_ctx_t *ctx, assign_statement_t *stat, BOOL is_set)
{
unsigned args_cnt;
vbsop_t op;
HRESULT hres;
hres = compile_expression(ctx, stat->value_expr);
if(FAILED(hres))
return hres;
if(stat->member_expr->args) {
FIXME("arguments support not implemented\n");
return E_NOTIMPL;
}
if(stat->member_expr->obj_expr) {
hres = compile_expression(ctx, stat->member_expr->obj_expr);
if(FAILED(hres))
return hres;
hres = push_instr_bstr(ctx, is_set ? OP_set_member : OP_assign_member, stat->member_expr->identifier);
op = is_set ? OP_set_member : OP_assign_member;
}else {
hres = push_instr_bstr(ctx, is_set ? OP_set_ident : OP_assign_ident, stat->member_expr->identifier);
op = is_set ? OP_set_ident : OP_assign_ident;
}
return hres;
hres = compile_args(ctx, stat->member_expr->args, &args_cnt);
if(FAILED(hres))
return hres;
return push_instr_bstr_uint(ctx, op, stat->member_expr->identifier, args_cnt);
}
static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name)

View File

@ -562,11 +562,17 @@ static HRESULT assign_ident(exec_ctx_t *ctx, BSTR name, VARIANT *val, BOOL own_v
static HRESULT interp_assign_ident(exec_ctx_t *ctx)
{
const BSTR arg = ctx->instr->arg1.bstr;
const unsigned arg_cnt = ctx->instr->arg2.uint;
variant_val_t v;
HRESULT hres;
TRACE("%s\n", debugstr_w(arg));
if(arg_cnt) {
FIXME("arguments not supported\n");
return E_NOTIMPL;
}
hres = stack_pop_val(ctx, &v);
if(FAILED(hres))
return hres;
@ -577,12 +583,18 @@ static HRESULT interp_assign_ident(exec_ctx_t *ctx)
static HRESULT interp_set_ident(exec_ctx_t *ctx)
{
const BSTR arg = ctx->instr->arg1.bstr;
const unsigned arg_cnt = ctx->instr->arg2.uint;
IDispatch *disp;
VARIANT v;
HRESULT hres;
TRACE("%s\n", debugstr_w(arg));
if(arg_cnt) {
FIXME("arguments not supported\n");
return E_NOTIMPL;
}
hres = stack_pop_disp(ctx, &disp);
if(FAILED(hres))
return hres;
@ -595,6 +607,7 @@ static HRESULT interp_set_ident(exec_ctx_t *ctx)
static HRESULT interp_assign_member(exec_ctx_t *ctx)
{
BSTR identifier = ctx->instr->arg1.bstr;
const unsigned arg_cnt = ctx->instr->arg2.uint;
variant_val_t val;
IDispatch *obj;
DISPID id;
@ -602,6 +615,11 @@ static HRESULT interp_assign_member(exec_ctx_t *ctx)
TRACE("%s\n", debugstr_w(identifier));
if(arg_cnt) {
FIXME("arguments not supported\n");
return E_NOTIMPL;
}
hres = stack_pop_disp(ctx, &obj);
if(FAILED(hres))
return hres;
@ -629,12 +647,18 @@ static HRESULT interp_assign_member(exec_ctx_t *ctx)
static HRESULT interp_set_member(exec_ctx_t *ctx)
{
BSTR identifier = ctx->instr->arg1.bstr;
const unsigned arg_cnt = ctx->instr->arg2.uint;
IDispatch *obj, *val;
DISPID id;
HRESULT hres;
TRACE("%s\n", debugstr_w(identifier));
if(arg_cnt) {
FIXME("arguments not supported\n");
return E_NOTIMPL;
}
hres = stack_pop_disp(ctx, &obj);
if(FAILED(hres))
return hres;

View File

@ -186,8 +186,8 @@ typedef enum {
#define OP_LIST \
X(add, 1, 0, 0) \
X(and, 1, 0, 0) \
X(assign_ident, 1, ARG_BSTR, 0) \
X(assign_member, 1, ARG_BSTR, 0) \
X(assign_ident, 1, ARG_BSTR, ARG_UINT) \
X(assign_member, 1, ARG_BSTR, ARG_UINT) \
X(bool, 1, ARG_INT, 0) \
X(concat, 1, 0, 0) \
X(const, 1, ARG_BSTR, 0) \
@ -226,8 +226,8 @@ typedef enum {
X(or, 1, 0, 0) \
X(pop, 1, ARG_UINT, 0) \
X(ret, 0, 0, 0) \
X(set_ident, 1, ARG_BSTR, 0) \
X(set_member, 1, ARG_BSTR, 0) \
X(set_ident, 1, ARG_BSTR, ARG_UINT) \
X(set_member, 1, ARG_BSTR, ARG_UINT) \
X(short, 1, ARG_INT, 0) \
X(step, 0, ARG_ADDR, ARG_BSTR) \
X(stop, 1, 0, 0) \