Jacek Caban : vbscript: Added compiler support for parametrized assignment statements.
Alexandre Julliard
julliard at winehq.org
Tue Dec 27 11:27:56 CST 2011
Module: wine
Branch: master
Commit: edd5ca71b22724eb107a286cd0633e184913be3c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=edd5ca71b22724eb107a286cd0633e184913be3c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Dec 27 16:17:21 2011 +0100
vbscript: Added compiler support for parametrized assignment statements.
---
dlls/vbscript/compile.c | 17 +++++++++--------
dlls/vbscript/interp.c | 24 ++++++++++++++++++++++++
dlls/vbscript/vbscript.h | 8 ++++----
3 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index 9b3f3e6..435f9e3 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -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)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index f036557..cca5eb9 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -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;
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 890c7c7..173b03e 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -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) \
More information about the wine-cvs
mailing list