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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ | 92 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ |
93 virtual void Visit(AstNodeVisitor* visitor); \ | 93 virtual void Visit(AstNodeVisitor* visitor); \ |
94 virtual const char* PrettyName() const; \ | 94 virtual const char* PrettyName() const; \ |
95 virtual type* As##type() { return this; } | 95 virtual type* As##type() { return this; } |
96 | 96 |
97 | 97 |
98 class AstNode : public ZoneAllocated { | 98 class AstNode : public ZoneAllocated { |
99 public: | 99 public: |
100 explicit AstNode(intptr_t token_pos) | 100 explicit AstNode(intptr_t token_pos) |
101 : token_pos_(token_pos) { | 101 : token_pos_(token_pos) { |
102 ASSERT(Scanner::ValidSourcePosition(token_pos_)); | 102 ASSERT(!Token::IsClassifying(token_pos_) || |
| 103 (token_pos_ == ClassifyingTokenPositions::kMethodExtractor)); |
103 } | 104 } |
104 virtual ~AstNode() { } | 105 virtual ~AstNode() { } |
105 | 106 |
106 intptr_t token_pos() const { return token_pos_; } | 107 intptr_t token_pos() const { return token_pos_; } |
107 | 108 |
108 #define AST_TYPE_CHECK(BaseName) \ | 109 #define AST_TYPE_CHECK(BaseName) \ |
109 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \ | 110 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \ |
110 virtual BaseName##Node* As##BaseName##Node() { return NULL; } | 111 virtual BaseName##Node* As##BaseName##Node() { return NULL; } |
111 | 112 |
112 FOR_EACH_NODE(AST_TYPE_CHECK) | 113 FOR_EACH_NODE(AST_TYPE_CHECK) |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 const intptr_t try_index_; | 2027 const intptr_t try_index_; |
2027 | 2028 |
2028 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); | 2029 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); |
2029 }; | 2030 }; |
2030 | 2031 |
2031 } // namespace dart | 2032 } // namespace dart |
2032 | 2033 |
2033 #undef DECLARE_COMMON_NODE_FUNCTIONS | 2034 #undef DECLARE_COMMON_NODE_FUNCTIONS |
2034 | 2035 |
2035 #endif // VM_AST_H_ | 2036 #endif // VM_AST_H_ |
OLD | NEW |