Index: xfa/fxfa/fm2js/xfa_fmparse.cpp |
diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp |
index a383b2e04a831c851936e38113f555e03f4b09d8..15a76a21714390dbceb653415b49fe8f30fe9776 100644 |
--- a/xfa/fxfa/fm2js/xfa_fmparse.cpp |
+++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp |
@@ -8,6 +8,9 @@ |
#include <memory> |
#include <utility> |
+#include <vector> |
+ |
+#include "third_party/base/ptr_util.h" |
CXFA_FMParse::CXFA_FMParse() : m_pToken(nullptr), m_pErrorInfo(0) {} |
@@ -989,7 +992,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForExpression() { |
CXFA_FMExpression* CXFA_FMParse::ParseForeachExpression() { |
std::unique_ptr<CXFA_FMExpression> e; |
CFX_WideStringC wsIdentifier; |
- std::unique_ptr<CFX_ArrayTemplate<CXFA_FMSimpleExpression*>> pAccessors; |
+ std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> pAccessors; |
std::unique_ptr<CXFA_FMExpression> pList; |
uint32_t line = m_pToken->m_uLinenum; |
NextToken(); |
@@ -1008,11 +1011,10 @@ CXFA_FMExpression* CXFA_FMParse::ParseForeachExpression() { |
ws_TempString.c_str()); |
NextToken(); |
} else { |
- pAccessors.reset(new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>()); |
while (m_pToken->m_type != TOKrparen) { |
CXFA_FMSimpleExpression* s = ParseSimpleExpression(); |
Tom Sepez
2016/11/23 20:21:55
Things get cleaner if ParseSimpleExpression return
npm
2016/11/23 20:40:27
There is a long chain down. Is it ok if I do it in
|
if (s) { |
- pAccessors->Add(s); |
+ pAccessors.push_back(std::unique_ptr<CXFA_FMSimpleExpression>(s)); |
dsinclair
2016/11/23 19:38:46
pAccessors.push_back(pdfium::WrapUnique<CXFA_FMSim
npm
2016/11/23 20:40:27
Done.
|
} |
if (m_pToken->m_type == TOKcomma) { |
NextToken(); |
@@ -1026,13 +1028,8 @@ CXFA_FMExpression* CXFA_FMParse::ParseForeachExpression() { |
pList.reset(ParseBlockExpression()); |
Check(TOKendfor); |
if (m_pErrorInfo->message.IsEmpty()) { |
- e.reset(new CXFA_FMForeachExpression( |
- line, wsIdentifier, pAccessors.release(), pList.release())); |
- } else { |
- if (pAccessors) { |
- for (int i = 0; i < pAccessors->GetSize(); ++i) |
- delete static_cast<CXFA_FMSimpleExpression*>(pAccessors->GetAt(i)); |
- } |
+ e = pdfium::MakeUnique<CXFA_FMForeachExpression>( |
+ line, wsIdentifier, std::move(pAccessors), pList.release()); |
} |
return e.release(); |
} |