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

Unified Diff: runtime/vm/ast.cc

Issue 23923005: Change --print-ast output to be more regular. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/ast.cc
diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc
index 0f123a5de3ed74470aceaed7840b139e5ef0b628..2c911eb2dc6c81ccb04ba00f7b69206bf11aa75e 100644
--- a/runtime/vm/ast.cc
+++ b/runtime/vm/ast.cc
@@ -12,19 +12,21 @@
namespace dart {
-#define DEFINE_VISIT_FUNCTION(type, name) \
- void type::Visit(AstNodeVisitor* visitor) { \
- visitor->Visit##type(this); \
- }
-NODE_LIST(DEFINE_VISIT_FUNCTION)
+#define DEFINE_VISIT_FUNCTION(BaseName) \
+void BaseName##Node::Visit(AstNodeVisitor* visitor) { \
+ visitor->Visit##BaseName##Node(this); \
+}
+
+FOR_EACH_NODE(DEFINE_VISIT_FUNCTION)
#undef DEFINE_VISIT_FUNCTION
-#define DEFINE_NAME_FUNCTION(type, name) \
- const char* type::PrettyName() const { \
- return name; \
- }
-NODE_LIST(DEFINE_NAME_FUNCTION)
+#define DEFINE_NAME_FUNCTION(BaseName) \
+const char* BaseName##Node::PrettyName() const { \
+ return #BaseName; \
+}
+
+FOR_EACH_NODE(DEFINE_NAME_FUNCTION)
#undef DEFINE_NAME_FUNCTION
@@ -35,12 +37,13 @@ class AstNodeCollector : public AstNodeVisitor {
explicit AstNodeCollector(GrowableArray<AstNode*>* nodes)
: nodes_(nodes) { }
-#define DEFINE_VISITOR_FUNCTION(type, name) \
- virtual void Visit##type(type* node) { \
+#define DEFINE_VISITOR_FUNCTION(BaseName) \
+ virtual void Visit##BaseName##Node(BaseName##Node* node) { \
nodes_->Add(node); \
node->VisitChildren(this); \
}
-NODE_LIST(DEFINE_VISITOR_FUNCTION)
+
+FOR_EACH_NODE(DEFINE_VISITOR_FUNCTION)
#undef DEFINE_VISITOR_FUNCTION
private:
@@ -151,7 +154,7 @@ bool ComparisonNode::IsKindValid() const {
const char* ComparisonNode::TokenName() const {
- return Token::Str(kind_);
+ return (kind_ == Token::kAS) ? "as" : Token::Str(kind_);
}
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/ast_printer.h » ('j') | runtime/vm/ast_printer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698