Kaydet (Commit) 0766db04 authored tarafından Arnaud Versini's avatar Arnaud Versini Kaydeden (comit) Arnaud Versini

BASIC: Don't use SbiStringPool to pass SbiParser.

Change-Id: I15949e604285d804de1554d36acf36e8a407ebd9
Reviewed-on: https://gerrit.libreoffice.org/16137Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarArnaud Versini <arnaud.versini@libreoffice.org>
üst 2181f936
...@@ -111,11 +111,9 @@ static const SbiStatement StmntTable [] = { ...@@ -111,11 +111,9 @@ static const SbiStatement StmntTable [] = {
SbiParser::SbiParser( StarBASIC* pb, SbModule* pm ) SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
: SbiTokenizer( pm->GetSource32(), pb ), : SbiTokenizer( pm->GetSource32(), pb ),
aGblStrings( this ), aGlobals( aGblStrings, SbGLOBAL, this ),
aLclStrings( this ), aPublics( aGblStrings, SbPUBLIC, this ),
aGlobals( aGblStrings, SbGLOBAL ), aRtlSyms( aGblStrings, SbRTL, this ),
aPublics( aGblStrings, SbPUBLIC ),
aRtlSyms( aGblStrings, SbRTL ),
aGen( *pm, this, 1024 ) aGen( *pm, this, 1024 )
{ {
pBasic = pb; pBasic = pb;
......
...@@ -38,10 +38,8 @@ ...@@ -38,10 +38,8 @@
|* |*
***************************************************************************/ ***************************************************************************/
SbiStringPool::SbiStringPool( SbiParser* p ) SbiStringPool::SbiStringPool( )
{ {}
pParser = p;
}
SbiStringPool::~SbiStringPool() SbiStringPool::~SbiStringPool()
{} {}
...@@ -89,9 +87,8 @@ short SbiStringPool::Add( double n, SbxDataType t ) ...@@ -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; eScope = s;
pParent = NULL; pParent = NULL;
nCur = nCur =
...@@ -375,7 +372,7 @@ SbiSymPool& SbiSymDef::GetPool() ...@@ -375,7 +372,7 @@ SbiSymPool& SbiSymDef::GetPool()
{ {
if( !pPool ) if( !pPool )
{ {
pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL ); // is dumped pPool = new SbiSymPool( pIn->pParser->aGblStrings, SbLOCAL, pIn->pParser ); // is dumped
} }
return *pPool; return *pPool;
} }
...@@ -396,12 +393,12 @@ SbiSymScope SbiSymDef::GetScope() const ...@@ -396,12 +393,12 @@ SbiSymScope SbiSymDef::GetScope() const
SbiProcDef::SbiProcDef( SbiParser* pParser, const OUString& rName, SbiProcDef::SbiProcDef( SbiParser* pParser, const OUString& rName,
bool bProcDecl ) bool bProcDecl )
: SbiSymDef( rName ) : SbiSymDef( rName )
, aParams( pParser->aGblStrings, SbPARAM ) // is dumped , aParams( pParser->aGblStrings, SbPARAM, pParser ) // is dumped
, aLabels( pParser->aLclStrings, SbLOCAL ) // is not dumped , aLabels( pParser->aLclStrings, SbLOCAL, pParser ) // is not dumped
, mbProcDecl( bProcDecl ) , mbProcDecl( bProcDecl )
{ {
aParams.SetParent( &pParser->aPublics ); aParams.SetParent( &pParser->aPublics );
pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL, pParser );
pPool->SetParent( &aParams ); pPool->SetParent( &aParams );
nLine1 = nLine1 =
nLine2 = 0; nLine2 = 0;
......
...@@ -37,9 +37,8 @@ enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL }; ...@@ -37,9 +37,8 @@ enum SbiSymScope { SbLOCAL, SbPARAM, SbPUBLIC, SbGLOBAL, SbRTL };
class SbiStringPool { class SbiStringPool {
const OUString aEmpty; const OUString aEmpty;
std::vector<OUString> aData; std::vector<OUString> aData;
SbiParser* pParser;
public: public:
SbiStringPool( SbiParser* ); SbiStringPool();
~SbiStringPool(); ~SbiStringPool();
sal_uInt32 GetSize() const { return aData.size(); } sal_uInt32 GetSize() const { return aData.size(); }
// From 8.4.1999: default changed to true because of #64236 - // From 8.4.1999: default changed to true because of #64236 -
...@@ -47,7 +46,6 @@ public: ...@@ -47,7 +46,6 @@ public:
short Add( const OUString&, bool=true ); short Add( const OUString&, bool=true );
short Add( double, SbxDataType ); short Add( double, SbxDataType );
const OUString& Find( sal_uInt32 ) const; const OUString& Find( sal_uInt32 ) const;
SbiParser* GetParser() { return pParser; }
}; };
...@@ -65,7 +63,7 @@ protected: ...@@ -65,7 +63,7 @@ protected:
sal_uInt16 nProcId; // for STATIC-variable sal_uInt16 nProcId; // for STATIC-variable
sal_uInt16 nCur; // iterator sal_uInt16 nCur; // iterator
public: public:
SbiSymPool( SbiStringPool&, SbiSymScope ); SbiSymPool( SbiStringPool&, SbiSymScope, SbiParser* pParser_ );
~SbiSymPool(); ~SbiSymPool();
void SetParent( SbiSymPool* p ) { pParent = p; } void SetParent( SbiSymPool* p ) { pParent = p; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment