diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-21 22:16:26 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-21 22:16:26 +0000 |
commit | aa2aff78e082f14e4bc418f68b27817f90e3f07a (patch) | |
tree | e646df3a814cb66508350049ec2132635f231f36 /xfa/fxfa/fm2js/cxfa_fmexpression.h | |
parent | 00c1d0b07542611d295dc666ff55d46b0d3f712b (diff) | |
download | pdfium-aa2aff78e082f14e4bc418f68b27817f90e3f07a.tar.xz |
[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 <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmexpression.h')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmexpression.h | 9 |
1 files changed, 6 insertions, 3 deletions
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<CXFA_FMSimpleExpression> pExpression, - std::unique_ptr<CXFA_FMExpression> pIfExpression, - std::unique_ptr<CXFA_FMExpression> pElseExpression); + CXFA_FMIfExpression( + std::unique_ptr<CXFA_FMSimpleExpression> pExpression, + std::unique_ptr<CXFA_FMExpression> pIfExpression, + std::vector<std::unique_ptr<CXFA_FMIfExpression>> pElseIfExpressions, + std::unique_ptr<CXFA_FMExpression> 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<CXFA_FMSimpleExpression> m_pExpression; std::unique_ptr<CXFA_FMExpression> m_pIfExpression; + std::vector<std::unique_ptr<CXFA_FMIfExpression>> m_pElseIfExpressions; std::unique_ptr<CXFA_FMExpression> m_pElseExpression; }; |