OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_AST_H_ | 5 #ifndef VM_AST_H_ |
6 #define VM_AST_H_ | 6 #define VM_AST_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 V(UnaryOpNode, "unaryop") \ | 25 V(UnaryOpNode, "unaryop") \ |
26 V(ConditionalExprNode, "?:") \ | 26 V(ConditionalExprNode, "?:") \ |
27 V(IfNode, "if") \ | 27 V(IfNode, "if") \ |
28 V(SwitchNode, "switch") \ | 28 V(SwitchNode, "switch") \ |
29 V(CaseNode, "case") \ | 29 V(CaseNode, "case") \ |
30 V(WhileNode, "while") \ | 30 V(WhileNode, "while") \ |
31 V(DoWhileNode, "dowhile") \ | 31 V(DoWhileNode, "dowhile") \ |
32 V(ForNode, "for") \ | 32 V(ForNode, "for") \ |
33 V(JumpNode, "jump") \ | 33 V(JumpNode, "jump") \ |
34 V(ArgumentListNode, "args") \ | 34 V(ArgumentListNode, "args") \ |
| 35 V(ArgumentDefinitionTestNode, "defined") \ |
35 V(ArrayNode, "array") \ | 36 V(ArrayNode, "array") \ |
36 V(ClosureNode, "closure") \ | 37 V(ClosureNode, "closure") \ |
37 V(InstanceCallNode, "instance call") \ | 38 V(InstanceCallNode, "instance call") \ |
38 V(StaticCallNode, "static call") \ | 39 V(StaticCallNode, "static call") \ |
39 V(ClosureCallNode, "closure call") \ | 40 V(ClosureCallNode, "closure call") \ |
40 V(CloneContextNode, "clone context") \ | 41 V(CloneContextNode, "clone context") \ |
41 V(ConstructorCallNode, "constructor call") \ | 42 V(ConstructorCallNode, "constructor call") \ |
42 V(InstanceGetterNode, "instance getter call") \ | 43 V(InstanceGetterNode, "instance getter call") \ |
43 V(InstanceSetterNode, "instance setter call") \ | 44 V(InstanceSetterNode, "instance setter call") \ |
44 V(StaticGetterNode, "static getter") \ | 45 V(StaticGetterNode, "static getter") \ |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode); | 238 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode); |
238 | 239 |
239 private: | 240 private: |
240 GrowableArray<AstNode*> nodes_; | 241 GrowableArray<AstNode*> nodes_; |
241 Array& names_; | 242 Array& names_; |
242 | 243 |
243 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); | 244 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); |
244 }; | 245 }; |
245 | 246 |
246 | 247 |
| 248 class ArgumentDefinitionTestNode : public AstNode { |
| 249 public: |
| 250 ArgumentDefinitionTestNode(intptr_t token_pos, |
| 251 intptr_t formal_parameter_index, |
| 252 const String& formal_parameter_name, |
| 253 LocalVariable* saved_arguments_descriptor) |
| 254 : AstNode(token_pos), |
| 255 formal_parameter_index_(formal_parameter_index), |
| 256 formal_parameter_name_(formal_parameter_name), |
| 257 saved_arguments_descriptor_(*saved_arguments_descriptor) { |
| 258 ASSERT(formal_parameter_index_ >= 0); |
| 259 ASSERT(formal_parameter_name_.IsZoneHandle()); |
| 260 ASSERT(formal_parameter_name_.IsSymbol()); |
| 261 ASSERT(saved_arguments_descriptor != NULL); |
| 262 } |
| 263 |
| 264 virtual void VisitChildren(AstNodeVisitor* visitor) const { } |
| 265 |
| 266 intptr_t formal_parameter_index() const { return formal_parameter_index_; } |
| 267 const String& formal_parameter_name() const { return formal_parameter_name_; } |
| 268 const LocalVariable& saved_arguments_descriptor() const { |
| 269 return saved_arguments_descriptor_; |
| 270 } |
| 271 |
| 272 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentDefinitionTestNode); |
| 273 |
| 274 private: |
| 275 const intptr_t formal_parameter_index_; |
| 276 const String& formal_parameter_name_; |
| 277 const LocalVariable& saved_arguments_descriptor_; |
| 278 |
| 279 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestNode); |
| 280 }; |
| 281 |
| 282 |
247 class ArrayNode : public AstNode { | 283 class ArrayNode : public AstNode { |
248 public: | 284 public: |
249 ArrayNode(intptr_t token_pos, const AbstractType& type) | 285 ArrayNode(intptr_t token_pos, const AbstractType& type) |
250 : AstNode(token_pos), | 286 : AstNode(token_pos), |
251 type_(type), | 287 type_(type), |
252 elements_() { | 288 elements_() { |
253 ASSERT(type_.IsZoneHandle()); | 289 ASSERT(type_.IsZoneHandle()); |
254 ASSERT(!type_.IsNull()); | 290 ASSERT(!type_.IsNull()); |
255 ASSERT(type_.IsFinalized()); | 291 ASSERT(type_.IsFinalized()); |
256 } | 292 } |
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 const LocalVariable& context_var_; | 1687 const LocalVariable& context_var_; |
1652 | 1688 |
1653 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1689 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1654 }; | 1690 }; |
1655 | 1691 |
1656 } // namespace dart | 1692 } // namespace dart |
1657 | 1693 |
1658 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1694 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1659 | 1695 |
1660 #endif // VM_AST_H_ | 1696 #endif // VM_AST_H_ |
OLD | NEW |