2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_BINARY_OP_EXPRESSION_H_
18 #define incl_HPHP_BINARY_OP_EXPRESSION_H_
20 #include "hphp/compiler/expression/expression_list.h"
23 ///////////////////////////////////////////////////////////////////////////////
25 DECLARE_BOOST_TYPES(BinaryOpExpression
);
27 class BinaryOpExpression
: public Expression
{
29 BinaryOpExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS
,
30 ExpressionPtr exp1
, ExpressionPtr exp2
, int op
);
32 DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS
;
33 ExpressionPtr
preOptimize(AnalysisResultConstPtr ar
);
34 ExpressionPtr
postOptimize(AnalysisResultConstPtr ar
);
35 virtual bool isTemporary() const;
36 virtual int getLocalEffects() const;
37 virtual bool isLiteralString() const;
38 virtual std::string
getLiteralString() const;
39 virtual bool containsDynamicConstant(AnalysisResultPtr ar
) const;
41 virtual bool isRefable(bool checkError
= false) const;
42 bool isShortCircuitOperator() const;
43 bool isLogicalOrOperator() const;
44 ExpressionPtr
getStoreVariable() const { return m_exp1
;}
45 ExpressionPtr
getExp1() { return m_exp1
;}
46 ExpressionPtr
getExp2() { return m_exp2
;}
47 int getOp() const { return m_op
;}
49 ExpressionPtr
foldConst(AnalysisResultConstPtr ar
);
50 ExpressionPtr
foldRightAssoc(AnalysisResultConstPtr ar
);
52 virtual ExpressionPtr
unneededHelper();
53 virtual bool canonCompare(ExpressionPtr e
) const;
55 static int getConcatList(ExpressionPtrVec
&ev
, ExpressionPtr exp
,
57 bool isAssignmentOp() const { return m_assign
; }
60 void optimizeTypes(AnalysisResultConstPtr ar
);
61 ExpressionPtr
simplifyLogical(AnalysisResultConstPtr ar
);
62 ExpressionPtr
simplifyArithmetic(AnalysisResultConstPtr ar
);
68 mutable bool m_canThrow
;
71 ///////////////////////////////////////////////////////////////////////////////
74 #endif // incl_HPHP_BINARY_OP_EXPRESSION_H_