OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/fm2js/xfa_program.h" | 7 #include "xfa/fxfa/fm2js/xfa_program.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "third_party/base/ptr_util.h" | 12 #include "third_party/base/ptr_util.h" |
13 | 13 |
14 CXFA_FMProgram::CXFA_FMProgram(const CFX_WideStringC& wsFormcalc) | 14 CXFA_FMProgram::CXFA_FMProgram(const CFX_WideStringC& wsFormcalc) |
15 : m_parse(wsFormcalc, &m_pErrorInfo) {} | 15 : m_parse(wsFormcalc, &m_pErrorInfo) {} |
16 | 16 |
17 CXFA_FMProgram::~CXFA_FMProgram() {} | 17 CXFA_FMProgram::~CXFA_FMProgram() {} |
18 | 18 |
19 int32_t CXFA_FMProgram::ParseProgram() { | 19 int32_t CXFA_FMProgram::ParseProgram() { |
20 m_parse.NextToken(); | 20 m_parse.NextToken(); |
21 if (!m_pErrorInfo.message.IsEmpty()) | 21 if (!m_pErrorInfo.message.IsEmpty()) |
22 return -1; | 22 return -1; |
23 | 23 |
24 std::vector<std::unique_ptr<CXFA_FMExpression>> expressions = | 24 std::vector<std::unique_ptr<CXFA_FMExpression>> expressions = |
25 m_parse.ParseTopExpression(); | 25 m_parse.ParseTopExpression(); |
26 if (!m_pErrorInfo.message.IsEmpty()) | 26 if (!m_pErrorInfo.message.IsEmpty()) |
27 return -1; | 27 return -1; |
28 | 28 |
| 29 std::vector<CFX_WideStringC> arguments; |
29 m_globalFunction = pdfium::MakeUnique<CXFA_FMFunctionDefinition>( | 30 m_globalFunction = pdfium::MakeUnique<CXFA_FMFunctionDefinition>( |
30 1, true, L"", nullptr, std::move(expressions)); | 31 1, true, L"", std::move(arguments), std::move(expressions)); |
31 return 0; | 32 return 0; |
32 } | 33 } |
33 | 34 |
34 int32_t CXFA_FMProgram::TranslateProgram(CFX_WideTextBuf& wsJavaScript) { | 35 int32_t CXFA_FMProgram::TranslateProgram(CFX_WideTextBuf& wsJavaScript) { |
35 m_globalFunction->ToJavaScript(wsJavaScript); | 36 m_globalFunction->ToJavaScript(wsJavaScript); |
36 wsJavaScript.AppendChar(0); | 37 wsJavaScript.AppendChar(0); |
37 return 0; | 38 return 0; |
38 } | 39 } |
OLD | NEW |