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

Arnaud Versini (via logerrit) logerrit at kemper.freedesktop.org
Sat Dec 26 18:23:40 UTC 2020


 basic/source/comp/exprtree.cxx |   30 ++++++++++++------------------
 basic/source/inc/expr.hxx      |   10 +++++-----
 2 files changed, 17 insertions(+), 23 deletions(-)

New commits:
commit a5c1a64555ed0aebc2610ae874bff4713be366a7
Author:     Arnaud Versini <arnaud.versini at libreoffice.org>
AuthorDate: Sat Dec 26 13:21:57 2020 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Dec 26 19:23:00 2020 +0100

    BASIC : simplify SbiExpression initialization
    
    Change-Id: I3a1cca2f6ea3b6d3fef2e10e2ae4d0674cfe205a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108324
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 38b9adeb9800..a18a740447ec 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -26,13 +26,11 @@
 #include <expr.hxx>
 
 SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
-    SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo )
+    SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo ) :
+    pParser(p),
+    eCurExpr(t),
+    m_eMode(eMode)
 {
-    pParser = p;
-    bBased = bError = bByVal = bBracket = false;
-    nParenLevel = 0;
-    eCurExpr = t;
-    m_eMode = eMode;
     pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
     if( t != SbSYMBOL )
     {
@@ -48,24 +46,20 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
     }
 }
 
-SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t )
+SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t ) :
+    pParser(p),
+    eCurExpr(SbOPERAND),
+    m_eMode(EXPRMODE_STANDARD)
 {
-    pParser = p;
-    bBased = bError = bByVal = bBracket = false;
-    nParenLevel = 0;
-    eCurExpr = SbOPERAND;
-    m_eMode = EXPRMODE_STANDARD;
     pExpr = std::make_unique<SbiExprNode>( n, t );
     pExpr->Optimize(pParser);
 }
 
-SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprListPtr pPar )
+SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprListPtr pPar ) :
+    pParser(p),
+    eCurExpr(SbOPERAND),
+    m_eMode(EXPRMODE_STANDARD)
 {
-    pParser = p;
-    bBased = bError = bByVal = bBracket = false;
-    nParenLevel = 0;
-    eCurExpr = SbOPERAND;
-    m_eMode = EXPRMODE_STANDARD;
     pExpr = std::make_unique<SbiExprNode>( r, SbxVARIANT, std::move(pPar) );
 }
 
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index b0656717e399..93f344e89fac 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -152,11 +152,11 @@ protected:
     std::unique_ptr<SbiExprNode>   pExpr; // expression tree
     SbiExprType   eCurExpr;         // type of expression
     SbiExprMode   m_eMode;          // expression context
-    bool          bBased;           // true: easy DIM-part (+BASE)
-    bool          bError;
-    bool          bByVal;           // true: ByVal-Parameter
-    bool          bBracket;         // true: Parameter list with brackets
-    sal_uInt16        nParenLevel;
+    bool          bBased = false;   // true: easy DIM-part (+BASE)
+    bool          bError = false;
+    bool          bByVal = false;   // true: ByVal-Parameter
+    bool          bBracket = false; // true: Parameter list with brackets
+    sal_uInt16        nParenLevel = 0;
     std::unique_ptr<SbiExprNode> Term( const KeywordSymbolInfo* pKeywordSymbolInfo = nullptr );
     std::unique_ptr<SbiExprNode> ObjTerm( SbiSymDef& );
     std::unique_ptr<SbiExprNode> Operand( bool bUsedForTypeOf = false );


More information about the Libreoffice-commits mailing list