[Libreoffice-commits] core.git: basic/source

Caolán McNamara caolanm at redhat.com
Sat Sep 26 04:49:39 PDT 2015


 basic/source/comp/parser.cxx |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 365b13e1528683f24adc05cf94304f0bd3fd5505
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Sep 26 11:30:54 2015 +0100

    pVar != null, so static_cast(pVar) != null
    
    Change-Id: Id22808858b5884b2f87064b389eb411e0712bab4
    Reviewed-on: https://gerrit.libreoffice.org/18881
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 2406e1c..97592cb 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -150,32 +150,30 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
 }
 
 // part of the runtime-library?
-SbiSymDef* SbiParser::CheckRTLForSym( const OUString& rSym, SbxDataType eType )
+SbiSymDef* SbiParser::CheckRTLForSym(const OUString& rSym, SbxDataType eType)
 {
-    SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE );
-    SbiSymDef* pDef = NULL;
-    if( pVar )
+    SbxVariable* pVar = GetBasic()->GetRtl()->Find(rSym, SbxCLASS_DONTCARE);
+    if (!pVar)
+        return nullptr;
+
+    if (pVar->IsA(TYPE(SbxMethod)))
     {
-        if( pVar->IsA( TYPE(SbxMethod) ) )
+        SbiProcDef* pProc_ = aRtlSyms.AddProc( rSym );
+        SbxMethod* pMethod = static_cast<SbxMethod*>(pVar);
+        if (pMethod->IsRuntimeFunction())
         {
-            SbiProcDef* pProc_ = aRtlSyms.AddProc( rSym );
-            SbxMethod* pMethod = static_cast<SbxMethod*>(pVar);
-            if ( pMethod && pMethod->IsRuntimeFunction() )
-            {
-                pProc_->SetType( pMethod->GetRuntimeFunctionReturnType() );
-            }
-            else
-            {
-                pProc_->SetType( pVar->GetType() );
-            }
-            pDef = pProc_;
+            pProc_->SetType( pMethod->GetRuntimeFunctionReturnType() );
         }
         else
         {
-            pDef = aRtlSyms.AddSym( rSym );
-            pDef->SetType( eType );
+            pProc_->SetType( pVar->GetType() );
         }
+        return pProc_;
     }
+
+
+    SbiSymDef* pDef = aRtlSyms.AddSym(rSym);
+    pDef->SetType(eType);
     return pDef;
 }
 


More information about the Libreoffice-commits mailing list