From 603d053512c50036869c20df7f2034338efcb3dd Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 16 Sep 2011 13:29:02 +0200 Subject: [PATCH] vbscript: Use default object value for objets in stack_pop_val. --- dlls/vbscript/interp.c | 13 +++++++++++-- dlls/vbscript/tests/lang.vbs | 9 +++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 4599cbf67ba..474957c1b80 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -199,8 +199,17 @@ static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *v) } if(V_VT(var) == VT_DISPATCH) { - FIXME("got dispatch - get its default value\n"); - return E_NOTIMPL; + DISPPARAMS dp = {0}; + HRESULT hres; + + hres = disp_call(ctx->script, V_DISPATCH(var), DISPID_VALUE, &dp, &v->store); + if(v->owned) + IDispatch_Release(V_DISPATCH(var)); + if(FAILED(hres)) + return hres; + + v->owned = TRUE; + v->v = &v->store; }else { v->v = var; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 24bfecc151b..cb0c7eb28cf 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -473,4 +473,13 @@ Call ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp) Set obj.gsProp = New testclass Call ok(funcCalled = "gsProp set", "funcCalled = " & funcCalled) +x = obj +Call ok(x = 3, "(x = obj) = " & x) +Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled) +funcCalled = "" +Call ok(obj = 3, "(x = obj) = " & obj) +Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled) + +x = (New testclass).publicProp + reportSuccess()