2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present 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 #include "hphp/compiler/statement/break_statement.h"
18 #include "hphp/compiler/expression/scalar_expression.h"
22 ///////////////////////////////////////////////////////////////////////////////
23 // constructors/destructors
25 BreakStatement::BreakStatement
26 (STATEMENT_CONSTRUCTOR_BASE_PARAMETERS
, uint64_t depth
)
27 : Statement(STATEMENT_CONSTRUCTOR_BASE_PARAMETER_VALUES
),
32 BreakStatement::BreakStatement
33 (STATEMENT_CONSTRUCTOR_PARAMETERS
, uint64_t depth
)
34 : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES(BreakStatement
)),
39 StatementPtr
BreakStatement::clone() {
40 BreakStatementPtr
stmt(new BreakStatement(*this));
41 stmt
->m_depth
= m_depth
;
42 stmt
->m_name
= m_name
;
46 ///////////////////////////////////////////////////////////////////////////////
49 ///////////////////////////////////////////////////////////////////////////////
50 // static analysis functions
52 void BreakStatement::analyzeProgram(AnalysisResultPtr ar
) {
55 ConstructPtr
BreakStatement::getNthKid(int n
) const {
59 int BreakStatement::getKidCount() const {
63 void BreakStatement::setNthKid(int n
, ConstructPtr cp
) {
67 uint64_t BreakStatement::getDepth() {
71 StatementPtr
BreakStatement::preOptimize(AnalysisResultConstPtr ar
) {
72 return StatementPtr();
75 ///////////////////////////////////////////////////////////////////////////////
76 // code generation functions
78 void BreakStatement::outputPHP(CodeGenerator
&cg
, AnalysisResultPtr ar
) {
80 cg_printf("%s %" PRIu64
";\n", m_name
, m_depth
);
82 cg_printf("%s;\n", m_name
);