diff options
author | Noel Power <noel.power@novell.com> | 2013-03-11 11:28:18 +0000 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-03-11 16:20:12 +0000 |
commit | 9fce56c76db085eb8e230183ef8d357ed6f25f08 (patch) | |
tree | f7182a92d8a54b4340459e0b6ddb8517ee7ec467 | |
parent | 2ef7e2fc523b1b7e2fbb129b1abaf220e01dfbeb (diff) |
bnc#805071 fix object assigment problems when default members present
Change-Id: I6f7dfd369a36aff06f15b9a3affadb9d19787a9c
-rw-r--r-- | basic/source/runtime/step0.cxx | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 607d5cbcfbe7..d3a89aff46de 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -398,13 +398,26 @@ void SbiRuntime::StepPUT() // could equate to Range("A1").Value = 34 if ( bVBAEnabled ) { - if ( refVar->GetType() == SbxOBJECT ) + // yet more hacking at this, I feel we don't quite have the correct + // heuristics for dealing with obj1 = obj2 ( where obj2 ( and maybe + // obj1 ) has default member/property ) ) It seems that default props + // aren't dealt with if the object is a member of some parent object + bool bObjAssign = false; + if ( refVar->GetType() == SbxEMPTY ) + refVar->Broadcast( SBX_HINT_DATAWANTED ); + if ( refVar->GetType() == SbxOBJECT ) { - SbxVariable* pDflt = getDefaultProp( refVar ); - if ( pDflt ) - refVar = pDflt; + if ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() ) + { + SbxVariable* pDflt = getDefaultProp( refVar ); + + if ( pDflt ) + refVar = pDflt; + } + else + bObjAssign = true; } - if ( refVal->GetType() == SbxOBJECT ) + if ( refVal->GetType() == SbxOBJECT && !bObjAssign && ( refVal->IsA( TYPE(SbxMethod) ) || ! refVal->GetParent() ) ) { SbxVariable* pDflt = getDefaultProp( refVal ); if ( pDflt ) @@ -532,16 +545,24 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b { // get default properties for lhs & rhs where necessary // SbxVariable* defaultProp = NULL; unused variable - bool bLHSHasDefaultProp = false; // LHS try determine if a default prop exists + // again like in StepPUT (see there too ) we are tweaking the + // heursitics again for when to assign an object reference or + // use default memebers if they exists + // #FIXME we really need to get to the bottom of this mess + bool bObjAssign = false; if ( refVar->GetType() == SbxOBJECT ) { - SbxVariable* pDflt = getDefaultProp( refVar ); - if ( pDflt ) + if ( refVar->IsA( TYPE(SbxMethod) ) || ! refVar->GetParent() ) { - refVar = pDflt; - bLHSHasDefaultProp = true; + SbxVariable* pDflt = getDefaultProp( refVar ); + if ( pDflt ) + { + refVar = pDflt; + } } + else + bObjAssign = true; } // RHS only get a default prop is the rhs has one if ( refVal->GetType() == SbxOBJECT ) @@ -561,7 +582,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b pObj = PTR_CAST(SbxObject,pObjVarObj); } SbxVariable* pDflt = NULL; - if ( pObj || bLHSHasDefaultProp ) + if ( pObj && !bObjAssign ) // lhs is either a valid object || or has a defaultProp pDflt = getDefaultProp( refVal ); if ( pDflt ) |