diff options
-rw-r--r-- | basic/source/comp/exprgen.cxx | 40 | ||||
-rw-r--r-- | basic/source/comp/exprnode.cxx | 143 | ||||
-rw-r--r-- | basic/source/comp/exprtree.cxx | 58 | ||||
-rw-r--r-- | basic/source/inc/expr.hxx | 29 |
4 files changed, 129 insertions, 141 deletions
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 22e59bb2424f..df469239005b 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -56,7 +56,7 @@ static const OpTable aOpTable [] = { { NIL, _NOP }}; // Output of an element -void SbiExprNode::Gen( RecursiveMode eRecMode ) +void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) { sal_uInt16 nStringId; @@ -65,18 +65,18 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) switch( GetType() ) { case SbxEMPTY: - pGen->Gen( _EMPTY ); + rGen.Gen( _EMPTY ); break; case SbxINTEGER: - pGen->Gen( _CONST, (short) nVal ); + rGen.Gen( _CONST, (short) nVal ); break; case SbxSTRING: - nStringId = pGen->GetParser()->aGblStrings.Add( aStrVal, true ); - pGen->Gen( _SCONST, nStringId ); + nStringId = rGen.GetParser()->aGblStrings.Add( aStrVal, true ); + rGen.Gen( _SCONST, nStringId ); break; default: - nStringId = pGen->GetParser()->aGblStrings.Add( nVal, eType ); - pGen->Gen( _NUMBER, nStringId ); + nStringId = rGen.GetParser()->aGblStrings.Add( nVal, eType ); + rGen.Gen( _NUMBER, nStringId ); break; } } @@ -122,7 +122,7 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) { SbiProcDef* pProc = aVar.pDef->GetProcDef(); - if ( pGen->GetParser()->bClassModule ) + if ( rGen.GetParser()->bClassModule ) { eOp = _FIND_CM; } @@ -135,33 +135,33 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) { if( p == this && pWithParent_ != NULL ) { - pWithParent_->Gen(); + pWithParent_->Gen(rGen); } - p->GenElement( eOp ); + p->GenElement( rGen, eOp ); eOp = _ELEM; } } else if( IsTypeOf() ) { - pLeft->Gen(); - pGen->Gen( _TESTCLASS, nTypeStrId ); + pLeft->Gen(rGen); + rGen.Gen( _TESTCLASS, nTypeStrId ); } else if( IsNew() ) { - pGen->Gen( _CREATE, 0, nTypeStrId ); + rGen.Gen( _CREATE, 0, nTypeStrId ); } else { - pLeft->Gen(); + pLeft->Gen(rGen); if( pRight ) { - pRight->Gen(); + pRight->Gen(rGen); } for( const OpTable* p = aOpTable; p->eTok != NIL; p++ ) { if( p->eTok == eTok ) { - pGen->Gen( p->eOp ); break; + rGen.Gen( p->eOp ); break; } } } @@ -169,7 +169,7 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) // Output of an operand element -void SbiExprNode::GenElement( SbiOpcode eOp ) +void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) { #ifdef DBG_UTIL if ((eOp < _RTL || eOp > _CALLC) && eOp != _FIND_G && eOp != _FIND_CM && eOp != _FIND_STATIC) @@ -187,7 +187,7 @@ void SbiExprNode::GenElement( SbiOpcode eOp ) aVar.pPar->Gen(); } - pGen->Gen( eOp, nId, sal::static_int_cast< sal_uInt16 >( GetType() ) ); + rGen.Gen( eOp, nId, sal::static_int_cast< sal_uInt16 >( GetType() ) ); if( aVar.pvMorePar ) { @@ -197,7 +197,7 @@ void SbiExprNode::GenElement( SbiOpcode eOp ) { SbiExprList* pExprList = *it; pExprList->Gen(); - pGen->Gen( _ARRAYACCESS ); + rGen.Gen( _ARRAYACCESS ); } } } @@ -260,7 +260,7 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) { // special treatment for WITH // If pExpr == .-term in With, approximately Gen for Basis-Object - pExpr->Gen( eRecMode ); + pExpr->Gen( pParser->aGen, eRecMode ); if( bByVal ) { pParser->aGen.Gen( _BYVAL ); diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx index 2ddbc3383338..fecf64263875 100644 --- a/basic/source/comp/exprnode.cxx +++ b/basic/source/comp/exprnode.cxx @@ -26,54 +26,44 @@ #include "expr.hxx" -SbiExprNode::SbiExprNode() +SbiExprNode::SbiExprNode( SbiExprNode* l, SbiToken t, SbiExprNode* r ) : + pLeft(l), + pRight(r), + pWithParent(NULL), + eNodeType(SbxNODE), + eType(SbxVARIANT), // Nodes are always Variant + eTok(t), + bError(false) { - pLeft = NULL; - pRight = NULL; - pWithParent = NULL; - pGen = NULL; - eNodeType = SbxDUMMY; - eType = SbxVARIANT; - eTok = NIL; - bError = false; } -SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode* r ) +SbiExprNode::SbiExprNode( double n, SbxDataType t ): + nVal(n), + pWithParent(NULL), + eNodeType(SbxNUMVAL), + eType(t), + eTok(NIL), + bError(false) { - BaseInit( p ); - - pLeft = l; - pRight = r; - eTok = t; - nVal = 0; - eType = SbxVARIANT; // Nodes are always Variant - eNodeType = SbxNODE; } -SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t ) +SbiExprNode::SbiExprNode( const OUString& rVal ): + aStrVal(rVal), + pWithParent(NULL), + eNodeType(SbxSTRVAL), + eType(SbxSTRING), + eTok(NIL), + bError(false) { - BaseInit( p ); - - eType = t; - eNodeType = SbxNUMVAL; - nVal = n; -} - -SbiExprNode::SbiExprNode( SbiParser* p, const OUString& rVal ) -{ - BaseInit( p ); - - eType = SbxSTRING; - eNodeType = SbxSTRVAL; - aStrVal = rVal; } -SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiExprList* l ) +SbiExprNode::SbiExprNode( const SbiSymDef& r, SbxDataType t, SbiExprList* l ) : + pWithParent(NULL), + eNodeType(SbxVARVAL), + eTok(NIL), + bError(false) { - BaseInit( p ); - eType = ( t == SbxVARIANT ) ? r.GetType() : t; - eNodeType = SbxVARVAL; aVar.pDef = const_cast<SbiSymDef*>(&r); aVar.pPar = l; aVar.pvMorePar = NULL; @@ -81,41 +71,39 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx } // #120061 TypeOf -SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, sal_uInt16 nId ) +SbiExprNode::SbiExprNode( SbiExprNode* l, sal_uInt16 nId ) : + nTypeStrId(nId), + pLeft(l), + pWithParent(NULL), + eNodeType(SbxTYPEOF), + eType(SbxBOOL), + eTok(NIL), + bError(false) { - BaseInit( p ); - - pLeft = l; - eType = SbxBOOL; - eNodeType = SbxTYPEOF; - nTypeStrId = nId; } // new <type> -SbiExprNode::SbiExprNode( SbiParser* p, sal_uInt16 nId ) +SbiExprNode::SbiExprNode( sal_uInt16 nId ) : + nTypeStrId(nId), + pWithParent(NULL), + eNodeType(SbxNEW), + eType(SbxOBJECT), + eTok(NIL), + bError(false) { - BaseInit( p ); - - eType = SbxOBJECT; - eNodeType = SbxNEW; - nTypeStrId = nId; } -// From 1995-12-17, auxiliary function for Ctor for the uniform initialisation -void SbiExprNode::BaseInit( SbiParser* p ) +SbiExprNode::SbiExprNode() : + pWithParent(NULL), + eNodeType(SbxDUMMY), + eType(SbxVARIANT), + eTok(NIL), + bError(false) { - pGen = &p->aGen; - eTok = NIL; - pLeft = NULL; - pRight = NULL; - pWithParent = NULL; - bError = false; } SbiExprNode::~SbiExprNode() { - delete pLeft; - delete pRight; if( IsVariable() ) { delete aVar.pPar; @@ -217,9 +205,9 @@ short SbiExprNode::GetDepth() // 3. Conversion of the operans into Strings // 4. Lifting of the composite- and error-bits -void SbiExprNode::Optimize() +void SbiExprNode::Optimize(SbiParser* pParser) { - FoldConstants(); + FoldConstants(pParser); CollectBits(); } @@ -241,14 +229,14 @@ void SbiExprNode::CollectBits() // If a twig can be converted, True will be returned. In this case // the result is in the left twig. -void SbiExprNode::FoldConstants() +void SbiExprNode::FoldConstants(SbiParser* pParser) { if( IsOperand() || eTok == LIKE ) return; if( pLeft ) - pLeft->FoldConstants(); + pLeft->FoldConstants(pParser); if (pLeft && pRight) { - pRight->FoldConstants(); + pRight->FoldConstants(pParser); if( pLeft->IsConstant() && pRight->IsConstant() && pLeft->eNodeType == pRight->eNodeType ) { @@ -263,8 +251,8 @@ void SbiExprNode::FoldConstants() { OUString rl( pLeft->GetString() ); OUString rr( pRight->GetString() ); - delete pLeft; pLeft = NULL; - delete pRight; pRight = NULL; + pLeft.reset(); + pRight.reset(); if( eTok == PLUS || eTok == CAT ) { eTok = CAT; @@ -300,7 +288,7 @@ void SbiExprNode::FoldConstants() nVal = ( eRes >= 0 ) ? SbxTRUE : SbxFALSE; break; default: - pGen->GetParser()->Error( SbERR_CONVERSION ); + pParser->Error( SbERR_CONVERSION ); bError = true; break; } @@ -326,14 +314,14 @@ void SbiExprNode::FoldConstants() lrMod = static_cast<long>(nr); if( err ) { - pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); + pParser->Error( SbERR_MATH_OVERFLOW ); bError = true; } } bool bBothInt = ( pLeft->eType < SbxSINGLE && pRight->eType < SbxSINGLE ); - delete pLeft; pLeft = NULL; - delete pRight; pRight = NULL; + pLeft.reset(); + pRight.reset(); nVal = 0; eType = SbxDOUBLE; eNodeType = SbxNUMVAL; @@ -348,7 +336,7 @@ void SbiExprNode::FoldConstants() case DIV: if( !nr ) { - pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + pParser->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; bError = true; } else nVal = nl / nr; break; @@ -379,14 +367,14 @@ void SbiExprNode::FoldConstants() case IDIV: if( !lr ) { - pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + pParser->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; bError = true; } else nVal = ll / lr; eType = SbxLONG; break; case MOD: if( !lr ) { - pGen->GetParser()->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; + pParser->Error( SbERR_ZERODIV ); nVal = HUGE_VAL; bError = true; } else nVal = llMod - lrMod * (llMod/lrMod); eType = SbxLONG; break; @@ -404,7 +392,7 @@ void SbiExprNode::FoldConstants() } if( !::rtl::math::isFinite( nVal ) ) - pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); + pParser->Error( SbERR_MATH_OVERFLOW ); // Recover the data type to kill rounding error if( bCheckType && bBothInt @@ -422,8 +410,7 @@ void SbiExprNode::FoldConstants() else if (pLeft && pLeft->IsNumber()) { nVal = pLeft->nVal; - delete pLeft; - pLeft = NULL; + pLeft.reset(); eType = SbxDOUBLE; eNodeType = SbxNUMVAL; switch( eTok ) @@ -437,7 +424,7 @@ void SbiExprNode::FoldConstants() else if( nVal < SbxMINLNG ) err = true, nVal = SbxMINLNG; if( err ) { - pGen->GetParser()->Error( SbERR_MATH_OVERFLOW ); + pParser->Error( SbERR_MATH_OVERFLOW ); bError = true; } nVal = (double) ~((long) nVal); diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 5dbad2a82b6b..f5483f6d5fda 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -40,7 +40,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean(); if( t != SbSYMBOL ) { - pExpr->Optimize(); + pExpr->Optimize(pParser); } if( t == SbLVALUE && !pExpr->IsLvalue() ) { @@ -60,8 +60,8 @@ SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t ) eCurExpr = SbOPERAND; m_eMode = EXPRMODE_STANDARD; pNext = NULL; - pExpr = new SbiExprNode( pParser, n, t ); - pExpr->Optimize(); + pExpr = new SbiExprNode( n, t ); + pExpr->Optimize(pParser); } SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPar ) @@ -72,7 +72,7 @@ SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPa eCurExpr = SbOPERAND; m_eMode = EXPRMODE_STANDARD; pNext = NULL; - pExpr = new SbiExprNode( pParser, r, SbxVARIANT, pPar ); + pExpr = new SbiExprNode( r, SbxVARIANT, pPar ); } SbiExpression::~SbiExpression() @@ -192,7 +192,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) if( !pNd ) { pParser->Error( SbERR_UNEXPECTED, DOT ); - pNd = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); + pNd = new SbiExprNode( 1.0, SbxDOUBLE ); } return pNd; } @@ -212,7 +212,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) if( eNextTok == ASSIGN ) { pParser->UnlockColumn(); - return new SbiExprNode( pParser, aSym ); + return new SbiExprNode( aSym ); } // no keywords allowed from here on! if( SbiTokenizer::IsKwd( eTok ) ) @@ -311,11 +311,11 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) delete pvMoreParLcl; if( pConst->GetType() == SbxSTRING ) { - return new SbiExprNode( pParser, pConst->GetString() ); + return new SbiExprNode( pConst->GetString() ); } else { - return new SbiExprNode( pParser, pConst->GetValue(), pConst->GetType() ); + return new SbiExprNode( pConst->GetValue(), pConst->GetType() ); } } @@ -366,7 +366,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) } } } - SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType ); + SbiExprNode* pNd = new SbiExprNode( *pDef, eType ); if( !pPar ) { pPar = new SbiParameters( pParser,false,false ); @@ -473,7 +473,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj ) pDef->SetType( eType ); } - SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType ); + SbiExprNode* pNd = new SbiExprNode( *pDef, eType ); pNd->aVar.pPar = pPar; pNd->aVar.pvMorePar = pvMoreParLcl; if( bObj ) @@ -518,18 +518,18 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf ) if( !bUsedForTypeOf && pParser->IsVBASupportOn() && pParser->Peek() == IS ) { eTok = pParser->Next(); - pRes = new SbiExprNode( pParser, pRes, eTok, Like() ); + pRes = new SbiExprNode( pRes, eTok, Like() ); } break; case DOT: // .with pRes = Term(); break; case NUMBER: pParser->Next(); - pRes = new SbiExprNode( pParser, pParser->GetDbl(), pParser->GetType() ); + pRes = new SbiExprNode( pParser->GetDbl(), pParser->GetType() ); break; case FIXSTRING: pParser->Next(); - pRes = new SbiExprNode( pParser, pParser->GetSym() ); break; + pRes = new SbiExprNode( pParser->GetSym() ); break; case LPAREN: pParser->Next(); if( nParenLevel == 0 && m_eMode == EXPRMODE_LPAREN_PENDING && pParser->Peek() == RPAREN ) @@ -580,7 +580,7 @@ SbiExprNode* SbiExpression::Operand( bool bUsedForTypeOf ) else { pParser->Next(); - pRes = new SbiExprNode( pParser, 1.0, SbxDOUBLE ); + pRes = new SbiExprNode( 1.0, SbxDOUBLE ); pParser->Error( SbERR_UNEXPECTED, eTok ); } break; @@ -597,7 +597,7 @@ SbiExprNode* SbiExpression::Unary() case MINUS: eTok = NEG; pParser->Next(); - pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); + pNd = new SbiExprNode( Unary(), eTok, NULL ); break; case NOT: if( pParser->IsVBASupportOn() ) @@ -607,7 +607,7 @@ SbiExprNode* SbiExpression::Unary() else { pParser->Next(); - pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); + pNd = new SbiExprNode( Unary(), eTok, NULL ); } break; case PLUS: @@ -623,7 +623,7 @@ SbiExprNode* SbiExpression::Unary() OUString aDummy; SbiSymDef* pTypeDef = new SbiSymDef( aDummy ); pParser->TypeDecl( *pTypeDef, true ); - pNd = new SbiExprNode( pParser, pObjNode, pTypeDef->GetTypeId() ); + pNd = new SbiExprNode( pObjNode, pTypeDef->GetTypeId() ); break; } case NEW: @@ -632,7 +632,7 @@ SbiExprNode* SbiExpression::Unary() OUString aStr; SbiSymDef* pTypeDef = new SbiSymDef( aStr ); pParser->TypeDecl( *pTypeDef, true ); - pNd = new SbiExprNode( pParser, pTypeDef->GetTypeId() ); + pNd = new SbiExprNode( pTypeDef->GetTypeId() ); break; } default: @@ -649,7 +649,7 @@ SbiExprNode* SbiExpression::Exp() while( pParser->Peek() == EXPON ) { SbiToken eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Unary() ); + pNd = new SbiExprNode( pNd, eTok, Unary() ); } } return pNd; @@ -668,7 +668,7 @@ SbiExprNode* SbiExpression::MulDiv() break; } eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Exp() ); + pNd = new SbiExprNode( pNd, eTok, Exp() ); } } return pNd; @@ -682,7 +682,7 @@ SbiExprNode* SbiExpression::IntDiv() while( pParser->Peek() == IDIV ) { SbiToken eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, MulDiv() ); + pNd = new SbiExprNode( pNd, eTok, MulDiv() ); } } return pNd; @@ -696,7 +696,7 @@ SbiExprNode* SbiExpression::Mod() while( pParser->Peek() == MOD ) { SbiToken eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, IntDiv() ); + pNd = new SbiExprNode( pNd, eTok, IntDiv() ); } } return pNd; @@ -715,7 +715,7 @@ SbiExprNode* SbiExpression::AddSub() break; } eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Mod() ); + pNd = new SbiExprNode( pNd, eTok, Mod() ); } } return pNd; @@ -734,7 +734,7 @@ SbiExprNode* SbiExpression::Cat() break; } eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, AddSub() ); + pNd = new SbiExprNode( pNd, eTok, AddSub() ); } } return pNd; @@ -759,7 +759,7 @@ SbiExprNode* SbiExpression::Comp() break; } eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Cat() ); + pNd = new SbiExprNode( pNd, eTok, Cat() ); nCount++; } } @@ -775,7 +775,7 @@ SbiExprNode* SbiExpression::VBA_Not() if( eTok == NOT ) { pParser->Next(); - pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL ); + pNd = new SbiExprNode( VBA_Not(), eTok, NULL ); } else { @@ -793,7 +793,7 @@ SbiExprNode* SbiExpression::Like() while( pParser->Peek() == LIKE ) { SbiToken eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++; + pNd = new SbiExprNode( pNd, eTok, Comp() ), nCount++; } // multiple operands in a row does not work if( nCount > 1 && !pParser->IsVBASupportOn() ) @@ -820,7 +820,7 @@ SbiExprNode* SbiExpression::Boolean() break; } eTok = pParser->Next(); - pNd = new SbiExprNode( pParser, pNd, eTok, Like() ); + pNd = new SbiExprNode( pNd, eTok, Like() ); } } return pNd; @@ -871,7 +871,7 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p ) if( bIsBool ) { delete pExpr; - pExpr = new SbiExprNode( pParser, (bBoolVal ? SbxTRUE : SbxFALSE), SbxINTEGER ); + pExpr = new SbiExprNode( (bBoolVal ? SbxTRUE : SbxFALSE), SbxINTEGER ); eType = pExpr->GetType(); nVal = pExpr->nVal; } diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 4994df661875..d5fdfd5b99ca 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_BASIC_SOURCE_INC_EXPR_HXX #define INCLUDED_BASIC_SOURCE_INC_EXPR_HXX +#include <memory> + #include "opcodes.hxx" #include "token.hxx" @@ -95,15 +97,14 @@ class SbiExprNode { // operators (and operands) SbVar aVar; // or variable }; OUString aStrVal; // #i59791/#i45570 Store string directly - SbiExprNode* pLeft; // right branch - SbiExprNode* pRight; // right branch (NULL for unary ops) + std::unique_ptr<SbiExprNode> pLeft; // left branch + std::unique_ptr<SbiExprNode> pRight; // right branch (NULL for unary ops) SbiExprNode* pWithParent; // node, whose member is "this per with" - SbiCodeGen* pGen; // code-generator SbiNodeType eNodeType; SbxDataType eType; SbiToken eTok; bool bError; // true: error - void FoldConstants(); + void FoldConstants(SbiParser*); void CollectBits(); // converting numbers to strings bool IsOperand() { return eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW; } @@ -113,16 +114,16 @@ class SbiExprNode { // operators (and operands) { return eNodeType == SbxNEW; } bool IsNumber(); bool IsLvalue(); // true, if usable as Lvalue - void GenElement( SbiOpcode ); - void BaseInit( SbiParser* p ); // help function for Ctor, from 17.12.95 + void GenElement( SbiCodeGen&, SbiOpcode ); + public: SbiExprNode(); - SbiExprNode( SbiParser*, double, SbxDataType ); - SbiExprNode( SbiParser*, const OUString& ); - SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); - SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* ); - SbiExprNode( SbiParser*, SbiExprNode*, sal_uInt16 ); // #120061 TypeOf - SbiExprNode( SbiParser*, sal_uInt16 ); // new <type> + SbiExprNode( double, SbxDataType ); + SbiExprNode( const OUString& ); + SbiExprNode( const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); + SbiExprNode( SbiExprNode*, SbiToken, SbiExprNode* ); + SbiExprNode( SbiExprNode*, sal_uInt16 ); // #120061 TypeOf + SbiExprNode( sal_uInt16 ); // new <type> virtual ~SbiExprNode(); bool IsValid() { return !bError; } @@ -146,9 +147,9 @@ public: SbiExprList* GetParameters() { return aVar.pPar; } SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; } - void Optimize(); // tree matching + void Optimize(SbiParser*); // tree matching - void Gen( RecursiveMode eRecMode = UNDEFINED ); // giving out a node + void Gen( SbiCodeGen& rGen, RecursiveMode eRecMode = UNDEFINED ); // giving out a node }; class SbiExpression { |