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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 public: | 367 public: |
368 AssignableNode(intptr_t token_pos, | 368 AssignableNode(intptr_t token_pos, |
369 AstNode* expr, | 369 AstNode* expr, |
370 const AbstractType& type, | 370 const AbstractType& type, |
371 const String& dst_name) | 371 const String& dst_name) |
372 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { | 372 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { |
373 ASSERT(expr_ != NULL); | 373 ASSERT(expr_ != NULL); |
374 ASSERT(type_.IsZoneHandle()); | 374 ASSERT(type_.IsZoneHandle()); |
375 ASSERT(!type_.IsNull()); | 375 ASSERT(!type_.IsNull()); |
376 ASSERT(type_.IsFinalized()); | 376 ASSERT(type_.IsFinalized()); |
377 ASSERT(dst_name_.IsZoneHandle()); | 377 ASSERT(dst_name_.IsNotTemporaryScopedHandle()); |
378 } | 378 } |
379 | 379 |
380 AstNode* expr() const { return expr_; } | 380 AstNode* expr() const { return expr_; } |
381 const AbstractType& type() const { return type_; } | 381 const AbstractType& type() const { return type_; } |
382 const String& dst_name() const { return dst_name_; } | 382 const String& dst_name() const { return dst_name_; } |
383 | 383 |
384 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 384 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
385 expr()->Visit(visitor); | 385 expr()->Visit(visitor); |
386 } | 386 } |
387 | 387 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 | 442 |
443 // Primary nodes hold identifiers or values (library, class or function) | 443 // Primary nodes hold identifiers or values (library, class or function) |
444 // resolved from an identifier. Primary nodes should not ever make it to the | 444 // resolved from an identifier. Primary nodes should not ever make it to the |
445 // code generation phase as they will be transformed into the correct call or | 445 // code generation phase as they will be transformed into the correct call or |
446 // field access nodes. | 446 // field access nodes. |
447 class PrimaryNode : public AstNode { | 447 class PrimaryNode : public AstNode { |
448 public: | 448 public: |
449 PrimaryNode(intptr_t token_pos, const Object& primary) | 449 PrimaryNode(intptr_t token_pos, const Object& primary) |
450 : AstNode(token_pos), primary_(primary) { | 450 : AstNode(token_pos), primary_(primary) { |
451 ASSERT(primary_.IsZoneHandle()); | 451 ASSERT(primary_.IsNotTemporaryScopedHandle()); |
452 } | 452 } |
453 | 453 |
454 const Object& primary() const { return primary_; } | 454 const Object& primary() const { return primary_; } |
455 | 455 |
456 bool IsSuper() const { | 456 bool IsSuper() const { |
457 return primary().IsString() && (primary().raw() == Symbols::Super()); | 457 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); |
458 } | 458 } |
459 | 459 |
460 virtual void VisitChildren(AstNodeVisitor* visitor) const; | 460 virtual void VisitChildren(AstNodeVisitor* visitor) const; |
461 | 461 |
462 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); | 462 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); |
463 | 463 |
464 private: | 464 private: |
465 const Object& primary_; | 465 const Object& primary_; |
466 | 466 |
467 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); | 467 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 public: | 1194 public: |
1195 InstanceCallNode(intptr_t token_pos, | 1195 InstanceCallNode(intptr_t token_pos, |
1196 AstNode* receiver, | 1196 AstNode* receiver, |
1197 const String& function_name, | 1197 const String& function_name, |
1198 ArgumentListNode* arguments) | 1198 ArgumentListNode* arguments) |
1199 : AstNode(token_pos), | 1199 : AstNode(token_pos), |
1200 receiver_(receiver), | 1200 receiver_(receiver), |
1201 function_name_(function_name), | 1201 function_name_(function_name), |
1202 arguments_(arguments) { | 1202 arguments_(arguments) { |
1203 ASSERT(receiver_ != NULL); | 1203 ASSERT(receiver_ != NULL); |
1204 ASSERT(function_name_.IsZoneHandle()); | 1204 ASSERT(function_name_.IsNotTemporaryScopedHandle()); |
1205 ASSERT(function_name_.IsSymbol()); | 1205 ASSERT(function_name_.IsSymbol()); |
1206 ASSERT(arguments_ != NULL); | 1206 ASSERT(arguments_ != NULL); |
1207 } | 1207 } |
1208 | 1208 |
1209 AstNode* receiver() const { return receiver_; } | 1209 AstNode* receiver() const { return receiver_; } |
1210 const String& function_name() const { return function_name_; } | 1210 const String& function_name() const { return function_name_; } |
1211 ArgumentListNode* arguments() const { return arguments_; } | 1211 ArgumentListNode* arguments() const { return arguments_; } |
1212 | 1212 |
1213 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1213 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1214 receiver()->Visit(visitor); | 1214 receiver()->Visit(visitor); |
(...skipping 13 matching lines...) Expand all Loading... |
1228 | 1228 |
1229 class InstanceGetterNode : public AstNode { | 1229 class InstanceGetterNode : public AstNode { |
1230 public: | 1230 public: |
1231 InstanceGetterNode(intptr_t token_pos, | 1231 InstanceGetterNode(intptr_t token_pos, |
1232 AstNode* receiver, | 1232 AstNode* receiver, |
1233 const String& field_name) | 1233 const String& field_name) |
1234 : AstNode(token_pos), | 1234 : AstNode(token_pos), |
1235 receiver_(receiver), | 1235 receiver_(receiver), |
1236 field_name_(field_name) { | 1236 field_name_(field_name) { |
1237 ASSERT(receiver_ != NULL); | 1237 ASSERT(receiver_ != NULL); |
1238 ASSERT(field_name_.IsZoneHandle()); | 1238 ASSERT(field_name_.IsNotTemporaryScopedHandle()); |
1239 ASSERT(field_name_.IsSymbol()); | 1239 ASSERT(field_name_.IsSymbol()); |
1240 } | 1240 } |
1241 | 1241 |
1242 AstNode* receiver() const { return receiver_; } | 1242 AstNode* receiver() const { return receiver_; } |
1243 const String& field_name() const { return field_name_; } | 1243 const String& field_name() const { return field_name_; } |
1244 | 1244 |
1245 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1245 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1246 receiver()->Visit(visitor); | 1246 receiver()->Visit(visitor); |
1247 } | 1247 } |
1248 | 1248 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 const LocalVariable& context_var_; | 1699 const LocalVariable& context_var_; |
1700 | 1700 |
1701 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1701 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1702 }; | 1702 }; |
1703 | 1703 |
1704 } // namespace dart | 1704 } // namespace dart |
1705 | 1705 |
1706 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1706 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1707 | 1707 |
1708 #endif // VM_AST_H_ | 1708 #endif // VM_AST_H_ |
OLD | NEW |