Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: runtime/vm/ast.h

Issue 1723733002: Simplify various name flavors in VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 FOR_EACH_NODE(DEFINE_VISITOR_FUNCTION) 85 FOR_EACH_NODE(DEFINE_VISITOR_FUNCTION)
86 #undef DEFINE_VISITOR_FUNCTION 86 #undef DEFINE_VISITOR_FUNCTION
87 87
88 private: 88 private:
89 DISALLOW_COPY_AND_ASSIGN(AstNodeVisitor); 89 DISALLOW_COPY_AND_ASSIGN(AstNodeVisitor);
90 }; 90 };
91 91
92 92
93 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \ 93 #define DECLARE_COMMON_NODE_FUNCTIONS(type) \
94 virtual void Visit(AstNodeVisitor* visitor); \ 94 virtual void Visit(AstNodeVisitor* visitor); \
95 virtual const char* PrettyName() const; \ 95 virtual const char* Name() const; \
96 virtual type* As##type() { return this; } 96 virtual type* As##type() { return this; }
97 97
98 98
99 class AstNode : public ZoneAllocated { 99 class AstNode : public ZoneAllocated {
100 public: 100 public:
101 explicit AstNode(TokenPosition token_pos) 101 explicit AstNode(TokenPosition token_pos)
102 : token_pos_(token_pos) { 102 : token_pos_(token_pos) {
103 ASSERT(!token_pos_.IsClassifying() || 103 ASSERT(!token_pos_.IsClassifying() ||
104 (token_pos_ == TokenPosition::kMethodExtractor)); 104 (token_pos_ == TokenPosition::kMethodExtractor));
105 } 105 }
106 virtual ~AstNode() { } 106 virtual ~AstNode() { }
107 107
108 TokenPosition token_pos() const { return token_pos_; } 108 TokenPosition token_pos() const { return token_pos_; }
109 109
110 #define AST_TYPE_CHECK(BaseName) \ 110 #define AST_TYPE_CHECK(BaseName) \
111 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \ 111 bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \
112 virtual BaseName##Node* As##BaseName##Node() { return NULL; } 112 virtual BaseName##Node* As##BaseName##Node() { return NULL; }
113 113
114 FOR_EACH_NODE(AST_TYPE_CHECK) 114 FOR_EACH_NODE(AST_TYPE_CHECK)
115 #undef AST_TYPE_CHECK 115 #undef AST_TYPE_CHECK
116 116
117 virtual void Visit(AstNodeVisitor* visitor) = 0; 117 virtual void Visit(AstNodeVisitor* visitor) = 0;
118 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0; 118 virtual void VisitChildren(AstNodeVisitor* visitor) const = 0;
119 virtual const char* PrettyName() const = 0; 119 virtual const char* Name() const = 0;
120 120
121 // Convert the node into an assignment node using the rhs which is passed in, 121 // Convert the node into an assignment node using the rhs which is passed in,
122 // this is typically used for converting nodes like LoadLocalNode, 122 // this is typically used for converting nodes like LoadLocalNode,
123 // LoadStaticFieldNode, InstanceGetterNode etc. which were created during 123 // LoadStaticFieldNode, InstanceGetterNode etc. which were created during
124 // parsing as the assignment context was not known yet at that time. 124 // parsing as the assignment context was not known yet at that time.
125 virtual AstNode* MakeAssignmentNode(AstNode* rhs) { 125 virtual AstNode* MakeAssignmentNode(AstNode* rhs) {
126 return NULL; // By default all nodes are not assignable. 126 return NULL; // By default all nodes are not assignable.
127 } 127 }
128 128
129 // Return NULL if 'unary_op_kind' can't be applied. 129 // Return NULL if 'unary_op_kind' can't be applied.
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 const intptr_t try_index_; 2035 const intptr_t try_index_;
2036 2036
2037 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 2037 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
2038 }; 2038 };
2039 2039
2040 } // namespace dart 2040 } // namespace dart
2041 2041
2042 #undef DECLARE_COMMON_NODE_FUNCTIONS 2042 #undef DECLARE_COMMON_NODE_FUNCTIONS
2043 2043
2044 #endif // VM_AST_H_ 2044 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698