diff options
author | npm <npm@chromium.org> | 2016-11-29 10:32:35 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-29 10:32:35 -0800 |
commit | f11380fc01cc17f05a34859d34c42b495c8ef8be (patch) | |
tree | fdb1c9937469cccef22e199c41110245ee02a480 /xfa/fxfa/fm2js/xfa_expression.cpp | |
parent | 708ef623c2e989a9ad909bf0c94a7dff89694412 (diff) | |
download | pdfium-f11380fc01cc17f05a34859d34c42b495c8ef8be.tar.xz |
Use unique_ptr in CFXA_FM expressions constructorschromium/2937
Review-Url: https://codereview.chromium.org/2534143003
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_expression.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_expression.cpp | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp index 8d1888a797..a668fc9089 100644 --- a/xfa/fxfa/fm2js/xfa_expression.cpp +++ b/xfa/fxfa/fm2js/xfa_expression.cpp @@ -103,12 +103,13 @@ void CXFA_FMFunctionDefinition::ToJavaScript(CFX_WideTextBuf& javascript) { void CXFA_FMFunctionDefinition::ToImpliedReturnJS(CFX_WideTextBuf&) {} -CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line, - const CFX_WideStringC& wsName, - CXFA_FMExpression* pInit) +CXFA_FMVarExpression::CXFA_FMVarExpression( + uint32_t line, + const CFX_WideStringC& wsName, + std::unique_ptr<CXFA_FMExpression> pInit) : CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR), m_wsName(wsName), - m_pInit(pInit) {} + m_pInit(std::move(pInit)) {} CXFA_FMVarExpression::~CXFA_FMVarExpression() {} @@ -158,9 +159,11 @@ void CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L";\n"); } -CXFA_FMExpExpression::CXFA_FMExpExpression(uint32_t line, - CXFA_FMSimpleExpression* pExpression) - : CXFA_FMExpression(line, XFA_FM_EXPTYPE_EXP), m_pExpression(pExpression) {} +CXFA_FMExpExpression::CXFA_FMExpExpression( + uint32_t line, + std::unique_ptr<CXFA_FMSimpleExpression> pExpression) + : CXFA_FMExpression(line, XFA_FM_EXPTYPE_EXP), + m_pExpression(std::move(pExpression)) {} CXFA_FMExpExpression::~CXFA_FMExpExpression() {} @@ -223,9 +226,10 @@ void CXFA_FMBlockExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"}\n"); } -CXFA_FMDoExpression::CXFA_FMDoExpression(uint32_t line, - CXFA_FMExpression* pList) - : CXFA_FMExpression(line), m_pList(pList) {} +CXFA_FMDoExpression::CXFA_FMDoExpression( + uint32_t line, + std::unique_ptr<CXFA_FMExpression> pList) + : CXFA_FMExpression(line), m_pList(std::move(pList)) {} CXFA_FMDoExpression::~CXFA_FMDoExpression() {} @@ -237,14 +241,15 @@ void CXFA_FMDoExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { m_pList->ToImpliedReturnJS(javascript); } -CXFA_FMIfExpression::CXFA_FMIfExpression(uint32_t line, - CXFA_FMSimpleExpression* pExpression, - CXFA_FMExpression* pIfExpression, - CXFA_FMExpression* pElseExpression) +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), - m_pExpression(pExpression), - m_pIfExpression(pIfExpression), - m_pElseExpression(pElseExpression) {} + m_pExpression(std::move(pExpression)), + m_pIfExpression(std::move(pIfExpression)), + m_pElseExpression(std::move(pElseExpression)) {} CXFA_FMIfExpression::~CXFA_FMIfExpression() {} @@ -308,11 +313,11 @@ void CXFA_FMLoopExpression::ToImpliedReturnJS(CFX_WideTextBuf&) {} CXFA_FMWhileExpression::CXFA_FMWhileExpression( uint32_t line, - CXFA_FMSimpleExpression* pCondition, - CXFA_FMExpression* pExpression) + std::unique_ptr<CXFA_FMSimpleExpression> pCondition, + std::unique_ptr<CXFA_FMExpression> pExpression) : CXFA_FMLoopExpression(line), - m_pCondition(pCondition), - m_pExpression(pExpression) {} + m_pCondition(std::move(pCondition)), + m_pExpression(std::move(pExpression)) {} CXFA_FMWhileExpression::~CXFA_FMWhileExpression() {} @@ -366,20 +371,21 @@ void CXFA_FMContinueExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"continue;\n"); } -CXFA_FMForExpression::CXFA_FMForExpression(uint32_t line, - const CFX_WideStringC& wsVariant, - CXFA_FMSimpleExpression* pAssignment, - CXFA_FMSimpleExpression* pAccessor, - int32_t iDirection, - CXFA_FMSimpleExpression* pStep, - CXFA_FMExpression* pList) +CXFA_FMForExpression::CXFA_FMForExpression( + uint32_t line, + const CFX_WideStringC& 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_FMLoopExpression(line), m_wsVariant(wsVariant), - m_pAssignment(pAssignment), - m_pAccessor(pAccessor), + m_pAssignment(std::move(pAssignment)), + m_pAccessor(std::move(pAccessor)), m_iDirection(iDirection), - m_pStep(pStep), - m_pList(pList) {} + m_pStep(std::move(pStep)), + m_pList(std::move(pList)) {} CXFA_FMForExpression::~CXFA_FMForExpression() {} @@ -487,11 +493,11 @@ CXFA_FMForeachExpression::CXFA_FMForeachExpression( uint32_t line, const CFX_WideStringC& wsIdentifier, std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors, - CXFA_FMExpression* pList) + std::unique_ptr<CXFA_FMExpression> pList) : CXFA_FMLoopExpression(line), m_wsIdentifier(wsIdentifier), m_pAccessors(std::move(pAccessors)), - m_pList(pList) {} + m_pList(std::move(pList)) {} CXFA_FMForeachExpression::~CXFA_FMForeachExpression() {} |