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

Arnaud Versini arnaud.versini at gmail.com
Sat Jun 13 04:53:31 PDT 2015


 basic/source/comp/parser.cxx |    8 +++-----
 basic/source/comp/symtbl.cxx |   17 +++++++----------
 basic/source/inc/symtbl.hxx  |    6 ++----
 3 files changed, 12 insertions(+), 19 deletions(-)

New commits:
commit 0766db041e17a7cb1ba2659f88f7e94fec720f67
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Sun Jun 7 17:44:13 2015 +0200

    BASIC: Don't use SbiStringPool to pass SbiParser.
    
    Change-Id: I15949e604285d804de1554d36acf36e8a407ebd9
    Reviewed-on: https://gerrit.libreoffice.org/16137
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Arnaud Versini <arnaud.versini at libreoffice.org>

diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index c257922..d867cb4 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -111,11 +111,9 @@ static const SbiStatement StmntTable [] = {
 
 SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
         : SbiTokenizer( pm->GetSource32(), pb ),
-          aGblStrings( this ),
-          aLclStrings( this ),
-          aGlobals( aGblStrings, SbGLOBAL ),
-          aPublics( aGblStrings, SbPUBLIC ),
-          aRtlSyms( aGblStrings, SbRTL ),
+          aGlobals( aGblStrings, SbGLOBAL, this ),
+          aPublics( aGblStrings, SbPUBLIC, this ),
+          aRtlSyms( aGblStrings, SbRTL, this ),
           aGen( *pm, this, 1024 )
 {
     pBasic   = pb;
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index bc38628..7a79de8 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -38,10 +38,8 @@
 |*
 ***************************************************************************/
 
-SbiStringPool::SbiStringPool( SbiParser* p )
-{
-    pParser = p;
-}
+SbiStringPool::SbiStringPool( )
+{}
 
 SbiStringPool::~SbiStringPool()
 {}
@@ -89,9 +87,8 @@ short SbiStringPool::Add( double n, SbxDataType t )
 |*
 ***************************************************************************/
 
-SbiSymPool::SbiSymPool( SbiStringPool& r, SbiSymScope s ) : rStrings( r )
+SbiSymPool::SbiSymPool( SbiStringPool& r, SbiSymScope s, SbiParser* pP ) : rStrings( r ), pParser( pP )
 {
-    pParser  = r.GetParser();
     eScope   = s;
     pParent  = NULL;
     nCur     =
@@ -375,7 +372,7 @@ SbiSymPool& SbiSymDef::GetPool()
 {
     if( !pPool )
     {
-        pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL );   // is dumped
+        pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL, pIn->pParser );   // is dumped
     }
     return *pPool;
 }
@@ -396,12 +393,12 @@ SbiSymScope SbiSymDef::GetScope() const
 SbiProcDef::SbiProcDef( SbiParser* pParser, const OUString& rName,
                         bool bProcDecl )
          : SbiSymDef( rName )
-         , aParams( pParser->aGblStrings, SbPARAM )  // is dumped
-         , aLabels( pParser->aLclStrings, SbLOCAL )  // is not dumped
+         , aParams( pParser->aGblStrings, SbPARAM, pParser )  // is dumped
+         , aLabels( pParser->aLclStrings, SbLOCAL, pParser )  // is not dumped
          , mbProcDecl( bProcDecl )
 {
     aParams.SetParent( &pParser->aPublics );
-    pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL );
+    pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL, pParser );
     pPool->SetParent( &aParams );
     nLine1  =
     nLine2  = 0;
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 3c67c8d..cc4fac5 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -37,9 +37,8 @@ enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
 class SbiStringPool {
     const OUString aEmpty;
     std::vector<OUString> aData;
-    SbiParser* pParser;
 public:
-    SbiStringPool( SbiParser* );
+    SbiStringPool();
    ~SbiStringPool();
     sal_uInt32 GetSize() const { return aData.size(); }
     // From 8.4.1999: default changed to true because of #64236 -
@@ -47,7 +46,6 @@ public:
     short Add( const OUString&, bool=true );
     short Add( double, SbxDataType );
     const OUString& Find( sal_uInt32 ) const;
-    SbiParser* GetParser() { return pParser; }
 };
 
 
@@ -65,7 +63,7 @@ protected:
     sal_uInt16     nProcId;             // for STATIC-variable
     sal_uInt16     nCur;                // iterator
 public:
-    SbiSymPool( SbiStringPool&, SbiSymScope );
+    SbiSymPool( SbiStringPool&, SbiSymScope, SbiParser* pParser_ );
    ~SbiSymPool();
 
     void   SetParent( SbiSymPool* p )   { pParent = p;      }


More information about the Libreoffice-commits mailing list