summaryrefslogtreecommitdiff
path: root/basic/source/comp
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2016-01-24 18:59:33 +0100
committerMichael Stahl <mstahl@redhat.com>2016-01-27 15:36:52 +0000
commit4cac0c05c645fbcc67cf6090144026a2dfd02064 (patch)
tree4090c91ff1861e7b3cffd40aa60b48b8f631907b /basic/source/comp
parent697007006fcad5d0603a53d3a3841bf9136f76dc (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>
Diffstat (limited to 'basic/source/comp')
-rw-r--r--basic/source/comp/exprnode.cxx4
-rw-r--r--basic/source/comp/exprtree.cxx2
2 files changed, 3 insertions, 3 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 )
{