summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-05-01 15:16:27 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-05-01 15:29:24 -0400
commit50d100f4acb2e62bac8b01c8071d089c6171843f (patch)
tree5b182e1558d0b1db957c83032c71f6d198fc3efd /formula
parent8d3295bdac2182d58e6ef3a1eeb3313a1ca19c0d (diff)
Make a separate method to detemine if an opcode is a jump command.
Jump to make it a bit more pleasant to follow the code... Change-Id: Ie9bef122e8bb63a2d8cc54acc9c8ddc9ac9a2e8a
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index ce36065c9c86..58a896184be1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -805,6 +805,21 @@ bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
return bRet;
}
+bool FormulaCompiler::IsOpCodeJumpCommand( OpCode eOp )
+{
+ switch (eOp)
+ {
+ case ocIf:
+ case ocIfError:
+ case ocIfNA:
+ case ocChose:
+ return true;
+ default:
+ ;
+ }
+ return false;
+}
+
// Remove quotes, escaped quotes are unescaped.
bool FormulaCompiler::DeQuote( OUString& rStr )
{
@@ -1241,9 +1256,7 @@ void FormulaCompiler::Factor()
|| eOp == ocOr
|| eOp == ocBad
|| ( eOp >= ocInternalBegin && eOp <= ocInternalEnd )
- || ( bCompileForFAP
- && ( eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChose ) )
- )
+ || (bCompileForFAP && IsOpCodeJumpCommand(eOp)))
{
pFacToken = mpToken;
OpCode eMyLastOp = eOp;
@@ -1291,7 +1304,7 @@ void FormulaCompiler::Factor()
pFacToken->SetByte( nSepCount );
PutCode( pFacToken );
}
- else if (eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChose)
+ else if (IsOpCodeJumpCommand(eOp))
{
// the PC counters are -1
pFacToken = mpToken;