From: Francis De Brabandere francisdb@gmail.com
--- dlls/vbscript/interp.c | 7 ++++++- dlls/vbscript/tests/lang.vbs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 937cdaf1c8c..37417928774 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -1316,11 +1316,16 @@ static HRESULT interp_redim(exec_ctx_t *ctx) return hres; }
- if(ref.type != REF_VAR) { + if(ref.type != REF_VAR && ref.type != REF_NONE) { FIXME("got ref.type = %d\n", ref.type); return E_FAIL; }
+ if(ref.type == REF_NONE) { + ref.type = REF_VAR; + hres = add_dynamic_var(ctx, identifier, FALSE, &ref.u.v); + } + v = ref.u.v;
if(V_VT(v) == (VT_VARIANT|VT_BYREF)) { diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 3c6ce656f1c..bb7aafc21fa 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1701,6 +1701,13 @@ e = err.number on error goto 0 ok e = 9, "e = " & e ' VBSE_OUT_OF_BOUNDS, can only change rightmost dimension
+' Redim without Dim should work, even in explicit mode +redim toCreateArr(3) +ok ubound(toCreateArr) = 3, "ubound(toCreateArr) = " & ubound(toCreateArr) +toCreateArr(3) = 10 +ok toCreateArr(3) = 10, "toCreateArr(3) = " & toCreateArr(3) + + sub TestReDimFixed on error resume next