| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 virtual bool Is##type() const { return true; } \ | 89 virtual bool Is##type() const { return true; } \ |
| 90 virtual type* As##type() { return this; } | 90 virtual type* As##type() { return this; } |
| 91 | 91 |
| 92 | 92 |
| 93 class AstNode : public ZoneAllocated { | 93 class AstNode : public ZoneAllocated { |
| 94 public: | 94 public: |
| 95 explicit AstNode(intptr_t token_pos) | 95 explicit AstNode(intptr_t token_pos) |
| 96 : token_pos_(token_pos), | 96 : token_pos_(token_pos), |
| 97 ic_data_(ICData::ZoneHandle()), | 97 ic_data_(ICData::ZoneHandle()), |
| 98 info_(NULL) { | 98 info_(NULL) { |
| 99 ASSERT(token_pos >= 0); | 99 ASSERT(token_pos_ >= 0); |
| 100 } | 100 } |
| 101 | 101 |
| 102 intptr_t token_pos() const { return token_pos_; } | 102 intptr_t token_pos() const { return token_pos_; } |
| 103 | 103 |
| 104 | 104 |
| 105 const ICData& ic_data() const { return ic_data_; } | 105 const ICData& ic_data() const { return ic_data_; } |
| 106 void set_ic_data(const ICData& value) { | 106 void set_ic_data(const ICData& value) { |
| 107 ic_data_ = value.raw(); | 107 ic_data_ = value.raw(); |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 public: | 435 public: |
| 436 // Return from a void function returns the null object. | 436 // Return from a void function returns the null object. |
| 437 explicit ReturnNode(intptr_t token_pos) | 437 explicit ReturnNode(intptr_t token_pos) |
| 438 : AstNode(token_pos), | 438 : AstNode(token_pos), |
| 439 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), | 439 value_(new LiteralNode(token_pos, Instance::ZoneHandle())), |
| 440 inlined_finally_list_() { } | 440 inlined_finally_list_() { } |
| 441 // Return from a non-void function. | 441 // Return from a non-void function. |
| 442 ReturnNode(intptr_t token_pos, | 442 ReturnNode(intptr_t token_pos, |
| 443 AstNode* value) | 443 AstNode* value) |
| 444 : AstNode(token_pos), value_(value), inlined_finally_list_() { | 444 : AstNode(token_pos), value_(value), inlined_finally_list_() { |
| 445 ASSERT(value != NULL); | 445 ASSERT(value_ != NULL); |
| 446 } | 446 } |
| 447 | 447 |
| 448 AstNode* value() const { return value_; } | 448 AstNode* value() const { return value_; } |
| 449 | 449 |
| 450 intptr_t inlined_finally_list_length() const { | 450 intptr_t inlined_finally_list_length() const { |
| 451 return inlined_finally_list_.length(); | 451 return inlined_finally_list_.length(); |
| 452 } | 452 } |
| 453 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { | 453 InlinedFinallyNode* InlinedFinallyNodeAt(intptr_t index) const { |
| 454 return inlined_finally_list_[index]; | 454 return inlined_finally_list_[index]; |
| 455 } | 455 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 private: | 894 private: |
| 895 Token::Kind kind_; | 895 Token::Kind kind_; |
| 896 SourceLabel* label_; | 896 SourceLabel* label_; |
| 897 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; | 897 GrowableArray<InlinedFinallyNode*> inlined_finally_list_; |
| 898 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); | 898 DISALLOW_IMPLICIT_CONSTRUCTORS(JumpNode); |
| 899 }; | 899 }; |
| 900 | 900 |
| 901 | 901 |
| 902 class LoadLocalNode : public AstNode { | 902 class LoadLocalNode : public AstNode { |
| 903 public: | 903 public: |
| 904 LoadLocalNode(intptr_t token_pos, const LocalVariable& local) | 904 LoadLocalNode(intptr_t token_pos, const LocalVariable* local) |
| 905 : AstNode(token_pos), local_(local), pseudo_(NULL) { | 905 : AstNode(token_pos), local_(*local), pseudo_(NULL) { |
| 906 ASSERT(&local_ != NULL); | 906 ASSERT(local != NULL); |
| 907 } | 907 } |
| 908 // The pseudo node does not produce input but must be visited before | 908 // The pseudo node does not produce input but must be visited before |
| 909 // completing local load. | 909 // completing local load. |
| 910 LoadLocalNode(intptr_t token_pos, | 910 LoadLocalNode(intptr_t token_pos, const LocalVariable* local, AstNode* pseudo) |
| 911 const LocalVariable& local, | 911 : AstNode(token_pos), local_(*local), pseudo_(pseudo) { |
| 912 AstNode* pseudo) | 912 ASSERT(local != NULL); |
| 913 : AstNode(token_pos), local_(local), pseudo_(pseudo) { | |
| 914 ASSERT(&local_ != NULL); | |
| 915 } | 913 } |
| 916 | 914 |
| 917 const LocalVariable& local() const { return local_; } | 915 const LocalVariable& local() const { return local_; } |
| 918 AstNode* pseudo() const { return pseudo_; } // Can be NULL. | 916 AstNode* pseudo() const { return pseudo_; } // Can be NULL. |
| 919 bool HasPseudo() const { return pseudo_ != NULL; } | 917 bool HasPseudo() const { return pseudo_ != NULL; } |
| 920 | 918 |
| 921 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 919 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 922 if (HasPseudo()) { | 920 if (HasPseudo()) { |
| 923 pseudo()->Visit(visitor); | 921 pseudo()->Visit(visitor); |
| 924 } | 922 } |
| 925 } | 923 } |
| 926 | 924 |
| 927 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 925 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
| 928 | 926 |
| 929 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); | 927 DECLARE_COMMON_NODE_FUNCTIONS(LoadLocalNode); |
| 930 | 928 |
| 931 private: | 929 private: |
| 932 const LocalVariable& local_; | 930 const LocalVariable& local_; |
| 933 AstNode* pseudo_; | 931 AstNode* pseudo_; |
| 934 | 932 |
| 935 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); | 933 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadLocalNode); |
| 936 }; | 934 }; |
| 937 | 935 |
| 938 | 936 |
| 939 class StoreLocalNode : public AstNode { | 937 class StoreLocalNode : public AstNode { |
| 940 public: | 938 public: |
| 941 StoreLocalNode(intptr_t token_pos, | 939 StoreLocalNode(intptr_t token_pos, const LocalVariable* local, AstNode* value) |
| 942 const LocalVariable& local, | 940 : AstNode(token_pos), local_(*local), value_(value) { |
| 943 AstNode* value) | 941 ASSERT(local != NULL); |
| 944 : AstNode(token_pos), local_(local), value_(value) { | |
| 945 ASSERT(&local_ != NULL); | |
| 946 ASSERT(value_ != NULL); | 942 ASSERT(value_ != NULL); |
| 947 } | 943 } |
| 948 | 944 |
| 949 const LocalVariable& local() const { return local_; } | 945 const LocalVariable& local() const { return local_; } |
| 950 AstNode* value() const { return value_; } | 946 AstNode* value() const { return value_; } |
| 951 | 947 |
| 952 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 948 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 953 value()->Visit(visitor); | 949 value()->Visit(visitor); |
| 954 } | 950 } |
| 955 | 951 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 AstNode* value_; | 1071 AstNode* value_; |
| 1076 | 1072 |
| 1077 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); | 1073 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreStaticFieldNode); |
| 1078 }; | 1074 }; |
| 1079 | 1075 |
| 1080 | 1076 |
| 1081 class LoadIndexedNode : public AstNode { | 1077 class LoadIndexedNode : public AstNode { |
| 1082 public: | 1078 public: |
| 1083 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index) | 1079 LoadIndexedNode(intptr_t token_pos, AstNode* array, AstNode* index) |
| 1084 : AstNode(token_pos), array_(array), index_expr_(index) { | 1080 : AstNode(token_pos), array_(array), index_expr_(index) { |
| 1085 ASSERT(array != NULL); | 1081 ASSERT(array_ != NULL); |
| 1086 ASSERT(index != NULL); | 1082 ASSERT(index_expr_ != NULL); |
| 1087 } | 1083 } |
| 1088 | 1084 |
| 1089 AstNode* array() const { return array_; } | 1085 AstNode* array() const { return array_; } |
| 1090 AstNode* index_expr() const { return index_expr_; } | 1086 AstNode* index_expr() const { return index_expr_; } |
| 1091 | 1087 |
| 1092 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1088 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1093 array()->Visit(visitor); | 1089 array()->Visit(visitor); |
| 1094 index_expr()->Visit(visitor); | 1090 index_expr()->Visit(visitor); |
| 1095 } | 1091 } |
| 1096 | 1092 |
| 1097 virtual AstNode* MakeAssignmentNode(AstNode* rhs); | 1093 virtual AstNode* MakeAssignmentNode(AstNode* rhs); |
| 1098 | 1094 |
| 1099 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); | 1095 DECLARE_COMMON_NODE_FUNCTIONS(LoadIndexedNode); |
| 1100 | 1096 |
| 1101 private: | 1097 private: |
| 1102 AstNode* array_; | 1098 AstNode* array_; |
| 1103 AstNode* index_expr_; | 1099 AstNode* index_expr_; |
| 1104 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); | 1100 DISALLOW_IMPLICIT_CONSTRUCTORS(LoadIndexedNode); |
| 1105 }; | 1101 }; |
| 1106 | 1102 |
| 1107 | 1103 |
| 1108 class StoreIndexedNode : public AstNode { | 1104 class StoreIndexedNode : public AstNode { |
| 1109 public: | 1105 public: |
| 1110 StoreIndexedNode(intptr_t token_pos, | 1106 StoreIndexedNode(intptr_t token_pos, |
| 1111 AstNode* array, AstNode* index, AstNode* value) | 1107 AstNode* array, AstNode* index, AstNode* value) |
| 1112 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) { | 1108 : AstNode(token_pos), array_(array), index_expr_(index), value_(value) { |
| 1113 ASSERT(array != NULL); | 1109 ASSERT(array_ != NULL); |
| 1114 ASSERT(index != NULL); | 1110 ASSERT(index_expr_ != NULL); |
| 1115 ASSERT(value != NULL); | 1111 ASSERT(value_ != NULL); |
| 1116 } | 1112 } |
| 1117 | 1113 |
| 1118 AstNode* array() const { return array_; } | 1114 AstNode* array() const { return array_; } |
| 1119 AstNode* index_expr() const { return index_expr_; } | 1115 AstNode* index_expr() const { return index_expr_; } |
| 1120 AstNode* value() const { return value_; } | 1116 AstNode* value() const { return value_; } |
| 1121 | 1117 |
| 1122 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1118 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1123 array()->Visit(visitor); | 1119 array()->Visit(visitor); |
| 1124 index_expr()->Visit(visitor); | 1120 index_expr()->Visit(visitor); |
| 1125 value()->Visit(visitor); | 1121 value()->Visit(visitor); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 StaticSetterNode(intptr_t token_pos, | 1279 StaticSetterNode(intptr_t token_pos, |
| 1284 const Class& cls, | 1280 const Class& cls, |
| 1285 const String& field_name, | 1281 const String& field_name, |
| 1286 AstNode* value) | 1282 AstNode* value) |
| 1287 : AstNode(token_pos), | 1283 : AstNode(token_pos), |
| 1288 cls_(cls), | 1284 cls_(cls), |
| 1289 field_name_(field_name), | 1285 field_name_(field_name), |
| 1290 value_(value) { | 1286 value_(value) { |
| 1291 ASSERT(cls_.IsZoneHandle()); | 1287 ASSERT(cls_.IsZoneHandle()); |
| 1292 ASSERT(field_name_.IsZoneHandle()); | 1288 ASSERT(field_name_.IsZoneHandle()); |
| 1293 ASSERT(value != NULL); | 1289 ASSERT(value_ != NULL); |
| 1294 } | 1290 } |
| 1295 | 1291 |
| 1296 const Class& cls() const { return cls_; } | 1292 const Class& cls() const { return cls_; } |
| 1297 const String& field_name() const { return field_name_; } | 1293 const String& field_name() const { return field_name_; } |
| 1298 AstNode* value() const { return value_; } | 1294 AstNode* value() const { return value_; } |
| 1299 | 1295 |
| 1300 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1296 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1301 value()->Visit(visitor); | 1297 value()->Visit(visitor); |
| 1302 } | 1298 } |
| 1303 | 1299 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 // instantiator_class. | 1395 // instantiator_class. |
| 1400 // | 1396 // |
| 1401 // A temporary local is needed to hold the allocated value while the | 1397 // A temporary local is needed to hold the allocated value while the |
| 1402 // constructor is being called. | 1398 // constructor is being called. |
| 1403 class ConstructorCallNode : public AstNode { | 1399 class ConstructorCallNode : public AstNode { |
| 1404 public: | 1400 public: |
| 1405 ConstructorCallNode(intptr_t token_pos, | 1401 ConstructorCallNode(intptr_t token_pos, |
| 1406 const AbstractTypeArguments& type_arguments, | 1402 const AbstractTypeArguments& type_arguments, |
| 1407 const Function& constructor, | 1403 const Function& constructor, |
| 1408 ArgumentListNode* arguments, | 1404 ArgumentListNode* arguments, |
| 1409 const LocalVariable& allocated_object_var) | 1405 const LocalVariable* allocated_object_var) |
| 1410 : AstNode(token_pos), | 1406 : AstNode(token_pos), |
| 1411 type_arguments_(type_arguments), | 1407 type_arguments_(type_arguments), |
| 1412 constructor_(constructor), | 1408 constructor_(constructor), |
| 1413 arguments_(arguments), | 1409 arguments_(arguments), |
| 1414 allocated_object_var_(allocated_object_var) { | 1410 allocated_object_var_(*allocated_object_var) { |
| 1415 ASSERT(type_arguments_.IsZoneHandle()); | 1411 ASSERT(type_arguments_.IsZoneHandle()); |
| 1416 ASSERT(constructor_.IsZoneHandle()); | 1412 ASSERT(constructor_.IsZoneHandle()); |
| 1417 ASSERT(arguments_ != NULL); | 1413 ASSERT(arguments_ != NULL); |
| 1414 ASSERT(allocated_object_var != NULL); |
| 1418 } | 1415 } |
| 1419 | 1416 |
| 1420 const AbstractTypeArguments& type_arguments() const { | 1417 const AbstractTypeArguments& type_arguments() const { |
| 1421 return type_arguments_; | 1418 return type_arguments_; |
| 1422 } | 1419 } |
| 1423 const Function& constructor() const { return constructor_; } | 1420 const Function& constructor() const { return constructor_; } |
| 1424 ArgumentListNode* arguments() const { return arguments_; } | 1421 ArgumentListNode* arguments() const { return arguments_; } |
| 1425 const LocalVariable& allocated_object_var() const { | 1422 const LocalVariable& allocated_object_var() const { |
| 1426 return allocated_object_var_; | 1423 return allocated_object_var_; |
| 1427 } | 1424 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); | 1485 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode); |
| 1489 }; | 1486 }; |
| 1490 | 1487 |
| 1491 | 1488 |
| 1492 class CatchClauseNode : public AstNode { | 1489 class CatchClauseNode : public AstNode { |
| 1493 public: | 1490 public: |
| 1494 static const int kInvalidTryIndex = -1; | 1491 static const int kInvalidTryIndex = -1; |
| 1495 | 1492 |
| 1496 CatchClauseNode(intptr_t token_pos, | 1493 CatchClauseNode(intptr_t token_pos, |
| 1497 SequenceNode* catch_block, | 1494 SequenceNode* catch_block, |
| 1498 const LocalVariable& context_var, | 1495 const LocalVariable* context_var, |
| 1499 const LocalVariable& exception_var, | 1496 const LocalVariable* exception_var, |
| 1500 const LocalVariable& stacktrace_var) | 1497 const LocalVariable* stacktrace_var) |
| 1501 : AstNode(token_pos), | 1498 : AstNode(token_pos), |
| 1502 try_index_(kInvalidTryIndex), | 1499 try_index_(kInvalidTryIndex), |
| 1503 catch_block_(catch_block), | 1500 catch_block_(catch_block), |
| 1504 context_var_(context_var), | 1501 context_var_(*context_var), |
| 1505 exception_var_(exception_var), | 1502 exception_var_(*exception_var), |
| 1506 stacktrace_var_(stacktrace_var) { | 1503 stacktrace_var_(*stacktrace_var) { |
| 1507 ASSERT(catch_block != NULL); | 1504 ASSERT(catch_block_ != NULL); |
| 1505 ASSERT(context_var != NULL); |
| 1506 ASSERT(exception_var != NULL); |
| 1507 ASSERT(stacktrace_var != NULL); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 int try_index() const { | 1510 int try_index() const { |
| 1511 ASSERT(try_index_ >= 0); | 1511 ASSERT(try_index_ >= 0); |
| 1512 return try_index_; | 1512 return try_index_; |
| 1513 } | 1513 } |
| 1514 void set_try_index(int value) { try_index_ = value; } | 1514 void set_try_index(int value) { try_index_ = value; } |
| 1515 | 1515 |
| 1516 const LocalVariable& context_var() const { return context_var_; } | 1516 const LocalVariable& context_var() const { return context_var_; } |
| 1517 const LocalVariable& exception_var() const { return exception_var_; } | 1517 const LocalVariable& exception_var() const { return exception_var_; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1532 | 1532 |
| 1533 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); | 1533 DISALLOW_COPY_AND_ASSIGN(CatchClauseNode); |
| 1534 }; | 1534 }; |
| 1535 | 1535 |
| 1536 | 1536 |
| 1537 class TryCatchNode : public AstNode { | 1537 class TryCatchNode : public AstNode { |
| 1538 public: | 1538 public: |
| 1539 TryCatchNode(intptr_t token_pos, | 1539 TryCatchNode(intptr_t token_pos, |
| 1540 SequenceNode* try_block, | 1540 SequenceNode* try_block, |
| 1541 SourceLabel* end_catch_label, | 1541 SourceLabel* end_catch_label, |
| 1542 const LocalVariable& context_var, | 1542 const LocalVariable* context_var, |
| 1543 CatchClauseNode* catch_block, | 1543 CatchClauseNode* catch_block, |
| 1544 SequenceNode* finally_block) | 1544 SequenceNode* finally_block) |
| 1545 : AstNode(token_pos), | 1545 : AstNode(token_pos), |
| 1546 try_block_(try_block), | 1546 try_block_(try_block), |
| 1547 end_catch_label_(end_catch_label), | 1547 end_catch_label_(end_catch_label), |
| 1548 context_var_(context_var), | 1548 context_var_(*context_var), |
| 1549 catch_block_(catch_block), | 1549 catch_block_(catch_block), |
| 1550 finally_block_(finally_block) { | 1550 finally_block_(finally_block) { |
| 1551 ASSERT(try_block != NULL); | 1551 ASSERT(try_block_ != NULL); |
| 1552 ASSERT(catch_block != NULL || finally_block != NULL); | 1552 ASSERT(context_var != NULL); |
| 1553 ASSERT(end_catch_label != NULL); | 1553 ASSERT(catch_block_ != NULL || finally_block_ != NULL); |
| 1554 ASSERT(end_catch_label_ != NULL); |
| 1554 } | 1555 } |
| 1555 | 1556 |
| 1556 SequenceNode* try_block() const { return try_block_; } | 1557 SequenceNode* try_block() const { return try_block_; } |
| 1557 SourceLabel* end_catch_label() const { return end_catch_label_; } | 1558 SourceLabel* end_catch_label() const { return end_catch_label_; } |
| 1558 CatchClauseNode* catch_block() const { return catch_block_; } | 1559 CatchClauseNode* catch_block() const { return catch_block_; } |
| 1559 SequenceNode* finally_block() const { return finally_block_; } | 1560 SequenceNode* finally_block() const { return finally_block_; } |
| 1560 const LocalVariable& context_var() const { return context_var_; } | 1561 const LocalVariable& context_var() const { return context_var_; } |
| 1561 | 1562 |
| 1562 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1563 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1563 try_block_->Visit(visitor); | 1564 try_block_->Visit(visitor); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1579 SequenceNode* finally_block_; | 1580 SequenceNode* finally_block_; |
| 1580 | 1581 |
| 1581 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); | 1582 DISALLOW_COPY_AND_ASSIGN(TryCatchNode); |
| 1582 }; | 1583 }; |
| 1583 | 1584 |
| 1584 | 1585 |
| 1585 class ThrowNode : public AstNode { | 1586 class ThrowNode : public AstNode { |
| 1586 public: | 1587 public: |
| 1587 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace) | 1588 ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace) |
| 1588 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) { | 1589 : AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) { |
| 1589 ASSERT(exception != NULL); | 1590 ASSERT(exception_ != NULL); |
| 1590 } | 1591 } |
| 1591 | 1592 |
| 1592 AstNode* exception() const { return exception_; } | 1593 AstNode* exception() const { return exception_; } |
| 1593 AstNode* stacktrace() const { return stacktrace_; } | 1594 AstNode* stacktrace() const { return stacktrace_; } |
| 1594 | 1595 |
| 1595 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1596 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1596 exception()->Visit(visitor); | 1597 exception()->Visit(visitor); |
| 1597 if (stacktrace() != NULL) { | 1598 if (stacktrace() != NULL) { |
| 1598 stacktrace()->Visit(visitor); | 1599 stacktrace()->Visit(visitor); |
| 1599 } | 1600 } |
| 1600 } | 1601 } |
| 1601 | 1602 |
| 1602 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); | 1603 DECLARE_COMMON_NODE_FUNCTIONS(ThrowNode); |
| 1604 |
| 1603 private: | 1605 private: |
| 1604 AstNode* exception_; | 1606 AstNode* exception_; |
| 1605 AstNode* stacktrace_; | 1607 AstNode* stacktrace_; |
| 1606 | 1608 |
| 1607 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); | 1609 DISALLOW_IMPLICIT_CONSTRUCTORS(ThrowNode); |
| 1608 }; | 1610 }; |
| 1609 | 1611 |
| 1610 | 1612 |
| 1611 class InlinedFinallyNode : public AstNode { | 1613 class InlinedFinallyNode : public AstNode { |
| 1612 public: | 1614 public: |
| 1613 InlinedFinallyNode(intptr_t token_pos, | 1615 InlinedFinallyNode(intptr_t token_pos, |
| 1614 AstNode* finally_block, | 1616 AstNode* finally_block, |
| 1615 const LocalVariable& context_var) | 1617 const LocalVariable* context_var) |
| 1616 : AstNode(token_pos), | 1618 : AstNode(token_pos), |
| 1617 finally_block_(finally_block), | 1619 finally_block_(finally_block), |
| 1618 context_var_(context_var) { | 1620 context_var_(*context_var) { |
| 1619 ASSERT(finally_block != NULL); | 1621 ASSERT(finally_block_ != NULL); |
| 1622 ASSERT(context_var != NULL); |
| 1620 } | 1623 } |
| 1621 | 1624 |
| 1622 AstNode* finally_block() const { return finally_block_; } | 1625 AstNode* finally_block() const { return finally_block_; } |
| 1623 const LocalVariable& context_var() const { return context_var_; } | 1626 const LocalVariable& context_var() const { return context_var_; } |
| 1624 | 1627 |
| 1625 virtual void VisitChildren(AstNodeVisitor* visitor) const { | 1628 virtual void VisitChildren(AstNodeVisitor* visitor) const { |
| 1626 finally_block()->Visit(visitor); | 1629 finally_block()->Visit(visitor); |
| 1627 } | 1630 } |
| 1628 | 1631 |
| 1629 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode); | 1632 DECLARE_COMMON_NODE_FUNCTIONS(InlinedFinallyNode); |
| 1633 |
| 1630 private: | 1634 private: |
| 1631 AstNode* finally_block_; | 1635 AstNode* finally_block_; |
| 1632 const LocalVariable& context_var_; | 1636 const LocalVariable& context_var_; |
| 1633 | 1637 |
| 1634 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 1638 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
| 1635 }; | 1639 }; |
| 1636 | 1640 |
| 1637 } // namespace dart | 1641 } // namespace dart |
| 1638 | 1642 |
| 1639 #undef DECLARE_COMMON_NODE_FUNCTIONS | 1643 #undef DECLARE_COMMON_NODE_FUNCTIONS |
| 1640 | 1644 |
| 1641 #endif // VM_AST_H_ | 1645 #endif // VM_AST_H_ |
| OLD | NEW |