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

Unified Diff: runtime/vm/ast_printer.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/ast.cc ('k') | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast_printer.cc
diff --git a/runtime/vm/ast_printer.cc b/runtime/vm/ast_printer.cc
index de639406de038637996bbc53d831cb6645369251..54be6d7a17c4921e678f1de1a162b4b9e2d29af8 100644
--- a/runtime/vm/ast_printer.cc
+++ b/runtime/vm/ast_printer.cc
@@ -17,17 +17,14 @@ namespace dart {
AstPrinter::AstPrinter(bool log)
: indent_(0), logger_(log ? Log::Current() : Log::NoOpLog()) {}
-
AstPrinter::~AstPrinter() {}
-
void AstPrinter::VisitGenericAstNode(AstNode* node) {
logger_->Print("(%s ", node->Name());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitSequenceNode(SequenceNode* node) {
indent_++;
LocalScope* scope = node->scope();
@@ -51,17 +48,14 @@ void AstPrinter::VisitSequenceNode(SequenceNode* node) {
indent_--;
}
-
void AstPrinter::VisitCloneContextNode(CloneContextNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitArgumentListNode(ArgumentListNode* arguments) {
VisitGenericAstNode(arguments);
}
-
void AstPrinter::VisitReturnNode(ReturnNode* node) {
const char* kind;
switch (node->return_type()) {
@@ -83,7 +77,6 @@ void AstPrinter::VisitReturnNode(ReturnNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitGenericLocalNode(AstNode* node,
const LocalVariable& variable) {
logger_->Print("(%s ", node->Name());
@@ -93,17 +86,14 @@ void AstPrinter::VisitGenericLocalNode(AstNode* node,
logger_->Print(")");
}
-
void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) {
VisitGenericLocalNode(node, node->local());
}
-
void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) {
VisitGenericLocalNode(node, node->local());
}
-
void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) {
logger_->Print(
"(%s %s%s \"%s\" ", node->Name(), field.is_final() ? "final " : "",
@@ -113,27 +103,22 @@ void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) {
logger_->Print(")");
}
-
void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) {
VisitGenericFieldNode(node, node->field());
}
-
void AstPrinter::VisitStoreInstanceFieldNode(StoreInstanceFieldNode* node) {
VisitGenericFieldNode(node, Field::ZoneHandle(node->field().Original()));
}
-
void AstPrinter::VisitLoadStaticFieldNode(LoadStaticFieldNode* node) {
VisitGenericFieldNode(node, node->field());
}
-
void AstPrinter::VisitStoreStaticFieldNode(StoreStaticFieldNode* node) {
VisitGenericFieldNode(node, node->field());
}
-
void AstPrinter::PrintLocalVariable(const LocalVariable* variable) {
logger_->Print("%s%s \"%s\"", variable->is_final() ? "final " : "",
String::Handle(variable->type().Name()).ToCString(),
@@ -148,7 +133,6 @@ void AstPrinter::PrintLocalVariable(const LocalVariable* variable) {
}
}
-
void AstPrinter::PrintNewlineAndIndent() {
logger_->Print("\n");
for (intptr_t p = 0; p < indent_; ++p) {
@@ -156,7 +140,6 @@ void AstPrinter::PrintNewlineAndIndent() {
}
}
-
void AstPrinter::VisitLetNode(LetNode* node) {
logger_->Print("(Let (");
// Indent the variables and initializers by two.
@@ -181,30 +164,25 @@ void AstPrinter::VisitLetNode(LetNode* node) {
--indent_;
}
-
void AstPrinter::VisitArrayNode(ArrayNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitStringInterpolateNode(StringInterpolateNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitLiteralNode(LiteralNode* node) {
const Instance& literal = node->literal();
logger_->Print("(%s \"%s\")", node->Name(), literal.ToCString());
}
-
void AstPrinter::VisitTypeNode(TypeNode* node) {
const AbstractType& type = node->type();
logger_->Print("(%s \"%s\")", node->Name(),
String::Handle(type.Name()).ToCString());
}
-
void AstPrinter::VisitAssignableNode(AssignableNode* node) {
const AbstractType& type = node->type();
const String& dst_name = node->dst_name();
@@ -214,57 +192,48 @@ void AstPrinter::VisitAssignableNode(AssignableNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitAwaitNode(AwaitNode* node) {
logger_->Print("(*****%s***** (scope \"%p\") ", node->Name(), node->scope());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) {
logger_->Print("(%s (async_scope \"%p\" await_scope \"%p\"))", node->Name(),
node->async_scope(), node->await_scope());
}
-
void AstPrinter::VisitPrimaryNode(PrimaryNode* node) {
logger_->Print("(*****%s***** \"%s\")", node->Name(),
node->primary().ToCString());
}
-
void AstPrinter::VisitComparisonNode(ComparisonNode* node) {
logger_->Print("(%s %s ", node->Name(), node->TokenName());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) {
logger_->Print("(%s %s ", node->Name(), node->TokenName());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) {
logger_->Print("(%s %s ", node->Name(), node->TokenName());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitIfNode(IfNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitCaseNode(CaseNode* node) {
logger_->Print("(%s (", node->Name());
for (int i = 0; i < node->case_expressions()->length(); i++) {
@@ -278,17 +247,14 @@ void AstPrinter::VisitCaseNode(CaseNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitSwitchNode(SwitchNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitWhileNode(WhileNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitForNode(ForNode* node) {
// Complicated because the condition is optional and so we clearly want to
// indicate the subparts.
@@ -305,18 +271,15 @@ void AstPrinter::VisitForNode(ForNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitDoWhileNode(DoWhileNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitJumpNode(JumpNode* node) {
logger_->Print("(%s %s %s (scope \"%p\"))", node->Name(), node->TokenName(),
node->label()->name().ToCString(), node->label()->owner());
}
-
void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) {
logger_->Print("(%s \"%s\" ", node->Name(),
node->function_name().ToCString());
@@ -324,7 +287,6 @@ void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitStaticCallNode(StaticCallNode* node) {
const char* function_fullname = node->function().ToFullyQualifiedCString();
logger_->Print("(%s \"%s\" ", node->Name(), function_fullname);
@@ -332,18 +294,15 @@ void AstPrinter::VisitStaticCallNode(StaticCallNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitClosureNode(ClosureNode* node) {
const char* function_fullname = node->function().ToFullyQualifiedCString();
logger_->Print("(%s \"%s\")", node->Name(), function_fullname);
}
-
void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) {
const char* kind = node->constructor().IsFactory() ? "factory " : "";
const char* constructor_name = node->constructor().ToFullyQualifiedCString();
@@ -352,34 +311,29 @@ void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) {
logger_->Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) {
logger_->Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString());
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) {
logger_->Print("(%s \"%s\")", node->Name(),
String::Handle(node->field().name()).ToCString());
}
-
void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) {
String& class_name = String::Handle(node->cls().Name());
logger_->Print("(%s \"%s.%s\")", node->Name(), class_name.ToCString(),
node->field_name().ToCString());
}
-
void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) {
String& class_name = String::Handle(node->cls().Name());
logger_->Print("(%s \"%s.%s\" ", node->Name(), class_name.ToCString(),
@@ -388,21 +342,18 @@ void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) {
logger_->Print("(%s%s ", node->Name(), node->IsSuperLoad() ? " super" : "");
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) {
logger_->Print("(%s%s ", node->Name(), node->IsSuperStore() ? " super" : "");
node->VisitChildren(this);
logger_->Print(")");
}
-
void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) {
logger_->Print(
"(%s \"%s\" (%" Pd " args))", node->Name(),
@@ -410,12 +361,10 @@ void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) {
NativeArguments::ParameterCountForResolution(node->function()));
}
-
void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitTryCatchNode(TryCatchNode* node) {
logger_->Print("(%s ", node->Name());
node->try_block()->Visit(this);
@@ -428,22 +377,18 @@ void AstPrinter::VisitTryCatchNode(TryCatchNode* node) {
logger_->Print(")");
}
-
void AstPrinter::VisitThrowNode(ThrowNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::VisitStopNode(StopNode* node) {
logger_->Print("(%s %s)", node->Name(), node->message());
}
-
void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) {
VisitGenericAstNode(node);
}
-
void AstPrinter::PrintNode(AstNode* node) {
ASSERT(node != NULL);
AstPrinter ast_printer;
@@ -451,14 +396,12 @@ void AstPrinter::PrintNode(AstNode* node) {
logger_->Print("\n");
}
-
void AstPrinter::IndentN(int count) {
for (int i = 0; i < count; i++) {
logger_->Print(" ");
}
}
-
void AstPrinter::PrintLocalScopeVariable(const LocalScope* scope,
LocalVariable* var,
int indent) {
@@ -483,7 +426,6 @@ void AstPrinter::PrintLocalScopeVariable(const LocalScope* scope,
scope->end_token_pos().ToCString());
}
-
void AstPrinter::PrintLocalScope(const LocalScope* scope,
int start_index,
int indent) {
@@ -508,7 +450,6 @@ void AstPrinter::PrintLocalScope(const LocalScope* scope,
}
}
-
void AstPrinter::PrintFunctionScope(const ParsedFunction& parsed_function) {
HANDLESCOPE(parsed_function.thread());
const Function& function = parsed_function.function();
@@ -557,7 +498,6 @@ void AstPrinter::PrintFunctionScope(const ParsedFunction& parsed_function) {
logger_->Print("}\n");
}
-
void AstPrinter::PrintFunctionNodes(const ParsedFunction& parsed_function) {
HANDLESCOPE(parsed_function.thread());
SequenceNode* node_sequence = parsed_function.node_sequence();
« no previous file with comments | « runtime/vm/ast.cc ('k') | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698