diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-10 12:55:47 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-10 14:00:31 +0200 |
commit | 3e67f82fcee0ef43ad8fd9f36e0d618c33d4ee72 (patch) | |
tree | bec80bb155d63d3611e395444a109e5426b7d1bd | |
parent | e52beea63ddd7087c61df5838f9643d68486d71e (diff) |
inherit ReferenceOrForceArray only if nested not Reference, tdf#107724 prep
Change-Id: I14c6a651677fcdcaac943d10f6a0d663bf37aff2
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 60ad7927c327..7a28568ad590 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2552,18 +2552,33 @@ void FormulaCompiler::ForceArrayOperator( FormulaTokenRef& rCurr ) if (!(rCurr->GetOpCode() != ocPush && (rCurr->GetType() == svByte || rCurr->GetType() == svJump))) return; + // Inherited parameter class. formula::ParamClass eType = pCurrentFactorToken->GetInForceArray(); - if (eType == formula::ParamClass::ForceArray || eType == formula::ParamClass::ReferenceOrForceArray) + if (eType == formula::ParamClass::ForceArray) { rCurr->SetInForceArray( eType); return; } + else if (eType == formula::ParamClass::ReferenceOrForceArray) + { + // Inherit further only if the return class of the nested function is + // not Reference. + if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) != ParamClass::Reference) + rCurr->SetInForceArray( eType); + return; + } if (nCurrentFactorParam > 0) { - eType = GetForceArrayParameter( pCurrentFactorToken.get(), static_cast<sal_uInt8>(nCurrentFactorParam - 1)); - if (eType == ParamClass::ForceArray || eType == ParamClass::ReferenceOrForceArray) + // Actual current parameter's class. + eType = GetForceArrayParameter( pCurrentFactorToken.get(), static_cast<sal_uInt16>(nCurrentFactorParam - 1)); + if (eType == ParamClass::ForceArray) rCurr->SetInForceArray( eType); + else if (eType == ParamClass::ReferenceOrForceArray) + { + if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) != ParamClass::Reference) + rCurr->SetInForceArray( eType); + } } } |