Commit 2d419b7d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Always pass arguments inside parentheses by value.

parent 216f7146
......@@ -417,6 +417,9 @@ static HRESULT compile_args(compile_ctx_t *ctx, expression_t *args, unsigned *re
if(FAILED(hres))
return hres;
if(args->type == EXPR_BRACKETS && !push_instr(ctx, OP_deref))
return E_OUTOFMEMORY;
arg_cnt++;
args = args->next;
}
......
......@@ -1028,6 +1028,23 @@ static HRESULT interp_pop(exec_ctx_t *ctx)
return S_OK;
}
static HRESULT interp_deref(exec_ctx_t *ctx)
{
VARIANT copy, *v = stack_top(ctx, 0);
HRESULT hres;
TRACE("%s\n", debugstr_variant(v));
if(V_VT(v) != (VT_BYREF|VT_VARIANT))
return S_OK;
V_VT(&copy) = VT_EMPTY;
hres = VariantCopy(&copy, V_VARIANTREF(v));
if(SUCCEEDED(hres))
*v = copy;
return hres;
}
static HRESULT interp_new(exec_ctx_t *ctx)
{
const WCHAR *arg = ctx->instr->arg1.bstr;
......
......@@ -1277,11 +1277,11 @@ ok x(0) = 2, "x(0) = " & x(0)
x = Array(1)
seta0 (x)
todo_wine_ok x(0) = 1, "x(0) = " & x(0)
ok x(0) = 1, "x(0) = " & x(0)
x = Array(1)
call (((seta0))) ((x))
todo_wine_ok x(0) = 1, "x(0) = " & x(0)
ok x(0) = 1, "x(0) = " & x(0)
x = Array(1)
call (((seta0))) (x)
......@@ -1293,7 +1293,7 @@ call ok(x(0)(0) = 2, "x(0)(0) = " & x(0)(0))
x = Array(Array(3))
seta0 (x(0))
call todo_wine_ok(x(0)(0) = 3, "x(0)(0) = " & x(0)(0))
call ok(x(0)(0) = 3, "x(0)(0) = " & x(0)(0))
y = (seta0)(x)
ok y = 1, "y = " & y
......@@ -1311,7 +1311,7 @@ ok x(0) = 2, "x(0) = " & x(0)
x = Array(1)
changearg (x(0))
todo_wine_ok x(0) = 1, "x(0) = " & x(0)
ok x(0) = 1, "x(0) = " & x(0)
Class ArrClass
Dim classarr(3)
......@@ -1377,7 +1377,7 @@ Call ok(arr(0) = "modified", "arr(0) = " & arr(0))
arr(0) = "not modified"
modifyarr(arr)
Call todo_wine_ok(arr(0) = "not modified", "arr(0) = " & arr(0))
Call ok(arr(0) = "not modified", "arr(0) = " & arr(0))
for x = 0 to UBound(arr)
arr(x) = x
......
......@@ -224,6 +224,7 @@ typedef enum {
X(case, 0, ARG_ADDR, 0) \
X(concat, 1, 0, 0) \
X(const, 1, ARG_BSTR, 0) \
X(deref, 1, 0, 0) \
X(dim, 1, ARG_BSTR, ARG_UINT) \
X(div, 1, 0, 0) \
X(double, 1, ARG_DOUBLE, 0) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment