| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assert.h" | 9 #include "vm/assert.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 11 #include "vm/ic_data.h" | 11 #include "vm/ic_data.h" |
| 12 #include "vm/scopes.h" | 12 #include "vm/scopes.h" |
| 13 #include "vm/object.h" | 13 #include "vm/object.h" |
| 14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
| 15 #include "vm/token.h" | 15 #include "vm/token.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 | 18 |
| 19 #define NODE_LIST(V) \ | 19 #define NODE_LIST(V) \ |
| 20 V(ReturnNode, "return") \ | 20 V(ReturnNode, "return") \ |
| 21 V(LiteralNode, "literal") \ | 21 V(LiteralNode, "literal") \ |
| 22 V(TypeNode, "type") \ | 22 V(TypeNode, "type") \ |
| 23 V(AssignableNode, "assignable") \ |
| 23 V(BinaryOpNode, "binop") \ | 24 V(BinaryOpNode, "binop") \ |
| 24 V(StringConcatNode, "concat") \ | 25 V(StringConcatNode, "concat") \ |
| 25 V(ComparisonNode, "compare") \ | 26 V(ComparisonNode, "compare") \ |
| 26 V(UnaryOpNode, "unaryop") \ | 27 V(UnaryOpNode, "unaryop") \ |
| 27 V(IncrOpLocalNode, "incr local") \ | 28 V(IncrOpLocalNode, "incr local") \ |
| 28 V(IncrOpInstanceFieldNode, "incr instance field") \ | 29 V(IncrOpInstanceFieldNode, "incr instance field") \ |
| 29 V(IncrOpStaticFieldNode, "incr static field") \ | 30 V(IncrOpStaticFieldNode, "incr static field") \ |
| 30 V(IncrOpIndexedNode, "incr indexed") \ | 31 V(IncrOpIndexedNode, "incr indexed") \ |
| 31 V(ConditionalExprNode, "?:") \ | 32 V(ConditionalExprNode, "?:") \ |
| 32 V(IfNode, "if") \ | 33 V(IfNode, "if") \ |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 366 |
| 366 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); | 367 DECLARE_COMMON_NODE_FUNCTIONS(TypeNode); |
| 367 | 368 |
| 368 private: | 369 private: |
| 369 const Type& type_; | 370 const Type& type_; |
| 370 | 371 |
| 371 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); | 372 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); |
| 372 }; | 373 }; |
| 373 | 374 |
| 374 | 375 |
| 376 class AssignableNode : public AstNode { |
| 377 public: |
| 378 AssignableNode(intptr_t token_index, |
| 379 AstNode* expr, |
| 380 const Type& type, |
| 381 const String& dst_name) |
| 382 : AstNode(token_index), expr_(expr), type_(type), dst_name_(dst_name) { |
| 383 ASSERT(expr_ != NULL); |
| 384 ASSERT(type_.IsZoneHandle()); |
| 385 ASSERT(!type_.IsNull()); |
| 386 ASSERT(type_.IsFinalized()); |
| 387 ASSERT(dst_name_.IsZoneHandle()); |
| 388 } |
| 389 |
| 390 AstNode* expr() const { return expr_; } |
| 391 const Type& type() const { return type_; } |
| 392 const String& dst_name() const { return dst_name_; } |
| 393 |
| 394 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 395 expr()->Visit(visitor); |
| 396 } |
| 397 |
| 398 DECLARE_COMMON_NODE_FUNCTIONS(AssignableNode); |
| 399 |
| 400 private: |
| 401 AstNode* expr_; |
| 402 const Type& type_; |
| 403 const String& dst_name_; |
| 404 |
| 405 DISALLOW_IMPLICIT_CONSTRUCTORS(AssignableNode); |
| 406 }; |
| 407 |
| 408 |
| 375 class ClosureNode : public AstNode { | 409 class ClosureNode : public AstNode { |
| 376 public: | 410 public: |
| 377 ClosureNode(intptr_t token_index, | 411 ClosureNode(intptr_t token_index, |
| 378 const Function& function, | 412 const Function& function, |
| 379 AstNode* receiver, // Non-null for implicit instance closures. | 413 AstNode* receiver, // Non-null for implicit instance closures. |
| 380 LocalScope* scope) // Null for implicit closures. | 414 LocalScope* scope) // Null for implicit closures. |
| 381 : AstNode(token_index), | 415 : AstNode(token_index), |
| 382 function_(function), | 416 function_(function), |
| 383 receiver_(receiver), | 417 receiver_(receiver), |
| 384 scope_(scope) { | 418 scope_(scope) { |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 const LocalVariable& context_var_; | 1913 const LocalVariable& context_var_; |
| 1880 | 1914 |
| 1881 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1915 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1882 }; | 1916 }; |
| 1883 | 1917 |
| 1884 } // namespace dart | 1918 } // namespace dart |
| 1885 | 1919 |
| 1886 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1920 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1887 | 1921 |
| 1888 #endif // VM_AST_H_ | 1922 #endif // VM_AST_H_ |
| OLD | NEW |