Arquivos
hhvm/hphp/compiler/expression/assignment_expression.h
T
jan 2ebb2a93a1 Eliminate {get,set}NthKid() usage with known specific kid
{get,set}NthKid() should be only used to walk thru all the kids and not to get/set a known specific kid. Replace its use by direct helper method.

All remaining callers of {get,set}NthKid() were audited and there are no instances left accessing specific kid.
2013-03-19 14:11:17 -07:00

68 linhas
2.6 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef __ASSIGNMENT_EXPRESSION_H__
#define __ASSIGNMENT_EXPRESSION_H__
#include <compiler/expression/expression.h>
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
DECLARE_BOOST_TYPES(AssignmentExpression);
struct TypedValue;
class AssignmentExpression : public Expression, public IParseHandler {
public:
AssignmentExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS,
ExpressionPtr variable, ExpressionPtr value,
bool ref);
DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS;
ExpressionPtr preOptimize(AnalysisResultConstPtr ar);
ExpressionPtr postOptimize(AnalysisResultConstPtr ar);
// implementing IParseHandler
virtual void onParseRecur(AnalysisResultConstPtr ar, ClassScopePtr scope);
virtual bool isRefable(bool checkError = false) const {
if (checkError) return true;
return m_value->isRefable() &&
(m_value->getContext() & Expression::RefValue);
}
ExpressionPtr getVariable() { return m_variable;}
ExpressionPtr getStoreVariable() const { return m_variable; }
ExpressionPtr getValue() { return m_value;}
void setVariable(ExpressionPtr v) { m_variable = v; }
void setValue(ExpressionPtr v) { m_value = v; }
int getLocalEffects() const;
// $GLOBALS[<literal-string>] = <scalar>;
bool isSimpleGlobalAssign(StringData **name, TypedValue *tv) const;
private:
ExpressionPtr optimize(AnalysisResultConstPtr ar);
ExpressionPtr m_variable;
ExpressionPtr m_value;
bool m_ref;
};
///////////////////////////////////////////////////////////////////////////////
}
#endif // __ASSIGNMENT_EXPRESSION_H__