From aa2aff78e082f14e4bc418f68b27817f90e3f07a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 21 Feb 2018 22:16:26 +0000 Subject: [formcalc] Cleanup if expression parsing. This CL simplifies the if expression parsing. The elseif construct has been split into its own list of IfExpressions and no longer gets stuffed into the elseExpression. A loop was added into the output methods for the elseif expressions, which also means we can go from having: if () { } else { if () { } else { } } to if () { } else if () { } else { } Which is a bit nicer. Change-Id: I6edf75215500d6a32a8d7218d477b6960f03de51 Reviewed-on: https://pdfium-review.googlesource.com/27571 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/fm2js/cxfa_fmexpression.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xfa/fxfa/fm2js/cxfa_fmexpression.h') diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h index 88f2d6e4ed..5024432df9 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.h +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h @@ -91,9 +91,11 @@ class CXFA_FMDoExpression : public CXFA_FMExpression { class CXFA_FMIfExpression : public CXFA_FMExpression { public: - CXFA_FMIfExpression(std::unique_ptr pExpression, - std::unique_ptr pIfExpression, - std::unique_ptr pElseExpression); + CXFA_FMIfExpression( + std::unique_ptr pExpression, + std::unique_ptr pIfExpression, + std::vector> pElseIfExpressions, + std::unique_ptr pElseExpression); ~CXFA_FMIfExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -101,6 +103,7 @@ class CXFA_FMIfExpression : public CXFA_FMExpression { private: std::unique_ptr m_pExpression; std::unique_ptr m_pIfExpression; + std::vector> m_pElseIfExpressions; std::unique_ptr m_pElseExpression; }; -- cgit v1.2.3