diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2016-01-24 18:59:33 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-27 15:36:52 +0000 |
commit | 4cac0c05c645fbcc67cf6090144026a2dfd02064 (patch) | |
tree | 4090c91ff1861e7b3cffd40aa60b48b8f631907b | |
parent | 697007006fcad5d0603a53d3a3841bf9136f76dc (diff) |
BASIC: SbiExpression::IsIntConstant has side effects.
Also renames IsIntConstant to ConvertToIntConstIfPossible.
Change-Id: Ib4b465ac0d890762547fb2d83c26ad6be6ee75e8
Reviewed-on: https://gerrit.libreoffice.org/21746
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | basic/source/comp/exprnode.cxx | 4 | ||||
-rw-r--r-- | basic/source/comp/exprtree.cxx | 2 | ||||
-rw-r--r-- | basic/source/inc/expr.hxx | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx index 19272dc3da6a..77c1aa53c209 100644 --- a/basic/source/comp/exprnode.cxx +++ b/basic/source/comp/exprnode.cxx @@ -152,7 +152,7 @@ SbiExprNode* SbiExprNode::GetRealNode() // This method transform the type, if it fits into the Integer range -bool SbiExprNode::IsIntConst() +void SbiExprNode::ConvertToIntConstIfPossible() { if( eNodeType == SbxNUMVAL ) { @@ -163,11 +163,9 @@ bool SbiExprNode::IsIntConst() { nVal = (double) (short) nVal; eType = SbxINTEGER; - return true; } } } - return false; } bool SbiExprNode::IsNumber() diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 634d5a34df53..5a153b332045 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -1158,6 +1158,7 @@ SbiExprList* SbiExprList::ParseDimList( SbiParser* pParser ) { pExpr2 = new SbiExpression( pParser ); eTok = pParser->Next(); + pExpr1->ConvertToIntConstIfPossible(), pExpr2->ConvertToIntConstIfPossible(); pExprList->bError = pExprList->bError || !pExpr1->IsValid() || !pExpr2->IsValid(); pExpr1->pNext = pExpr2; if( !pLast ) @@ -1175,6 +1176,7 @@ SbiExprList* SbiExprList::ParseDimList( SbiParser* pParser ) { pExpr1->SetBased(); pExpr1->pNext = nullptr; + pExpr1->ConvertToIntConstIfPossible(); pExprList->bError = pExprList->bError || !pExpr1->IsValid(); if( !pLast ) { diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 53a96387fb53..eac1c8a75966 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -129,7 +129,7 @@ public: bool IsValid() { return !bError; } bool IsConstant() // true: constant operand { return eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL; } - bool IsIntConst(); + void ConvertToIntConstIfPossible(); bool IsVariable(); bool IsUnary() { return pLeft && !pRight; } @@ -197,7 +197,7 @@ public: bool IsValid() { return pExpr->IsValid(); } bool IsVariable() { return pExpr->IsVariable(); } bool IsLvalue() { return pExpr->IsLvalue(); } - bool IsIntConstant() { return pExpr->IsIntConst(); } + void ConvertToIntConstIfPossible() { pExpr->ConvertToIntConstIfPossible(); } const OUString& GetString() { return pExpr->GetString(); } SbiSymDef* GetRealVar() { return pExpr->GetRealVar(); } SbiExprNode* GetExprNode() { return pExpr; } |