diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-20 21:57:59 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-20 21:57:59 +0000 |
commit | 676658cfccf3f8cf820dfa63a7b6e2f9a76c2e18 (patch) | |
tree | 0ce81b0a8d51a6ec8e1dfce2c5119c7fcb73049f /xfa/fxfa | |
parent | 4102f7b86e415b2a254521a1fc52e11bdc932864 (diff) | |
download | pdfium-676658cfccf3f8cf820dfa63a7b6e2f9a76c2e18.tar.xz |
[formcalc] Remove unused line parameter
The recorded line number from the formcalc parse is never used. This Cl
removes the parameter and removes the need to pass it through all of the
constructors.
Change-Id: Ice716cc4880dd17dc05bffcdce1dc1e4745108ea
Reviewed-on: https://pdfium-review.googlesource.com/27412
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmexpression.cpp | 41 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmexpression.h | 31 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmlexer.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmparser.cpp | 160 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp | 80 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h | 68 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp | 19 |
8 files changed, 140 insertions, 265 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp index a9701f12ce..638922cfd5 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp @@ -21,19 +21,16 @@ const wchar_t kMinusEqual[] = L" -= "; } // namespace -CXFA_FMExpression::CXFA_FMExpression(uint32_t line) - : m_type(XFA_FM_EXPTYPE_UNKNOWN), m_line(line) {} +CXFA_FMExpression::CXFA_FMExpression() : m_type(XFA_FM_EXPTYPE_UNKNOWN) {} -CXFA_FMExpression::CXFA_FMExpression(uint32_t line, XFA_FM_EXPTYPE type) - : m_type(type), m_line(line) {} +CXFA_FMExpression::CXFA_FMExpression(XFA_FM_EXPTYPE type) : m_type(type) {} CXFA_FMFunctionDefinition::CXFA_FMFunctionDefinition( - uint32_t line, bool isGlobal, const WideStringView& wsName, std::vector<WideStringView>&& arguments, std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_FUNC), + : CXFA_FMExpression(XFA_FM_EXPTYPE_FUNC), m_wsName(wsName), m_pArguments(std::move(arguments)), m_pExpressions(std::move(expressions)), @@ -104,10 +101,9 @@ bool CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMVarExpression::CXFA_FMVarExpression( - uint32_t line, const WideStringView& wsName, std::unique_ptr<CXFA_FMSimpleExpression> pInit) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR), + : CXFA_FMExpression(XFA_FM_EXPTYPE_VAR), m_wsName(wsName), m_pInit(std::move(pInit)) {} @@ -139,9 +135,8 @@ bool CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMExpExpression::CXFA_FMExpExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExpression) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_EXP), + : CXFA_FMExpression(XFA_FM_EXPTYPE_EXP), m_pExpression(std::move(pExpression)) {} CXFA_FMExpExpression::~CXFA_FMExpExpression() {} @@ -184,9 +179,8 @@ bool CXFA_FMExpExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMBlockExpression::CXFA_FMBlockExpression( - uint32_t line, std::vector<std::unique_ptr<CXFA_FMExpression>>&& pExpressionList) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_BLOCK), + : CXFA_FMExpression(XFA_FM_EXPTYPE_BLOCK), m_ExpressionList(std::move(pExpressionList)) {} CXFA_FMBlockExpression::~CXFA_FMBlockExpression() {} @@ -216,9 +210,8 @@ bool CXFA_FMBlockExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMDoExpression::CXFA_FMDoExpression( - uint32_t line, std::unique_ptr<CXFA_FMExpression> pList) - : CXFA_FMExpression(line), m_pList(std::move(pList)) {} + : CXFA_FMExpression(), m_pList(std::move(pList)) {} CXFA_FMDoExpression::~CXFA_FMDoExpression() {} @@ -231,11 +224,10 @@ bool CXFA_FMDoExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMIfExpression::CXFA_FMIfExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExpression, std::unique_ptr<CXFA_FMExpression> pIfExpression, std::unique_ptr<CXFA_FMExpression> pElseExpression) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_IF), + : CXFA_FMExpression(XFA_FM_EXPTYPE_IF), m_pExpression(std::move(pExpression)), m_pIfExpression(std::move(pIfExpression)), m_pElseExpression(std::move(pElseExpression)) {} @@ -287,10 +279,9 @@ bool CXFA_FMIfExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMWhileExpression::CXFA_FMWhileExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pCondition, std::unique_ptr<CXFA_FMExpression> pExpression) - : CXFA_FMExpression(line), + : CXFA_FMExpression(), m_pCondition(std::move(pCondition)), m_pExpression(std::move(pExpression)) {} @@ -319,8 +310,8 @@ bool CXFA_FMWhileExpression::ToJavaScript(CFX_WideTextBuf& js, return !CXFA_IsTooBig(js); } -CXFA_FMBreakExpression::CXFA_FMBreakExpression(uint32_t line) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_BREAK) {} +CXFA_FMBreakExpression::CXFA_FMBreakExpression() + : CXFA_FMExpression(XFA_FM_EXPTYPE_BREAK) {} CXFA_FMBreakExpression::~CXFA_FMBreakExpression() {} @@ -334,8 +325,8 @@ bool CXFA_FMBreakExpression::ToJavaScript(CFX_WideTextBuf& js, return !CXFA_IsTooBig(js); } -CXFA_FMContinueExpression::CXFA_FMContinueExpression(uint32_t line) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_CONTINUE) {} +CXFA_FMContinueExpression::CXFA_FMContinueExpression() + : CXFA_FMExpression(XFA_FM_EXPTYPE_CONTINUE) {} CXFA_FMContinueExpression::~CXFA_FMContinueExpression() {} @@ -350,14 +341,13 @@ bool CXFA_FMContinueExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMForExpression::CXFA_FMForExpression( - uint32_t line, const WideStringView& wsVariant, std::unique_ptr<CXFA_FMSimpleExpression> pAssignment, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, int32_t iDirection, std::unique_ptr<CXFA_FMSimpleExpression> pStep, std::unique_ptr<CXFA_FMExpression> pList) - : CXFA_FMExpression(line), + : CXFA_FMExpression(), m_wsVariant(wsVariant), m_pAssignment(std::move(pAssignment)), m_pAccessor(std::move(pAccessor)), @@ -418,11 +408,10 @@ bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMForeachExpression::CXFA_FMForeachExpression( - uint32_t line, const WideStringView& wsIdentifier, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors, std::unique_ptr<CXFA_FMExpression> pList) - : CXFA_FMExpression(line), + : CXFA_FMExpression(), m_wsIdentifier(wsIdentifier), m_pAccessors(std::move(pAccessors)), m_pList(std::move(pList)) {} diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h index af8175a700..3b2fb4731d 100644 --- a/xfa/fxfa/fm2js/cxfa_fmexpression.h +++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h @@ -30,22 +30,19 @@ class CXFA_FMExpression { virtual ~CXFA_FMExpression() {} virtual bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) = 0; - uint32_t GetLine() { return m_line; } XFA_FM_EXPTYPE GetExpType() const { return m_type; } protected: - explicit CXFA_FMExpression(uint32_t line); - CXFA_FMExpression(uint32_t line, XFA_FM_EXPTYPE type); + CXFA_FMExpression(); + explicit CXFA_FMExpression(XFA_FM_EXPTYPE type); private: XFA_FM_EXPTYPE m_type; - uint32_t m_line; }; class CXFA_FMFunctionDefinition : public CXFA_FMExpression { public: CXFA_FMFunctionDefinition( - uint32_t line, bool isGlobal, const WideStringView& wsName, std::vector<WideStringView>&& arguments, @@ -63,8 +60,7 @@ class CXFA_FMFunctionDefinition : public CXFA_FMExpression { class CXFA_FMVarExpression : public CXFA_FMExpression { public: - CXFA_FMVarExpression(uint32_t line, - const WideStringView& wsName, + CXFA_FMVarExpression(const WideStringView& wsName, std::unique_ptr<CXFA_FMSimpleExpression> pInit); ~CXFA_FMVarExpression() override; @@ -77,8 +73,8 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { class CXFA_FMExpExpression : public CXFA_FMExpression { public: - CXFA_FMExpExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pExpression); + explicit CXFA_FMExpExpression( + std::unique_ptr<CXFA_FMSimpleExpression> pExpression); ~CXFA_FMExpExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -90,7 +86,6 @@ class CXFA_FMExpExpression : public CXFA_FMExpression { class CXFA_FMBlockExpression : public CXFA_FMExpression { public: CXFA_FMBlockExpression( - uint32_t line, std::vector<std::unique_ptr<CXFA_FMExpression>>&& pExpressionList); ~CXFA_FMBlockExpression() override; @@ -102,7 +97,7 @@ class CXFA_FMBlockExpression : public CXFA_FMExpression { class CXFA_FMDoExpression : public CXFA_FMExpression { public: - CXFA_FMDoExpression(uint32_t line, std::unique_ptr<CXFA_FMExpression> pList); + explicit CXFA_FMDoExpression(std::unique_ptr<CXFA_FMExpression> pList); ~CXFA_FMDoExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -113,8 +108,7 @@ class CXFA_FMDoExpression : public CXFA_FMExpression { class CXFA_FMIfExpression : public CXFA_FMExpression { public: - CXFA_FMIfExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pExpression, + CXFA_FMIfExpression(std::unique_ptr<CXFA_FMSimpleExpression> pExpression, std::unique_ptr<CXFA_FMExpression> pIfExpression, std::unique_ptr<CXFA_FMExpression> pElseExpression); ~CXFA_FMIfExpression() override; @@ -129,8 +123,7 @@ class CXFA_FMIfExpression : public CXFA_FMExpression { class CXFA_FMWhileExpression : public CXFA_FMExpression { public: - CXFA_FMWhileExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pCodition, + CXFA_FMWhileExpression(std::unique_ptr<CXFA_FMSimpleExpression> pCodition, std::unique_ptr<CXFA_FMExpression> pExpression); ~CXFA_FMWhileExpression() override; @@ -143,7 +136,7 @@ class CXFA_FMWhileExpression : public CXFA_FMExpression { class CXFA_FMBreakExpression : public CXFA_FMExpression { public: - explicit CXFA_FMBreakExpression(uint32_t line); + CXFA_FMBreakExpression(); ~CXFA_FMBreakExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -151,7 +144,7 @@ class CXFA_FMBreakExpression : public CXFA_FMExpression { class CXFA_FMContinueExpression : public CXFA_FMExpression { public: - explicit CXFA_FMContinueExpression(uint32_t line); + CXFA_FMContinueExpression(); ~CXFA_FMContinueExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -159,8 +152,7 @@ class CXFA_FMContinueExpression : public CXFA_FMExpression { class CXFA_FMForExpression : public CXFA_FMExpression { public: - CXFA_FMForExpression(uint32_t line, - const WideStringView& wsVariant, + CXFA_FMForExpression(const WideStringView& wsVariant, std::unique_ptr<CXFA_FMSimpleExpression> pAssignment, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, int32_t iDirection, @@ -183,7 +175,6 @@ class CXFA_FMForeachExpression : public CXFA_FMExpression { public: // Takes ownership of |pAccessors|. CXFA_FMForeachExpression( - uint32_t line, const WideStringView& wsIdentifier, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors, std::unique_ptr<CXFA_FMExpression> pList); diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 78e99a53e3..41989f0a2d 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -131,7 +131,6 @@ WideString CXFA_FMToken::ToDebugString() const { CXFA_FMLexer::CXFA_FMLexer(const WideStringView& wsFormCalc) : m_cursor(wsFormCalc.unterminated_c_str()), m_end(m_cursor + wsFormCalc.GetLength() - 1), - m_current_line(1), m_lexer_error(false) {} CXFA_FMLexer::~CXFA_FMLexer() {} @@ -148,7 +147,6 @@ CXFA_FMToken CXFA_FMLexer::NextToken() { switch (*m_cursor) { case '\n': - ++m_current_line; ++m_cursor; break; case '\r': @@ -389,7 +387,6 @@ void CXFA_FMLexer::AdvanceForComment() { return; } if (*m_cursor == L'\n') { - ++m_current_line; ++m_cursor; return; } diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.h b/xfa/fxfa/fm2js/cxfa_fmlexer.h index eb9e45e180..c0156f72f7 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.h +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.h @@ -110,8 +110,6 @@ class CXFA_FMLexer { CXFA_FMToken NextToken(); - uint32_t GetCurrentLine() const { return m_current_line; } - void SetCurrentLine(uint32_t line) { m_current_line = line; } const wchar_t* GetPos() { return m_cursor; } void SetPos(const wchar_t* pos) { m_cursor = pos; } @@ -125,7 +123,6 @@ class CXFA_FMLexer { const wchar_t* m_cursor; const wchar_t* const m_end; - uint32_t m_current_line; bool m_lexer_error; }; diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp index 1805c119b6..a103183c38 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp @@ -35,7 +35,7 @@ std::unique_ptr<CXFA_FMFunctionDefinition> CXFA_FMParser::Parse() { std::vector<WideStringView> arguments; return pdfium::MakeUnique<CXFA_FMFunctionDefinition>( - 1, true, L"", std::move(arguments), std::move(expressions)); + true, L"", std::move(arguments), std::move(expressions)); } bool CXFA_FMParser::NextToken() { @@ -96,7 +96,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseFunction() { WideStringView ident; std::vector<WideStringView> arguments; std::vector<std::unique_ptr<CXFA_FMExpression>> expressions; - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type != TOKidentifier) { @@ -148,7 +147,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseFunction() { } return pdfium::MakeUnique<CXFA_FMFunctionDefinition>( - line, false, ident, std::move(arguments), std::move(expressions)); + false, ident, std::move(arguments), std::move(expressions)); } std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpression() { @@ -157,7 +156,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpression() { return nullptr; std::unique_ptr<CXFA_FMExpression> expr; - uint32_t line = m_lexer->GetCurrentLine(); switch (m_token.m_type) { case TOKvar: expr = ParseDeclarationExpression(); @@ -188,12 +186,12 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpression() { expr = ParseDoExpression(); break; case TOKbreak: - expr = pdfium::MakeUnique<CXFA_FMBreakExpression>(line); + expr = pdfium::MakeUnique<CXFA_FMBreakExpression>(); if (!NextToken()) return nullptr; break; case TOKcontinue: - expr = pdfium::MakeUnique<CXFA_FMContinueExpression>(line); + expr = pdfium::MakeUnique<CXFA_FMContinueExpression>(); if (!NextToken()) return nullptr; break; @@ -210,7 +208,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseDeclarationExpression() { return nullptr; WideStringView ident; - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type != TOKidentifier) { @@ -232,7 +229,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseDeclarationExpression() { return nullptr; } - return pdfium::MakeUnique<CXFA_FMVarExpression>(line, ident, std::move(expr)); + return pdfium::MakeUnique<CXFA_FMVarExpression>(ident, std::move(expr)); } std::unique_ptr<CXFA_FMSimpleExpression> @@ -248,7 +245,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> pExp1 = ParseSimpleExpression(); if (!pExp1) return nullptr; @@ -262,9 +258,9 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseExpExpression() { return nullptr; pExp1 = pdfium::MakeUnique<CXFA_FMAssignExpression>( - line, TOKassign, std::move(pExp1), std::move(pExp2)); + TOKassign, std::move(pExp1), std::move(pExp2)); } - return pdfium::MakeUnique<CXFA_FMExpExpression>(line, std::move(pExp1)); + return pdfium::MakeUnique<CXFA_FMExpExpression>(std::move(pExp1)); } std::unique_ptr<CXFA_FMSimpleExpression> @@ -273,7 +269,6 @@ CXFA_FMParser::ParseLogicalOrExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseLogicalAndExpression(); if (!e1) return nullptr; @@ -291,7 +286,7 @@ CXFA_FMParser::ParseLogicalOrExpression() { return nullptr; e1 = pdfium::MakeUnique<CXFA_FMLogicalOrExpression>( - line, TOKor, std::move(e1), std::move(e2)); + TOKor, std::move(e1), std::move(e2)); continue; } default: @@ -308,7 +303,6 @@ CXFA_FMParser::ParseLogicalAndExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseEqualityExpression(); if (!e1) return nullptr; @@ -325,7 +319,7 @@ CXFA_FMParser::ParseLogicalAndExpression() { return nullptr; e1 = pdfium::MakeUnique<CXFA_FMLogicalAndExpression>( - line, TOKand, std::move(e1), std::move(e2)); + TOKand, std::move(e1), std::move(e2)); continue; } default: @@ -342,7 +336,6 @@ CXFA_FMParser::ParseEqualityExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseRelationalExpression(); if (!e1) return nullptr; @@ -358,8 +351,8 @@ CXFA_FMParser::ParseEqualityExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMEqualExpression>( - line, TOKeq, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMEqualExpression>(TOKeq, std::move(e1), + std::move(e2)); continue; case TOKne: case TOKksne: @@ -370,8 +363,8 @@ CXFA_FMParser::ParseEqualityExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMNotEqualExpression>( - line, TOKne, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMNotEqualExpression>(TOKne, std::move(e1), + std::move(e2)); continue; default: break; @@ -387,7 +380,6 @@ CXFA_FMParser::ParseRelationalExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseAddtiveExpression(); if (!e1) return nullptr; @@ -404,7 +396,7 @@ CXFA_FMParser::ParseRelationalExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMLtExpression>(line, TOKlt, std::move(e1), + e1 = pdfium::MakeUnique<CXFA_FMLtExpression>(TOKlt, std::move(e1), std::move(e2)); continue; case TOKgt: @@ -416,7 +408,7 @@ CXFA_FMParser::ParseRelationalExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMGtExpression>(line, TOKgt, std::move(e1), + e1 = pdfium::MakeUnique<CXFA_FMGtExpression>(TOKgt, std::move(e1), std::move(e2)); continue; case TOKle: @@ -428,7 +420,7 @@ CXFA_FMParser::ParseRelationalExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMLeExpression>(line, TOKle, std::move(e1), + e1 = pdfium::MakeUnique<CXFA_FMLeExpression>(TOKle, std::move(e1), std::move(e2)); continue; case TOKge: @@ -440,7 +432,7 @@ CXFA_FMParser::ParseRelationalExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMGeExpression>(line, TOKge, std::move(e1), + e1 = pdfium::MakeUnique<CXFA_FMGeExpression>(TOKge, std::move(e1), std::move(e2)); continue; default: @@ -457,7 +449,6 @@ CXFA_FMParser::ParseAddtiveExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseMultiplicativeExpression(); if (!e1) return nullptr; @@ -473,8 +464,8 @@ CXFA_FMParser::ParseAddtiveExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMPlusExpression>( - line, TOKplus, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMPlusExpression>(TOKplus, std::move(e1), + std::move(e2)); continue; case TOKminus: if (!NextToken()) @@ -484,8 +475,8 @@ CXFA_FMParser::ParseAddtiveExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMMinusExpression>( - line, TOKminus, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMMinusExpression>(TOKminus, std::move(e1), + std::move(e2)); continue; default: break; @@ -501,7 +492,6 @@ CXFA_FMParser::ParseMultiplicativeExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::unique_ptr<CXFA_FMSimpleExpression> e1 = ParseUnaryExpression(); if (!e1) return nullptr; @@ -517,8 +507,8 @@ CXFA_FMParser::ParseMultiplicativeExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMMulExpression>( - line, TOKmul, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMMulExpression>(TOKmul, std::move(e1), + std::move(e2)); continue; case TOKdiv: if (!NextToken()) @@ -528,8 +518,8 @@ CXFA_FMParser::ParseMultiplicativeExpression() { if (!e2) return nullptr; - e1 = pdfium::MakeUnique<CXFA_FMDivExpression>( - line, TOKdiv, std::move(e1), std::move(e2)); + e1 = pdfium::MakeUnique<CXFA_FMDivExpression>(TOKdiv, std::move(e1), + std::move(e2)); continue; default: break; @@ -545,7 +535,6 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseUnaryExpression() { return nullptr; std::unique_ptr<CXFA_FMSimpleExpression> expr; - uint32_t line = m_lexer->GetCurrentLine(); switch (m_token.m_type) { case TOKplus: if (!NextToken()) @@ -555,7 +544,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseUnaryExpression() { if (!expr) return nullptr; - expr = pdfium::MakeUnique<CXFA_FMPosExpression>(line, std::move(expr)); + expr = pdfium::MakeUnique<CXFA_FMPosExpression>(std::move(expr)); break; case TOKminus: if (!NextToken()) @@ -565,7 +554,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseUnaryExpression() { if (!expr) return nullptr; - expr = pdfium::MakeUnique<CXFA_FMNegExpression>(line, std::move(expr)); + expr = pdfium::MakeUnique<CXFA_FMNegExpression>(std::move(expr)); break; case TOKksnot: if (!NextToken()) @@ -575,7 +564,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseUnaryExpression() { if (!expr) return nullptr; - expr = pdfium::MakeUnique<CXFA_FMNotExpression>(line, std::move(expr)); + expr = pdfium::MakeUnique<CXFA_FMNotExpression>(std::move(expr)); break; default: expr = ParsePrimaryExpression(); @@ -596,7 +585,6 @@ CXFA_FMParser::ParsePrimaryExpression() { if (expr) return NextToken() ? std::move(expr) : nullptr; - uint32_t line = m_lexer->GetCurrentLine(); switch (m_token.m_type) { case TOKidentifier: { WideStringView wsIdentifier(m_token.m_string); @@ -608,14 +596,13 @@ CXFA_FMParser::ParsePrimaryExpression() { return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, nullptr, TOKdot, wsIdentifier, std::move(s)); + nullptr, TOKdot, wsIdentifier, std::move(s)); if (!expr) return nullptr; if (!NextToken()) return nullptr; } else { - expr = - pdfium::MakeUnique<CXFA_FMIdentifierExpression>(line, wsIdentifier); + expr = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(wsIdentifier); } break; } @@ -636,16 +623,13 @@ CXFA_FMParser::ParsePrimaryExpression() { // Literal := String | Number | Null std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseLiteral() { - uint32_t line = m_lexer->GetCurrentLine(); switch (m_token.m_type) { case TOKnumber: - return pdfium::MakeUnique<CXFA_FMNumberExpression>(line, - m_token.m_string); + return pdfium::MakeUnique<CXFA_FMNumberExpression>(m_token.m_string); case TOKstring: - return pdfium::MakeUnique<CXFA_FMStringExpression>(line, - m_token.m_string); + return pdfium::MakeUnique<CXFA_FMStringExpression>(m_token.m_string); case TOKnull: - return pdfium::MakeUnique<CXFA_FMNullExpression>(line); + return pdfium::MakeUnique<CXFA_FMNullExpression>(); default: return nullptr; } @@ -657,7 +641,6 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); size_t expr_count = 0; while (1) { ++expr_count; @@ -694,7 +677,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( } } expr = pdfium::MakeUnique<CXFA_FMCallExpression>( - line, std::move(expr), std::move(expressions), false); + std::move(expr), std::move(expressions), false); if (!NextToken()) return nullptr; if (m_token.m_type != TOKlbracket) @@ -705,7 +688,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, std::move(expr), TOKcall, L"", std::move(s)); + std::move(expr), TOKcall, L"", std::move(s)); break; } case TOKdot: { @@ -716,7 +699,6 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( return nullptr; } WideStringView tempStr = m_token.m_string; - uint32_t tempLine = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type == TOKlparen) { @@ -747,12 +729,11 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( } } std::unique_ptr<CXFA_FMSimpleExpression> pIdentifier = - pdfium::MakeUnique<CXFA_FMIdentifierExpression>(tempLine, - tempStr); + pdfium::MakeUnique<CXFA_FMIdentifierExpression>(tempStr); pExpCall = pdfium::MakeUnique<CXFA_FMCallExpression>( - line, std::move(pIdentifier), std::move(expressions), true); + std::move(pIdentifier), std::move(expressions), true); expr = pdfium::MakeUnique<CXFA_FMMethodCallExpression>( - line, std::move(expr), std::move(pExpCall)); + std::move(expr), std::move(pExpCall)); if (!NextToken()) return nullptr; if (m_token.m_type != TOKlbracket) @@ -763,20 +744,20 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, std::move(expr), TOKcall, L"", std::move(s)); + std::move(expr), TOKcall, L"", std::move(s)); } else if (m_token.m_type == TOKlbracket) { std::unique_ptr<CXFA_FMSimpleExpression> s = ParseIndexExpression(); if (!s) return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - tempLine, std::move(expr), TOKdot, tempStr, std::move(s)); + std::move(expr), TOKdot, tempStr, std::move(s)); } else { std::unique_ptr<CXFA_FMSimpleExpression> s = - pdfium::MakeUnique<CXFA_FMIndexExpression>( - tempLine, ACCESSOR_NO_INDEX, nullptr, false); + pdfium::MakeUnique<CXFA_FMIndexExpression>(ACCESSOR_NO_INDEX, + nullptr, false); expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, std::move(expr), TOKdot, tempStr, std::move(s)); + std::move(expr), TOKdot, tempStr, std::move(s)); continue; } } break; @@ -787,8 +768,8 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( m_error = true; return nullptr; } + WideStringView tempStr = m_token.m_string; - uint32_t tempLine = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type == TOKlbracket) { @@ -797,13 +778,13 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>( - tempLine, std::move(expr), TOKdotdot, tempStr, std::move(s)); + std::move(expr), TOKdotdot, tempStr, std::move(s)); } else { std::unique_ptr<CXFA_FMSimpleExpression> s = - pdfium::MakeUnique<CXFA_FMIndexExpression>( - tempLine, ACCESSOR_NO_INDEX, nullptr, false); + pdfium::MakeUnique<CXFA_FMIndexExpression>(ACCESSOR_NO_INDEX, + nullptr, false); expr = pdfium::MakeUnique<CXFA_FMDotDotAccessorExpression>( - line, std::move(expr), TOKdotdot, tempStr, std::move(s)); + std::move(expr), TOKdotdot, tempStr, std::move(s)); continue; } } break; @@ -814,16 +795,16 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( m_error = true; return nullptr; } + WideStringView tempStr = m_token.m_string; - uint32_t tempLine = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type != TOKlbracket) { std::unique_ptr<CXFA_FMSimpleExpression> s = - pdfium::MakeUnique<CXFA_FMIndexExpression>( - tempLine, ACCESSOR_NO_INDEX, nullptr, false); + pdfium::MakeUnique<CXFA_FMIndexExpression>(ACCESSOR_NO_INDEX, + nullptr, false); expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, std::move(expr), TOKdotscream, tempStr, std::move(s)); + std::move(expr), TOKdotscream, tempStr, std::move(s)); continue; } std::unique_ptr<CXFA_FMSimpleExpression> s = ParseIndexExpression(); @@ -831,15 +812,15 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParsePostExpression( return nullptr; expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - tempLine, std::move(expr), TOKdotscream, tempStr, std::move(s)); + std::move(expr), TOKdotscream, tempStr, std::move(s)); break; } case TOKdotstar: { std::unique_ptr<CXFA_FMSimpleExpression> s = - pdfium::MakeUnique<CXFA_FMIndexExpression>(line, ACCESSOR_NO_INDEX, + pdfium::MakeUnique<CXFA_FMIndexExpression>(ACCESSOR_NO_INDEX, nullptr, false); expr = pdfium::MakeUnique<CXFA_FMDotAccessorExpression>( - line, std::move(expr), TOKdotstar, L"*", std::move(s)); + std::move(expr), TOKdotstar, L"*", std::move(s)); break; } default: @@ -855,8 +836,6 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseIndexExpression() { AutoRestorer<unsigned long> restorer(&m_parse_depth); if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; @@ -864,7 +843,7 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseIndexExpression() { XFA_FM_AccessorIndex accessorIndex = ACCESSOR_NO_RELATIVEINDEX; std::unique_ptr<CXFA_FMSimpleExpression> pExp; if (m_token.m_type == TOKmul) { - pExp = pdfium::MakeUnique<CXFA_FMIndexExpression>(line, accessorIndex, + pExp = pdfium::MakeUnique<CXFA_FMIndexExpression>(accessorIndex, std::move(s), true); if (!pExp || !NextToken()) return nullptr; @@ -890,8 +869,8 @@ std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseIndexExpression() { m_error = true; return nullptr; } - return pdfium::MakeUnique<CXFA_FMIndexExpression>(line, accessorIndex, - std::move(s), false); + return pdfium::MakeUnique<CXFA_FMIndexExpression>(accessorIndex, std::move(s), + false); } std::unique_ptr<CXFA_FMSimpleExpression> CXFA_FMParser::ParseParenExpression() { @@ -921,7 +900,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseBlockExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); std::vector<std::unique_ptr<CXFA_FMExpression>> expressions; while (1) { std::unique_ptr<CXFA_FMExpression> expr; @@ -953,8 +931,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseBlockExpression() { } break; } - return pdfium::MakeUnique<CXFA_FMBlockExpression>(line, - std::move(expressions)); + return pdfium::MakeUnique<CXFA_FMBlockExpression>(std::move(expressions)); } std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseIfExpression() { @@ -962,7 +939,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseIfExpression() { if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - uint32_t line = m_lexer->GetCurrentLine(); const wchar_t* pStartPos = m_lexer->GetPos(); if (!NextToken() || !CheckThenNext(TOKlparen)) return nullptr; @@ -980,8 +956,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseIfExpression() { if (!CheckThenNext(TOKrparen)) return nullptr; if (m_token.m_type != TOKthen) { - m_lexer->SetCurrentLine(line); - m_token = CXFA_FMToken(TOKidentifier); m_token.m_string = L"if"; m_lexer->SetPos(pStartPos); @@ -1022,7 +996,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseIfExpression() { m_error = true; return nullptr; } - return pdfium::MakeUnique<CXFA_FMIfExpression>(line, std::move(pExpression), + return pdfium::MakeUnique<CXFA_FMIfExpression>(std::move(pExpression), std::move(pIfExpression), std::move(pElseExpression)); } @@ -1031,8 +1005,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseWhileExpression() { AutoRestorer<unsigned long> restorer(&m_parse_depth); if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; @@ -1043,7 +1015,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseWhileExpression() { std::unique_ptr<CXFA_FMExpression> pExpression = ParseBlockExpression(); if (!pExpression || !CheckThenNext(TOKendwhile)) return nullptr; - return pdfium::MakeUnique<CXFA_FMWhileExpression>(line, std::move(pCondition), + return pdfium::MakeUnique<CXFA_FMWhileExpression>(std::move(pCondition), std::move(pExpression)); } @@ -1069,7 +1041,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForExpression() { return nullptr; WideStringView wsVariant; - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type != TOKidentifier) { @@ -1128,7 +1099,7 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForExpression() { if (!expr) return nullptr; return pdfium::MakeUnique<CXFA_FMForExpression>( - line, wsVariant, std::move(pAssignment), std::move(pAccessor), iDirection, + wsVariant, std::move(pAssignment), std::move(pAccessor), iDirection, std::move(pStep), std::move(pList)); } @@ -1141,7 +1112,6 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForeachExpression() { WideStringView wsIdentifier; std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> pAccessors; std::unique_ptr<CXFA_FMExpression> pList; - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; if (m_token.m_type != TOKidentifier) { @@ -1175,22 +1145,20 @@ std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseForeachExpression() { if (!pList || !CheckThenNext(TOKendfor)) return nullptr; return pdfium::MakeUnique<CXFA_FMForeachExpression>( - line, wsIdentifier, std::move(pAccessors), std::move(pList)); + wsIdentifier, std::move(pAccessors), std::move(pList)); } std::unique_ptr<CXFA_FMExpression> CXFA_FMParser::ParseDoExpression() { AutoRestorer<unsigned long> restorer(&m_parse_depth); if (HasError() || !IncrementParseDepthAndCheck()) return nullptr; - - uint32_t line = m_lexer->GetCurrentLine(); if (!NextToken()) return nullptr; std::unique_ptr<CXFA_FMExpression> expr = ParseBlockExpression(); if (!expr || !CheckThenNext(TOKend)) return nullptr; - return pdfium::MakeUnique<CXFA_FMDoExpression>(line, std::move(expr)); + return pdfium::MakeUnique<CXFA_FMDoExpression>(std::move(expr)); } bool CXFA_FMParser::HasError() const { diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp index 36adfb17f5..e0af27ea25 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp @@ -71,15 +71,14 @@ const XFA_FMSOMMethod gs_FMSomMethods[] = { } // namespace -CXFA_FMSimpleExpression::CXFA_FMSimpleExpression(uint32_t line, XFA_FM_TOKEN op) - : m_line(line), m_op(op) {} +CXFA_FMSimpleExpression::CXFA_FMSimpleExpression(XFA_FM_TOKEN op) : m_op(op) {} XFA_FM_TOKEN CXFA_FMSimpleExpression::GetOperatorToken() const { return m_op; } -CXFA_FMNullExpression::CXFA_FMNullExpression(uint32_t line) - : CXFA_FMSimpleExpression(line, TOKnull) {} +CXFA_FMNullExpression::CXFA_FMNullExpression() + : CXFA_FMSimpleExpression(TOKnull) {} bool CXFA_FMNullExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { CXFA_FMToJavaScriptDepth depthManager; @@ -90,9 +89,8 @@ bool CXFA_FMNullExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { return !CXFA_IsTooBig(js); } -CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line, - WideStringView wsNumber) - : CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {} +CXFA_FMNumberExpression::CXFA_FMNumberExpression(WideStringView wsNumber) + : CXFA_FMSimpleExpression(TOKnumber), m_wsNumber(wsNumber) {} CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {} @@ -106,9 +104,8 @@ bool CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& js, return !CXFA_IsTooBig(js); } -CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, - WideStringView wsString) - : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} +CXFA_FMStringExpression::CXFA_FMStringExpression(WideStringView wsString) + : CXFA_FMSimpleExpression(TOKstring), m_wsString(wsString) {} CXFA_FMStringExpression::~CXFA_FMStringExpression() {} @@ -147,10 +144,8 @@ bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMIdentifierExpression::CXFA_FMIdentifierExpression( - uint32_t line, WideStringView wsIdentifier) - : CXFA_FMSimpleExpression(line, TOKidentifier), - m_wsIdentifier(wsIdentifier) {} + : CXFA_FMSimpleExpression(TOKidentifier), m_wsIdentifier(wsIdentifier) {} CXFA_FMIdentifierExpression::~CXFA_FMIdentifierExpression() {} @@ -185,11 +180,10 @@ bool CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMAssignExpression::CXFA_FMAssignExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) - : CXFA_FMSimpleExpression(line, op), + : CXFA_FMSimpleExpression(op), m_pExp1(std::move(pExp1)), m_pExp2(std::move(pExp2)) {} @@ -230,11 +224,10 @@ bool CXFA_FMAssignExpression::ToJavaScript(CFX_WideTextBuf& js, CXFA_FMBinExpression::CXFA_FMBinExpression( const WideString& opName, - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) - : CXFA_FMSimpleExpression(line, op), + : CXFA_FMSimpleExpression(op), m_OpName(opName), m_pExp1(std::move(pExp1)), m_pExp2(std::move(pExp2)) {} @@ -259,145 +252,118 @@ bool CXFA_FMBinExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMLogicalOrExpression::CXFA_FMLogicalOrExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"log_or_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMLogicalAndExpression::CXFA_FMLogicalAndExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"log_and_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMEqualExpression::CXFA_FMEqualExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"eq_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMNotEqualExpression::CXFA_FMNotEqualExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"neq_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMGtExpression::CXFA_FMGtExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"gt_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMGeExpression::CXFA_FMGeExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"ge_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMLtExpression::CXFA_FMLtExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"lt_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMLeExpression::CXFA_FMLeExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"le_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMPlusExpression::CXFA_FMPlusExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"plus_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMMinusExpression::CXFA_FMMinusExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"minus_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMMulExpression::CXFA_FMMulExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"mul_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMDivExpression::CXFA_FMDivExpression( - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2) : CXFA_FMBinExpression(L"div_op", - line, op, std::move(pExp1), std::move(pExp2)) {} CXFA_FMUnaryExpression::CXFA_FMUnaryExpression( const WideString& opName, - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp) - : CXFA_FMSimpleExpression(line, op), - m_OpName(opName), - m_pExp(std::move(pExp)) {} + : CXFA_FMSimpleExpression(op), m_OpName(opName), m_pExp(std::move(pExp)) {} CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() = default; @@ -416,26 +382,22 @@ bool CXFA_FMUnaryExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMPosExpression::CXFA_FMPosExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExp) - : CXFA_FMUnaryExpression(L"pos_op", line, TOKplus, std::move(pExp)) {} + : CXFA_FMUnaryExpression(L"pos_op", TOKplus, std::move(pExp)) {} CXFA_FMNegExpression::CXFA_FMNegExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExp) - : CXFA_FMUnaryExpression(L"neg_op", line, TOKminus, std::move(pExp)) {} + : CXFA_FMUnaryExpression(L"neg_op", TOKminus, std::move(pExp)) {} CXFA_FMNotExpression::CXFA_FMNotExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExp) - : CXFA_FMUnaryExpression(L"log_not_op", line, TOKksnot, std::move(pExp)) {} + : CXFA_FMUnaryExpression(L"log_not_op", TOKksnot, std::move(pExp)) {} CXFA_FMCallExpression::CXFA_FMCallExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExp, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pArguments, bool bIsSomMethod) - : CXFA_FMSimpleExpression(line, TOKcall), + : CXFA_FMSimpleExpression(TOKcall), m_pExp(std::move(pExp)), m_bIsSomMethod(bIsSomMethod), m_Arguments(std::move(pArguments)) {} @@ -569,12 +531,11 @@ bool CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) { } CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp) - : CXFA_FMSimpleExpression(line, op), + : CXFA_FMSimpleExpression(op), m_wsIdentifier(wsIdentifier), m_pExp1(std::move(pAccessor)), m_pExp2(std::move(pIndexExp)) {} @@ -621,11 +582,10 @@ bool CXFA_FMDotAccessorExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMIndexExpression::CXFA_FMIndexExpression( - uint32_t line, XFA_FM_AccessorIndex accessorIndex, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp, bool bIsStarIndex) - : CXFA_FMSimpleExpression(line, TOKlbracket), + : CXFA_FMSimpleExpression(TOKlbracket), m_pExp(std::move(pIndexExp)), m_accessorIndex(accessorIndex), m_bIsStarIndex(bIsStarIndex) {} @@ -668,12 +628,11 @@ bool CXFA_FMIndexExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, WideStringView wsIdentifier, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp) - : CXFA_FMSimpleExpression(line, op), + : CXFA_FMSimpleExpression(op), m_wsIdentifier(wsIdentifier), m_pExp1(std::move(pAccessor)), m_pExp2(std::move(pIndexExp)) {} @@ -703,10 +662,9 @@ bool CXFA_FMDotDotAccessorExpression::ToJavaScript(CFX_WideTextBuf& js, } CXFA_FMMethodCallExpression::CXFA_FMMethodCallExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessorExp1, std::unique_ptr<CXFA_FMSimpleExpression> pCallExp) - : CXFA_FMSimpleExpression(line, TOKdot), + : CXFA_FMSimpleExpression(TOKdot), m_pExp1(std::move(pAccessorExp1)), m_pExp2(std::move(pCallExp)) {} diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h index 8aceb97f1e..ede48ec2b6 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h @@ -31,15 +31,14 @@ class CXFA_FMSimpleExpression { XFA_FM_TOKEN GetOperatorToken() const; protected: - CXFA_FMSimpleExpression(uint32_t line, XFA_FM_TOKEN op); + explicit CXFA_FMSimpleExpression(XFA_FM_TOKEN op); - uint32_t m_line; const XFA_FM_TOKEN m_op; }; class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { public: - explicit CXFA_FMNullExpression(uint32_t line); + CXFA_FMNullExpression(); ~CXFA_FMNullExpression() override {} bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -47,7 +46,7 @@ class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMNumberExpression(uint32_t line, WideStringView wsNumber); + explicit CXFA_FMNumberExpression(WideStringView wsNumber); ~CXFA_FMNumberExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -58,7 +57,7 @@ class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMStringExpression(uint32_t line, WideStringView wsString); + explicit CXFA_FMStringExpression(WideStringView wsString); ~CXFA_FMStringExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -69,7 +68,7 @@ class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { class CXFA_FMIdentifierExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMIdentifierExpression(uint32_t line, WideStringView wsIdentifier); + explicit CXFA_FMIdentifierExpression(WideStringView wsIdentifier); ~CXFA_FMIdentifierExpression() override; bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override; @@ -80,8 +79,7 @@ class CXFA_FMIdentifierExpression : public CXFA_FMSimpleExpression { class CXFA_FMAssignExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMAssignExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMAssignExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMAssignExpression() override; @@ -101,7 +99,6 @@ class CXFA_FMBinExpression : public CXFA_FMSimpleExpression { protected: CXFA_FMBinExpression(const WideString& opName, - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); @@ -114,8 +111,7 @@ class CXFA_FMBinExpression : public CXFA_FMSimpleExpression { class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression { public: - CXFA_FMLogicalOrExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMLogicalOrExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMLogicalOrExpression() override {} @@ -123,8 +119,7 @@ class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression { class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression { public: - CXFA_FMLogicalAndExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMLogicalAndExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMLogicalAndExpression() override {} @@ -132,8 +127,7 @@ class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression { class CXFA_FMEqualExpression : public CXFA_FMBinExpression { public: - CXFA_FMEqualExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMEqualExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMEqualExpression() override {} @@ -141,8 +135,7 @@ class CXFA_FMEqualExpression : public CXFA_FMBinExpression { class CXFA_FMNotEqualExpression : public CXFA_FMBinExpression { public: - CXFA_FMNotEqualExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMNotEqualExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMNotEqualExpression() override {} @@ -150,8 +143,7 @@ class CXFA_FMNotEqualExpression : public CXFA_FMBinExpression { class CXFA_FMGtExpression : public CXFA_FMBinExpression { public: - CXFA_FMGtExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMGtExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMGtExpression() override {} @@ -159,8 +151,7 @@ class CXFA_FMGtExpression : public CXFA_FMBinExpression { class CXFA_FMGeExpression : public CXFA_FMBinExpression { public: - CXFA_FMGeExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMGeExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMGeExpression() override {} @@ -168,8 +159,7 @@ class CXFA_FMGeExpression : public CXFA_FMBinExpression { class CXFA_FMLtExpression : public CXFA_FMBinExpression { public: - CXFA_FMLtExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMLtExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMLtExpression() override {} @@ -177,8 +167,7 @@ class CXFA_FMLtExpression : public CXFA_FMBinExpression { class CXFA_FMLeExpression : public CXFA_FMBinExpression { public: - CXFA_FMLeExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMLeExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMLeExpression() override {} @@ -186,8 +175,7 @@ class CXFA_FMLeExpression : public CXFA_FMBinExpression { class CXFA_FMPlusExpression : public CXFA_FMBinExpression { public: - CXFA_FMPlusExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMPlusExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMPlusExpression() override {} @@ -195,8 +183,7 @@ class CXFA_FMPlusExpression : public CXFA_FMBinExpression { class CXFA_FMMinusExpression : public CXFA_FMBinExpression { public: - CXFA_FMMinusExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMMinusExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMMinusExpression() override {} @@ -204,8 +191,7 @@ class CXFA_FMMinusExpression : public CXFA_FMBinExpression { class CXFA_FMMulExpression : public CXFA_FMBinExpression { public: - CXFA_FMMulExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMMulExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMMulExpression() override {} @@ -213,8 +199,7 @@ class CXFA_FMMulExpression : public CXFA_FMBinExpression { class CXFA_FMDivExpression : public CXFA_FMBinExpression { public: - CXFA_FMDivExpression(uint32_t line, - XFA_FM_TOKEN op, + CXFA_FMDivExpression(XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp1, std::unique_ptr<CXFA_FMSimpleExpression> pExp2); ~CXFA_FMDivExpression() override {} @@ -228,7 +213,6 @@ class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { protected: CXFA_FMUnaryExpression(const WideString& opName, - uint32_t line, XFA_FM_TOKEN op, std::unique_ptr<CXFA_FMSimpleExpression> pExp); @@ -239,29 +223,25 @@ class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { class CXFA_FMPosExpression : public CXFA_FMUnaryExpression { public: - CXFA_FMPosExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pExp); + explicit CXFA_FMPosExpression(std::unique_ptr<CXFA_FMSimpleExpression> pExp); ~CXFA_FMPosExpression() override {} }; class CXFA_FMNegExpression : public CXFA_FMUnaryExpression { public: - CXFA_FMNegExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pExp); + explicit CXFA_FMNegExpression(std::unique_ptr<CXFA_FMSimpleExpression> pExp); ~CXFA_FMNegExpression() override {} }; class CXFA_FMNotExpression : public CXFA_FMUnaryExpression { public: - CXFA_FMNotExpression(uint32_t line, - std::unique_ptr<CXFA_FMSimpleExpression> pExp); + explicit CXFA_FMNotExpression(std::unique_ptr<CXFA_FMSimpleExpression> pExp); ~CXFA_FMNotExpression() override {} }; class CXFA_FMCallExpression : public CXFA_FMSimpleExpression { public: CXFA_FMCallExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pExp, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pArguments, bool bIsSomMethod); @@ -280,7 +260,6 @@ class CXFA_FMCallExpression : public CXFA_FMSimpleExpression { class CXFA_FMDotAccessorExpression : public CXFA_FMSimpleExpression { public: CXFA_FMDotAccessorExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, WideStringView wsIdentifier, @@ -297,8 +276,7 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMSimpleExpression { class CXFA_FMIndexExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMIndexExpression(uint32_t line, - XFA_FM_AccessorIndex accessorIndex, + CXFA_FMIndexExpression(XFA_FM_AccessorIndex accessorIndex, std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp, bool bIsStarIndex); ~CXFA_FMIndexExpression() override; @@ -314,7 +292,6 @@ class CXFA_FMIndexExpression : public CXFA_FMSimpleExpression { class CXFA_FMDotDotAccessorExpression : public CXFA_FMSimpleExpression { public: CXFA_FMDotDotAccessorExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessor, XFA_FM_TOKEN op, WideStringView wsIdentifier, @@ -332,7 +309,6 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMSimpleExpression { class CXFA_FMMethodCallExpression : public CXFA_FMSimpleExpression { public: CXFA_FMMethodCallExpression( - uint32_t line, std::unique_ptr<CXFA_FMSimpleExpression> pAccessorExp1, std::unique_ptr<CXFA_FMSimpleExpression> pCallExp); ~CXFA_FMMethodCallExpression() override; diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp index 168de84db4..e8149ebfaf 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp @@ -17,14 +17,14 @@ TEST(FMCallExpressionTest, more_than_32_arguments) { // Use sign as it has 3 object parameters at positions 0, 5, and 6. - auto exp = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(0, L"sign"); + auto exp = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(L"sign"); std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> args; for (size_t i = 0; i < 50; i++) - args.push_back(pdfium::MakeUnique<CXFA_FMNullExpression>(0)); + args.push_back(pdfium::MakeUnique<CXFA_FMNullExpression>()); CXFA_FMToJavaScriptDepth::Reset(); - CXFA_FMCallExpression callExp(0, std::move(exp), std::move(args), true); + CXFA_FMCallExpression callExp(std::move(exp), std::move(args), true); CFX_WideTextBuf js; callExp.ToJavaScript(js, ReturnType::kInfered); @@ -49,7 +49,7 @@ TEST(FMCallExpressionTest, more_than_32_arguments) { TEST(FMStringExpressionTest, Empty) { CXFA_FMToJavaScriptDepth::Reset(); CFX_WideTextBuf accumulator; - CXFA_FMStringExpression(1, WideStringView()) + CXFA_FMStringExpression(WideStringView()) .ToJavaScript(accumulator, ReturnType::kInfered); EXPECT_EQ(L"", accumulator.AsStringView()); } @@ -57,16 +57,15 @@ TEST(FMStringExpressionTest, Empty) { TEST(FMStringExpressionTest, Short) { CXFA_FMToJavaScriptDepth::Reset(); CFX_WideTextBuf accumulator; - CXFA_FMStringExpression(1, L"a").ToJavaScript(accumulator, - ReturnType::kInfered); + CXFA_FMStringExpression(L"a").ToJavaScript(accumulator, ReturnType::kInfered); EXPECT_EQ(L"a", accumulator.AsStringView()); } TEST(FMStringExpressionTest, Medium) { CXFA_FMToJavaScriptDepth::Reset(); CFX_WideTextBuf accumulator; - CXFA_FMStringExpression(1, L".abcd.") - .ToJavaScript(accumulator, ReturnType::kInfered); + CXFA_FMStringExpression(L".abcd.").ToJavaScript(accumulator, + ReturnType::kInfered); EXPECT_EQ(L"\"abcd\"", accumulator.AsStringView()); } @@ -74,7 +73,7 @@ TEST(FMStringExpressionTest, Long) { CXFA_FMToJavaScriptDepth::Reset(); CFX_WideTextBuf accumulator; std::vector<WideStringView::UnsignedType> vec(140000, L'A'); - CXFA_FMStringExpression(1, WideStringView(vec)) + CXFA_FMStringExpression(WideStringView(vec)) .ToJavaScript(accumulator, ReturnType::kInfered); EXPECT_EQ(140000u, accumulator.GetLength()); } @@ -82,7 +81,7 @@ TEST(FMStringExpressionTest, Long) { TEST(FMStringExpressionTest, Quoted) { CXFA_FMToJavaScriptDepth::Reset(); CFX_WideTextBuf accumulator; - CXFA_FMStringExpression(1, L".Simon says \"\"run\"\".") + CXFA_FMStringExpression(L".Simon says \"\"run\"\".") .ToJavaScript(accumulator, ReturnType::kInfered); EXPECT_EQ(L"\"Simon says \\\"run\\\"\"", accumulator.AsStringView()); } |