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_expression.h" | 7 #include "xfa/fxfa/fm2js/xfa_expression.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_basic.h" | 9 #include "core/fxcrt/include/fx_basic.h" |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line, | 116 CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line, |
117 const CFX_WideStringC& wsName, | 117 const CFX_WideStringC& wsName, |
118 CXFA_FMExpression* pInit) | 118 CXFA_FMExpression* pInit) |
119 : CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR), | 119 : CXFA_FMExpression(line, XFA_FM_EXPTYPE_VAR), |
120 m_wsName(wsName), | 120 m_wsName(wsName), |
121 m_pInit(pInit) {} | 121 m_pInit(pInit) {} |
122 | 122 |
123 void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { | 123 void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { |
124 javascript << FX_WSTRC(L"var "); | 124 javascript << FX_WSTRC(L"var "); |
125 CFX_WideString tempName = m_wsName; | 125 CFX_WideString tempName(m_wsName); |
126 if (m_wsName.GetAt(0) == L'!') { | 126 if (m_wsName.GetAt(0) == L'!') { |
127 tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); | 127 tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); |
128 } | 128 } |
129 javascript << tempName; | 129 javascript << tempName; |
130 javascript << FX_WSTRC(L" = "); | 130 javascript << FX_WSTRC(L" = "); |
131 if (m_pInit) { | 131 if (m_pInit) { |
132 m_pInit->ToJavaScript(javascript); | 132 m_pInit->ToJavaScript(javascript); |
133 javascript << tempName; | 133 javascript << tempName; |
134 javascript << FX_WSTRC(L" = "); | 134 javascript << FX_WSTRC(L" = "); |
135 javascript << XFA_FM_EXPTypeToString(VARFILTER); | 135 javascript << XFA_FM_EXPTypeToString(VARFILTER); |
136 javascript << FX_WSTRC(L"("); | 136 javascript << FX_WSTRC(L"("); |
137 javascript << tempName; | 137 javascript << tempName; |
138 javascript << FX_WSTRC(L");\n"); | 138 javascript << FX_WSTRC(L");\n"); |
139 } else { | 139 } else { |
140 javascript << FX_WSTRC(L"\"\";\n"); | 140 javascript << FX_WSTRC(L"\"\";\n"); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 void CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { | 144 void CXFA_FMVarExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) { |
145 javascript << FX_WSTRC(L"var "); | 145 javascript << FX_WSTRC(L"var "); |
146 CFX_WideString tempName = m_wsName; | 146 CFX_WideString tempName(m_wsName); |
147 if (m_wsName.GetAt(0) == L'!') { | 147 if (m_wsName.GetAt(0) == L'!') { |
148 tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); | 148 tempName = EXCLAMATION_IN_IDENTIFIER + m_wsName.Mid(1); |
149 } | 149 } |
150 javascript << tempName; | 150 javascript << tempName; |
151 javascript << FX_WSTRC(L" = "); | 151 javascript << FX_WSTRC(L" = "); |
152 if (m_pInit) { | 152 if (m_pInit) { |
153 m_pInit->ToJavaScript(javascript); | 153 m_pInit->ToJavaScript(javascript); |
154 javascript << tempName; | 154 javascript << tempName; |
155 javascript << FX_WSTRC(L" = "); | 155 javascript << FX_WSTRC(L" = "); |
156 javascript << XFA_FM_EXPTypeToString(VARFILTER); | 156 javascript << XFA_FM_EXPTypeToString(VARFILTER); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 606 } |
607 javascript << FX_WSTRC(L" = "); | 607 javascript << FX_WSTRC(L" = "); |
608 javascript << RUNTIMEBLOCKTEMPARRAY; | 608 javascript << RUNTIMEBLOCKTEMPARRAY; |
609 javascript << FX_WSTRC(L"["); | 609 javascript << FX_WSTRC(L"["); |
610 javascript << RUNTIMEBLOCKTEMPARRAYINDEX; | 610 javascript << RUNTIMEBLOCKTEMPARRAYINDEX; |
611 javascript << FX_WSTRC(L"++];\n"); | 611 javascript << FX_WSTRC(L"++];\n"); |
612 m_pList->ToImpliedReturnJS(javascript); | 612 m_pList->ToImpliedReturnJS(javascript); |
613 javascript << FX_WSTRC(L"}\n"); | 613 javascript << FX_WSTRC(L"}\n"); |
614 javascript << FX_WSTRC(L"}\n"); | 614 javascript << FX_WSTRC(L"}\n"); |
615 } | 615 } |
OLD | NEW |