basic/source/runtime/runtime.cxx | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
New commits: commit 6337bb91cf2f99a94cf030758317e0714bf14222 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Jun 29 11:17:53 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Jun 29 12:25:11 2025 +0200 Simplify a bit Move variable where it's used; flatten one nested if. Change-Id: I2ad6b03923082971317ace4d573c46cbf24efacb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187147 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 8a4946822507..92ebafec70da 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -3942,13 +3942,11 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 ) SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) { assert(pElem); - SbxArray* pPar; if( ( pElem->GetType() & SbxARRAY ) && refRedim.get() != pElem ) { SbxBase* pElemObj = pElem->GetObject(); - SbxDimArray* pDimArray = dynamic_cast<SbxDimArray*>( pElemObj ); - pPar = pElem->GetParameters(); - if( pDimArray ) + SbxArray* pPar = pElem->GetParameters(); + if (SbxDimArray* pDimArray = dynamic_cast<SbxDimArray*>(pElemObj)) { // parameters may be missing, if an array is // passed as an argument @@ -3971,20 +3969,16 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) pElem = pDimArray->Get(pPar); } } - else + else if (SbxArray* pArray = dynamic_cast<SbxArray*>(pElemObj)) { - SbxArray* pArray = dynamic_cast<SbxArray*>( pElemObj ); - if( pArray ) + if( !pPar ) { - if( !pPar ) - { - Error( ERRCODE_BASIC_OUT_OF_RANGE ); - pElem = new SbxVariable; - } - else - { - pElem = pArray->Get(pPar->Get(1)->GetInteger()); - } + Error( ERRCODE_BASIC_OUT_OF_RANGE ); + pElem = new SbxVariable; + } + else + { + pElem = pArray->Get(pPar->Get(1)->GetInteger()); } } @@ -3999,8 +3993,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) dynamic_cast<const SbxMethod*>( pElem) == nullptr && ( !bVBAEnabled || dynamic_cast<const SbxProperty*>( pElem) == nullptr ) ) { - pPar = pElem->GetParameters(); - if ( pPar ) + if (SbxArray* pPar = pElem->GetParameters()) { // is it a uno-object? SbxBaseRef pObj = pElem->GetObject();