summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-02-12 22:52:05 +0100
committerEike Rathke <erack@redhat.com>2018-02-12 22:52:58 +0100
commita6c659283ab02cb59feda39b67e1837ed8c32730 (patch)
tree2cadd6c981fe252effcdcb6af552abe1f23d1fd7
parentd9fc18d5a797972ba182fbcae941535a50098dcb (diff)
Use FormulaCompiler::IsOpCodeJumpCommand() where applicable
Change-Id: I295e842da0192c21d318357caa574062085acd9d
-rw-r--r--formula/source/core/api/token.cxx10
-rw-r--r--sc/source/core/tool/interpr4.cxx4
2 files changed, 7 insertions, 7 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index cfd759562d59..05ca4cf5e1e9 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -86,7 +86,7 @@ bool FormulaToken::IsFunction() const
eOp != ocTableRef &&
(GetByte() != 0 // x parameters
|| (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR) // no parameter
- || (ocIf == eOp || ocIfError == eOp || ocIfNA == eOp || ocChoose == eOp ) // @ jump commands
+ || FormulaCompiler::IsOpCodeJumpCommand( eOp ) // @ jump commands
|| (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR) // one parameter
|| (SC_OPCODE_START_2_PAR <= eOp && eOp < SC_OPCODE_STOP_2_PAR) // x parameters (cByte==0 in
// FuncAutoPilot)
@@ -101,10 +101,10 @@ bool FormulaToken::IsFunction() const
sal_uInt8 FormulaToken::GetParamCount() const
{
if ( eOp < SC_OPCODE_STOP_DIV && eOp != ocExternal && eOp != ocMacro &&
- eOp != ocIf && eOp != ocIfError && eOp != ocIfNA && eOp != ocChoose &&
+ !FormulaCompiler::IsOpCodeJumpCommand( eOp ) &&
eOp != ocPercentSign )
return 0; // parameters and specials
- // ocIf, ocIfError, ocIfNA and ocChoose not for FAP, have cByte then
+ // ocIf... jump commands not for FAP, have cByte then
//2do: bool parameter whether FAP or not?
else if ( GetByte() )
return GetByte(); // all functions, also ocExternal and ocMacro
@@ -117,7 +117,7 @@ sal_uInt8 FormulaToken::GetParamCount() const
return 0; // no parameter
else if (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR)
return 1; // one parameter
- else if ( eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChoose )
+ else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
return 1; // only the condition counts as parameter
else
return 0; // all the rest, no Parameter, or
@@ -893,7 +893,7 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps()
}
if ( eOp == ocPush || lcl_IsReference( eOp, t->GetType() ) )
pStack[sp++] = t;
- else if ( eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChoose )
+ else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
{ // ignore Jumps, pop previous Result (Condition)
if ( sp )
--sp;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 942911d29ff2..c1cd4f835398 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3987,7 +3987,7 @@ StackVar ScInterpreter::Interpret()
nCurFmtType = SvNumFormatType::UNDEFINED;
}
else if (pTokenMatrixMap &&
- !(eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChoose) &&
+ !FormulaCompiler::IsOpCodeJumpCommand( eOp ) &&
((aTokenMatrixMapIter = pTokenMatrixMap->find( pCur)) !=
pTokenMatrixMap->end()) &&
(*aTokenMatrixMapIter).second->GetType() != svJumpMatrix)
@@ -4008,7 +4008,7 @@ StackVar ScInterpreter::Interpret()
nFuncFmtType = SvNumFormatType::NUMBER;
nFuncFmtIndex = 0;
- if ( eOp == ocIf || eOp == ocChoose || eOp == ocIfError || eOp == ocIfNA )
+ if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
nStackBase = sp; // don't mess around with the jumps
else
{