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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 public: | 360 public: |
361 AssignableNode(intptr_t token_pos, | 361 AssignableNode(intptr_t token_pos, |
362 AstNode* expr, | 362 AstNode* expr, |
363 const AbstractType& type, | 363 const AbstractType& type, |
364 const String& dst_name) | 364 const String& dst_name) |
365 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { | 365 : AstNode(token_pos), expr_(expr), type_(type), dst_name_(dst_name) { |
366 ASSERT(expr_ != NULL); | 366 ASSERT(expr_ != NULL); |
367 ASSERT(type_.IsZoneHandle()); | 367 ASSERT(type_.IsZoneHandle()); |
368 ASSERT(!type_.IsNull()); | 368 ASSERT(!type_.IsNull()); |
369 ASSERT(type_.IsFinalized()); | 369 ASSERT(type_.IsFinalized()); |
370 ASSERT(dst_name_.IsZoneHandle()); | 370 ASSERT(dst_name_.IsNotTemporaryScopedHandle()); |
371 } | 371 } |
372 | 372 |
373 AstNode* expr() const { return expr_; } | 373 AstNode* expr() const { return expr_; } |
374 const AbstractType& type() const { return type_; } | 374 const AbstractType& type() const { return type_; } |
375 const String& dst_name() const { return dst_name_; } | 375 const String& dst_name() const { return dst_name_; } |
376 | 376 |
377 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 377 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
378 expr()->Visit(visitor); | 378 expr()->Visit(visitor); |
379 } | 379 } |
380 | 380 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 432 |
433 | 433 |
434 // Primary nodes hold identifiers or values (library, class or function) | 434 // Primary nodes hold identifiers or values (library, class or function) |
435 // resolved from an identifier. Primary nodes should not ever make it to the | 435 // resolved from an identifier. Primary nodes should not ever make it to the |
436 // code generation phase as they will be transformed into the correct call or | 436 // code generation phase as they will be transformed into the correct call or |
437 // field access nodes. | 437 // field access nodes. |
438 class PrimaryNode : public AstNode { | 438 class PrimaryNode : public AstNode { |
439 public: | 439 public: |
440 PrimaryNode(intptr_t token_pos, const Object& primary) | 440 PrimaryNode(intptr_t token_pos, const Object& primary) |
441 : AstNode(token_pos), primary_(primary) { | 441 : AstNode(token_pos), primary_(primary) { |
442 ASSERT(primary_.IsZoneHandle()); | 442 ASSERT(primary_.IsNotTemporaryScopedHandle()); |
443 } | 443 } |
444 | 444 |
445 const Object& primary() const { return primary_; } | 445 const Object& primary() const { return primary_; } |
446 | 446 |
447 bool IsSuper() const { | 447 bool IsSuper() const { |
448 return primary().IsString() && (primary().raw() == Symbols::Super()); | 448 return primary().IsString() && (primary().raw() == Symbols::Super().raw()); |
449 } | 449 } |
450 | 450 |
451 virtual void VisitChildren(AstNodeVisitor* visitor) const; | 451 virtual void VisitChildren(AstNodeVisitor* visitor) const; |
452 | 452 |
453 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); | 453 DECLARE_COMMON_NODE_FUNCTIONS(PrimaryNode); |
454 | 454 |
455 private: | 455 private: |
456 const Object& primary_; | 456 const Object& primary_; |
457 | 457 |
458 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); | 458 DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode); |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 public: | 1185 public: |
1186 InstanceCallNode(intptr_t token_pos, | 1186 InstanceCallNode(intptr_t token_pos, |
1187 AstNode* receiver, | 1187 AstNode* receiver, |
1188 const String& function_name, | 1188 const String& function_name, |
1189 ArgumentListNode* arguments) | 1189 ArgumentListNode* arguments) |
1190 : AstNode(token_pos), | 1190 : AstNode(token_pos), |
1191 receiver_(receiver), | 1191 receiver_(receiver), |
1192 function_name_(function_name), | 1192 function_name_(function_name), |
1193 arguments_(arguments) { | 1193 arguments_(arguments) { |
1194 ASSERT(receiver_ != NULL); | 1194 ASSERT(receiver_ != NULL); |
1195 ASSERT(function_name_.IsZoneHandle()); | 1195 ASSERT(function_name_.IsNotTemporaryScopedHandle()); |
1196 ASSERT(function_name_.IsSymbol()); | 1196 ASSERT(function_name_.IsSymbol()); |
1197 ASSERT(arguments_ != NULL); | 1197 ASSERT(arguments_ != NULL); |
1198 } | 1198 } |
1199 | 1199 |
1200 AstNode* receiver() const { return receiver_; } | 1200 AstNode* receiver() const { return receiver_; } |
1201 const String& function_name() const { return function_name_; } | 1201 const String& function_name() const { return function_name_; } |
1202 ArgumentListNode* arguments() const { return arguments_; } | 1202 ArgumentListNode* arguments() const { return arguments_; } |
1203 | 1203 |
1204 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1204 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1205 receiver()->Visit(visitor); | 1205 receiver()->Visit(visitor); |
(...skipping 13 matching lines...) Expand all Loading... |
1219 | 1219 |
1220 class InstanceGetterNode : public AstNode { | 1220 class InstanceGetterNode : public AstNode { |
1221 public: | 1221 public: |
1222 InstanceGetterNode(intptr_t token_pos, | 1222 InstanceGetterNode(intptr_t token_pos, |
1223 AstNode* receiver, | 1223 AstNode* receiver, |
1224 const String& field_name) | 1224 const String& field_name) |
1225 : AstNode(token_pos), | 1225 : AstNode(token_pos), |
1226 receiver_(receiver), | 1226 receiver_(receiver), |
1227 field_name_(field_name) { | 1227 field_name_(field_name) { |
1228 ASSERT(receiver_ != NULL); | 1228 ASSERT(receiver_ != NULL); |
1229 ASSERT(field_name_.IsZoneHandle()); | 1229 ASSERT(field_name_.IsNotTemporaryScopedHandle()); |
1230 ASSERT(field_name_.IsSymbol()); | 1230 ASSERT(field_name_.IsSymbol()); |
1231 } | 1231 } |
1232 | 1232 |
1233 AstNode* receiver() const { return receiver_; } | 1233 AstNode* receiver() const { return receiver_; } |
1234 const String& field_name() const { return field_name_; } | 1234 const String& field_name() const { return field_name_; } |
1235 | 1235 |
1236 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1236 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
1237 receiver()->Visit(visitor); | 1237 receiver()->Visit(visitor); |
1238 } | 1238 } |
1239 | 1239 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 const LocalVariable& context_var_; | 1690 const LocalVariable& context_var_; |
1691 | 1691 |
1692 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1692 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
1693 }; | 1693 }; |
1694 | 1694 |
1695 } // namespace dart | 1695 } // namespace dart |
1696 | 1696 |
1697 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1697 #undef DECLARE_COMMON_NODE_FUNCTIONS |
1698 | 1698 |
1699 #endif // VM_AST_H_ | 1699 #endif // VM_AST_H_ |
OLD | NEW |