summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmexpression.cpp')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmexpression.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
index b2995cae4c..a3c65a2203 100644
--- a/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.cpp
@@ -362,24 +362,23 @@ bool CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& js, ReturnType type) {
WideString tmpName = IdentifierToName(m_wsVariant);
js << L"var " << tmpName << L" = null;\n";
- CFX_WideTextBuf assign_txt;
- if (!m_pAssignment->ToJavaScript(assign_txt, ReturnType::kInfered))
+ js << L"for (" << tmpName << L" = pfm_rt.get_val(";
+ if (!m_pAssignment->ToJavaScript(js, ReturnType::kInfered))
return false;
+ js << L"); ";
- CFX_WideTextBuf accessor_txt;
- if (!m_pAccessor->ToJavaScript(accessor_txt, ReturnType::kInfered))
+ js << tmpName << (m_bDirection ? kLessEqual : kGreaterEqual);
+ js << L"pfm_rt.get_val(";
+ if (!m_pAccessor->ToJavaScript(js, ReturnType::kInfered))
return false;
+ js << L"); ";
- js << L"for (" << tmpName << L" = pfm_rt.get_val(" << assign_txt << L"); ";
- js << tmpName << (m_bDirection ? kLessEqual : kGreaterEqual);
- js << L"pfm_rt.get_val(" << accessor_txt << L"); ";
js << tmpName << (m_bDirection ? kPlusEqual : kMinusEqual);
if (m_pStep) {
- CFX_WideTextBuf step_txt;
- if (!m_pStep->ToJavaScript(step_txt, ReturnType::kInfered))
+ js << L"pfm_rt.get_val(";
+ if (!m_pStep->ToJavaScript(js, ReturnType::kInfered))
return false;
-
- js << L"pfm_rt.get_val(" << step_txt << L")";
+ js << L")";
} else {
js << L"1";
}