summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2018-02-19 18:10:34 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-19 18:10:34 +0000
commit6a5b1c96e23bd684d9fec2c59e0d4bc5d883650c (patch)
treeb6ba4042b3e6ad51d240b69e3cec78891e3b583c /xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
parentc8785f736df57d7d20649d803818a30eb55b2ee8 (diff)
downloadpdfium-6a5b1c96e23bd684d9fec2c59e0d4bc5d883650c.tar.xz
Merge FormCalc to JavaScript methods
This CL merges the ToJavaScript and the ToImpliedJS methods in the FormCalc expressions. The type of return is passed as a paramter to ToJavaScript. Change-Id: Idff83677bc70b964d95aa6ff6b0e2c1bf8c603ea Reviewed-on: https://pdfium-review.googlesource.com/27210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h66
1 files changed, 42 insertions, 24 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
index 440b154d3d..e931d724cb 100644
--- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
+++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h
@@ -55,12 +55,14 @@ enum XFA_FM_AccessorIndex {
ACCESSOR_NEGATIVE_INDEX
};
+enum class ReturnType { kImplied, kInfered };
+
class CXFA_FMSimpleExpression {
public:
CXFA_FMSimpleExpression(uint32_t line, XFA_FM_TOKEN op);
virtual ~CXFA_FMSimpleExpression() {}
- virtual bool ToJavaScript(CFX_WideTextBuf& javascript);
- virtual bool ToImpliedReturnJS(CFX_WideTextBuf& javascript);
+
+ virtual bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type);
XFA_FM_TOKEN GetOperatorToken() const;
@@ -73,14 +75,16 @@ class CXFA_FMNullExpression : public CXFA_FMSimpleExpression {
public:
explicit CXFA_FMNullExpression(uint32_t line);
~CXFA_FMNullExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression {
public:
CXFA_FMNumberExpression(uint32_t line, WideStringView wsNumber);
~CXFA_FMNumberExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
WideStringView m_wsNumber;
@@ -90,7 +94,8 @@ class CXFA_FMStringExpression : public CXFA_FMSimpleExpression {
public:
CXFA_FMStringExpression(uint32_t line, WideStringView wsString);
~CXFA_FMStringExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
WideStringView m_wsString;
@@ -100,7 +105,8 @@ class CXFA_FMIdentifierExpression : public CXFA_FMSimpleExpression {
public:
CXFA_FMIdentifierExpression(uint32_t line, WideStringView wsIdentifier);
~CXFA_FMIdentifierExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
WideStringView m_wsIdentifier;
@@ -113,7 +119,7 @@ class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp);
~CXFA_FMUnaryExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
protected:
std::unique_ptr<CXFA_FMSimpleExpression> m_pExp;
@@ -127,7 +133,7 @@ class CXFA_FMBinExpression : public CXFA_FMSimpleExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMBinExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
protected:
std::unique_ptr<CXFA_FMSimpleExpression> m_pExp1;
@@ -141,8 +147,8 @@ class CXFA_FMAssignExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMAssignExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
- bool ToImpliedReturnJS(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression {
@@ -152,7 +158,8 @@ class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMLogicalOrExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression {
@@ -162,7 +169,8 @@ class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMLogicalAndExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMEqualityExpression : public CXFA_FMBinExpression {
@@ -172,7 +180,8 @@ class CXFA_FMEqualityExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMEqualityExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMRelationalExpression : public CXFA_FMBinExpression {
@@ -182,7 +191,8 @@ class CXFA_FMRelationalExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMRelationalExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMAdditiveExpression : public CXFA_FMBinExpression {
@@ -192,7 +202,8 @@ class CXFA_FMAdditiveExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMAdditiveExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMMultiplicativeExpression : public CXFA_FMBinExpression {
@@ -203,7 +214,8 @@ class CXFA_FMMultiplicativeExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pExp2);
~CXFA_FMMultiplicativeExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMPosExpression : public CXFA_FMUnaryExpression {
@@ -211,7 +223,8 @@ class CXFA_FMPosExpression : public CXFA_FMUnaryExpression {
CXFA_FMPosExpression(uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pExp);
~CXFA_FMPosExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMNegExpression : public CXFA_FMUnaryExpression {
@@ -219,7 +232,8 @@ class CXFA_FMNegExpression : public CXFA_FMUnaryExpression {
CXFA_FMNegExpression(uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pExp);
~CXFA_FMNegExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMNotExpression : public CXFA_FMUnaryExpression {
@@ -227,7 +241,8 @@ class CXFA_FMNotExpression : public CXFA_FMUnaryExpression {
CXFA_FMNotExpression(uint32_t line,
std::unique_ptr<CXFA_FMSimpleExpression> pExp);
~CXFA_FMNotExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
class CXFA_FMCallExpression : public CXFA_FMUnaryExpression {
@@ -241,7 +256,7 @@ class CXFA_FMCallExpression : public CXFA_FMUnaryExpression {
bool IsBuiltInFunc(CFX_WideTextBuf* funcName);
uint32_t IsMethodWithObjParam(const WideString& methodName);
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
bool m_bIsSomMethod;
@@ -257,7 +272,8 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression {
WideStringView wsIdentifier,
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp);
~CXFA_FMDotAccessorExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
WideStringView m_wsIdentifier;
@@ -270,7 +286,8 @@ class CXFA_FMIndexExpression : public CXFA_FMUnaryExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp,
bool bIsStarIndex);
~CXFA_FMIndexExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
XFA_FM_AccessorIndex m_accessorIndex;
@@ -287,7 +304,7 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pIndexExp);
~CXFA_FMDotDotAccessorExpression() override;
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
private:
WideStringView m_wsIdentifier;
@@ -300,7 +317,8 @@ class CXFA_FMMethodCallExpression : public CXFA_FMBinExpression {
std::unique_ptr<CXFA_FMSimpleExpression> pAccessorExp1,
std::unique_ptr<CXFA_FMSimpleExpression> pCallExp);
~CXFA_FMMethodCallExpression() override {}
- bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript, ReturnType type) override;
};
bool CXFA_IsTooBig(const CFX_WideTextBuf& javascript);