summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_simpleexpression.cpp')
-rw-r--r--xfa/fxfa/fm2js/xfa_simpleexpression.cpp125
1 files changed, 71 insertions, 54 deletions
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
index e52cd88979..342fe9f06c 100644
--- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
+++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp
@@ -209,30 +209,35 @@ void CXFA_FMIdentifierExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << tempStr;
}
-CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(uint32_t line,
- XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp)
- : CXFA_FMSimpleExpression(line, op), m_pExp(pExp) {}
+CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(
+ uint32_t line,
+ XFA_FM_TOKEN op,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp)
+ : CXFA_FMSimpleExpression(line, op), m_pExp(std::move(pExp)) {}
CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() {}
void CXFA_FMUnaryExpression::ToJavaScript(CFX_WideTextBuf& javascript) {}
-CXFA_FMBinExpression::CXFA_FMBinExpression(uint32_t line,
- XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMSimpleExpression(line, op), m_pExp1(pExp1), m_pExp2(pExp2) {}
+CXFA_FMBinExpression::CXFA_FMBinExpression(
+ uint32_t line,
+ XFA_FM_TOKEN op,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMSimpleExpression(line, op),
+ m_pExp1(std::move(pExp1)),
+ m_pExp2(std::move(pExp2)) {}
CXFA_FMBinExpression::~CXFA_FMBinExpression() {}
void CXFA_FMBinExpression::ToJavaScript(CFX_WideTextBuf& javascript) {}
-CXFA_FMAssignExpression::CXFA_FMAssignExpression(uint32_t line,
- XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+CXFA_FMAssignExpression::CXFA_FMAssignExpression(
+ uint32_t line,
+ XFA_FM_TOKEN op,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMAssignExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L"if (");
@@ -297,9 +302,9 @@ void CXFA_FMAssignExpression::ToImpliedReturnJS(CFX_WideTextBuf& javascript) {
CXFA_FMLogicalOrExpression::CXFA_FMLogicalOrExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMLogicalOrExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << gs_lpStrExpFuncName[LOGICALOR];
@@ -313,9 +318,9 @@ void CXFA_FMLogicalOrExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMLogicalAndExpression::CXFA_FMLogicalAndExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMLogicalAndExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << gs_lpStrExpFuncName[LOGICALAND];
@@ -329,9 +334,9 @@ void CXFA_FMLogicalAndExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMEqualityExpression::CXFA_FMEqualityExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMEqualityExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
switch (m_op) {
@@ -357,9 +362,9 @@ void CXFA_FMEqualityExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMRelationalExpression::CXFA_FMRelationalExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMRelationalExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
switch (m_op) {
@@ -393,9 +398,9 @@ void CXFA_FMRelationalExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMAdditiveExpression::CXFA_FMAdditiveExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMAdditiveExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
switch (m_op) {
@@ -419,9 +424,9 @@ void CXFA_FMAdditiveExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMMultiplicativeExpression::CXFA_FMMultiplicativeExpression(
uint32_t line,
XFA_FM_TOKEN op,
- CXFA_FMSimpleExpression* pExp1,
- CXFA_FMSimpleExpression* pExp2)
- : CXFA_FMBinExpression(line, op, pExp1, pExp2) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp2)
+ : CXFA_FMBinExpression(line, op, std::move(pExp1), std::move(pExp2)) {}
void CXFA_FMMultiplicativeExpression::ToJavaScript(
CFX_WideTextBuf& javascript) {
@@ -443,9 +448,10 @@ void CXFA_FMMultiplicativeExpression::ToJavaScript(
javascript << FX_WSTRC(L")");
}
-CXFA_FMPosExpression::CXFA_FMPosExpression(uint32_t line,
- CXFA_FMSimpleExpression* pExp)
- : CXFA_FMUnaryExpression(line, TOKplus, pExp) {}
+CXFA_FMPosExpression::CXFA_FMPosExpression(
+ uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp)
+ : CXFA_FMUnaryExpression(line, TOKplus, std::move(pExp)) {}
void CXFA_FMPosExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << gs_lpStrExpFuncName[POSITIVE];
@@ -454,9 +460,10 @@ void CXFA_FMPosExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L")");
}
-CXFA_FMNegExpression::CXFA_FMNegExpression(uint32_t line,
- CXFA_FMSimpleExpression* pExp)
- : CXFA_FMUnaryExpression(line, TOKminus, pExp) {}
+CXFA_FMNegExpression::CXFA_FMNegExpression(
+ uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp)
+ : CXFA_FMUnaryExpression(line, TOKminus, std::move(pExp)) {}
void CXFA_FMNegExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << gs_lpStrExpFuncName[NEGATIVE];
@@ -465,9 +472,10 @@ void CXFA_FMNegExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L")");
}
-CXFA_FMNotExpression::CXFA_FMNotExpression(uint32_t line,
- CXFA_FMSimpleExpression* pExp)
- : CXFA_FMUnaryExpression(line, TOKksnot, pExp) {}
+CXFA_FMNotExpression::CXFA_FMNotExpression(
+ uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp)
+ : CXFA_FMUnaryExpression(line, TOKksnot, std::move(pExp)) {}
void CXFA_FMNotExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << gs_lpStrExpFuncName[NOT];
@@ -478,10 +486,10 @@ void CXFA_FMNotExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMCallExpression::CXFA_FMCallExpression(
uint32_t line,
- CXFA_FMSimpleExpression* pExp,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExp,
std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pArguments,
bool bIsSomMethod)
- : CXFA_FMUnaryExpression(line, TOKcall, pExp),
+ : CXFA_FMUnaryExpression(line, TOKcall, std::move(pExp)),
m_bIsSomMethod(bIsSomMethod),
m_Arguments(std::move(pArguments)) {}
@@ -611,11 +619,14 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression(
uint32_t line,
- CXFA_FMSimpleExpression* pAccessor,
+ std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
CFX_WideStringC wsIdentifier,
- CXFA_FMSimpleExpression* pIndexExp)
- : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp),
+ std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp)
+ : CXFA_FMBinExpression(line,
+ op,
+ std::move(pAccessor),
+ std::move(pIndexExp)),
m_wsIdentifier(wsIdentifier) {}
CXFA_FMDotAccessorExpression::~CXFA_FMDotAccessorExpression() {}
@@ -654,9 +665,9 @@ void CXFA_FMDotAccessorExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMIndexExpression::CXFA_FMIndexExpression(
uint32_t line,
XFA_FM_AccessorIndex accessorIndex,
- CXFA_FMSimpleExpression* pIndexExp,
+ std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp,
bool bIsStarIndex)
- : CXFA_FMUnaryExpression(line, TOKlbracket, pIndexExp),
+ : CXFA_FMUnaryExpression(line, TOKlbracket, std::move(pIndexExp)),
m_accessorIndex(accessorIndex),
m_bIsStarIndex(bIsStarIndex) {}
@@ -689,11 +700,14 @@ void CXFA_FMIndexExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression(
uint32_t line,
- CXFA_FMSimpleExpression* pAccessor,
+ std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
XFA_FM_TOKEN op,
CFX_WideStringC wsIdentifier,
- CXFA_FMSimpleExpression* pIndexExp)
- : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp),
+ std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp)
+ : CXFA_FMBinExpression(line,
+ op,
+ std::move(pAccessor),
+ std::move(pIndexExp)),
m_wsIdentifier(wsIdentifier) {}
CXFA_FMDotDotAccessorExpression::~CXFA_FMDotDotAccessorExpression() {}
@@ -718,9 +732,12 @@ void CXFA_FMDotDotAccessorExpression::ToJavaScript(
CXFA_FMMethodCallExpression::CXFA_FMMethodCallExpression(
uint32_t line,
- CXFA_FMSimpleExpression* pAccessorExp1,
- CXFA_FMSimpleExpression* pCallExp)
- : CXFA_FMBinExpression(line, TOKdot, pAccessorExp1, pCallExp) {}
+ std::unique_ptr<CXFA_FMSimpleExpression> pAccessorExp1,
+ std::unique_ptr<CXFA_FMSimpleExpression> pCallExp)
+ : CXFA_FMBinExpression(line,
+ TOKdot,
+ std::move(pAccessorExp1),
+ std::move(pCallExp)) {}
void CXFA_FMMethodCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) {
javascript << FX_WSTRC(L"(\nfunction ()\n{\n");