OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 virtual TargetCollector* AsTargetCollector() { return NULL; } | 132 virtual TargetCollector* AsTargetCollector() { return NULL; } |
133 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 133 virtual BreakableStatement* AsBreakableStatement() { return NULL; } |
134 virtual IterationStatement* AsIterationStatement() { return NULL; } | 134 virtual IterationStatement* AsIterationStatement() { return NULL; } |
135 virtual UnaryOperation* AsUnaryOperation() { return NULL; } | 135 virtual UnaryOperation* AsUnaryOperation() { return NULL; } |
136 virtual BinaryOperation* AsBinaryOperation() { return NULL; } | 136 virtual BinaryOperation* AsBinaryOperation() { return NULL; } |
137 virtual Assignment* AsAssignment() { return NULL; } | 137 virtual Assignment* AsAssignment() { return NULL; } |
138 virtual FunctionLiteral* AsFunctionLiteral() { return NULL; } | 138 virtual FunctionLiteral* AsFunctionLiteral() { return NULL; } |
139 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 139 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } |
140 virtual ObjectLiteral* AsObjectLiteral() { return NULL; } | 140 virtual ObjectLiteral* AsObjectLiteral() { return NULL; } |
141 virtual ArrayLiteral* AsArrayLiteral() { return NULL; } | 141 virtual ArrayLiteral* AsArrayLiteral() { return NULL; } |
| 142 virtual CompareOperation* AsCompareOperation() { return NULL; } |
142 }; | 143 }; |
143 | 144 |
144 | 145 |
145 class Statement: public AstNode { | 146 class Statement: public AstNode { |
146 public: | 147 public: |
147 Statement() : statement_pos_(RelocInfo::kNoPosition) {} | 148 Statement() : statement_pos_(RelocInfo::kNoPosition) {} |
148 | 149 |
149 virtual Statement* AsStatement() { return this; } | 150 virtual Statement* AsStatement() { return this; } |
150 virtual ReturnStatement* AsReturnStatement() { return NULL; } | 151 virtual ReturnStatement* AsReturnStatement() { return NULL; } |
151 | 152 |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 private: | 1179 private: |
1179 bool is_prefix_; | 1180 bool is_prefix_; |
1180 Token::Value op_; | 1181 Token::Value op_; |
1181 Expression* expression_; | 1182 Expression* expression_; |
1182 }; | 1183 }; |
1183 | 1184 |
1184 | 1185 |
1185 class CompareOperation: public Expression { | 1186 class CompareOperation: public Expression { |
1186 public: | 1187 public: |
1187 CompareOperation(Token::Value op, Expression* left, Expression* right) | 1188 CompareOperation(Token::Value op, Expression* left, Expression* right) |
1188 : op_(op), left_(left), right_(right) { | 1189 : op_(op), left_(left), right_(right), is_for_loop_condition_(false) { |
1189 ASSERT(Token::IsCompareOp(op)); | 1190 ASSERT(Token::IsCompareOp(op)); |
1190 } | 1191 } |
1191 | 1192 |
1192 virtual void Accept(AstVisitor* v); | 1193 virtual void Accept(AstVisitor* v); |
1193 | 1194 |
1194 Token::Value op() const { return op_; } | 1195 Token::Value op() const { return op_; } |
1195 Expression* left() const { return left_; } | 1196 Expression* left() const { return left_; } |
1196 Expression* right() const { return right_; } | 1197 Expression* right() const { return right_; } |
1197 | 1198 |
| 1199 // Accessors for flag whether this compare operation is hanging of a for loop. |
| 1200 bool is_for_loop_condition() const { return is_for_loop_condition_; } |
| 1201 void set_is_for_loop_condition() { is_for_loop_condition_ = true; } |
| 1202 |
| 1203 // Type testing & conversion |
| 1204 virtual CompareOperation* AsCompareOperation() { return this; } |
| 1205 |
1198 private: | 1206 private: |
1199 Token::Value op_; | 1207 Token::Value op_; |
1200 Expression* left_; | 1208 Expression* left_; |
1201 Expression* right_; | 1209 Expression* right_; |
| 1210 bool is_for_loop_condition_; |
1202 }; | 1211 }; |
1203 | 1212 |
1204 | 1213 |
1205 class Conditional: public Expression { | 1214 class Conditional: public Expression { |
1206 public: | 1215 public: |
1207 Conditional(Expression* condition, | 1216 Conditional(Expression* condition, |
1208 Expression* then_expression, | 1217 Expression* then_expression, |
1209 Expression* else_expression) | 1218 Expression* else_expression) |
1210 : condition_(condition), | 1219 : condition_(condition), |
1211 then_expression_(then_expression), | 1220 then_expression_(then_expression), |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 #undef DEF_VISIT | 1792 #undef DEF_VISIT |
1784 | 1793 |
1785 private: | 1794 private: |
1786 bool stack_overflow_; | 1795 bool stack_overflow_; |
1787 }; | 1796 }; |
1788 | 1797 |
1789 | 1798 |
1790 } } // namespace v8::internal | 1799 } } // namespace v8::internal |
1791 | 1800 |
1792 #endif // V8_AST_H_ | 1801 #endif // V8_AST_H_ |
OLD | NEW |