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

Side by Side Diff: pkg/compiler/lib/src/tree/prettyprint.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 years, 9 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
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 import 'package:front_end/src/fasta/scanner.dart' show Token; 5 import 'package:front_end/src/fasta/scanner.dart' show Token;
6 import '../util/util.dart'; 6 import '../util/util.dart';
7 import 'nodes.dart'; 7 import 'nodes.dart';
8 8
9 /** 9 /**
10 * Pretty-prints Node tree in XML-like format. 10 * Pretty-prints Node tree in XML-like format.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 {"getOrSet": tokenToStringOrNull(node.getOrSet)}); 146 {"getOrSet": tokenToStringOrNull(node.getOrSet)});
147 visitChildNode(node.modifiers, "modifiers"); 147 visitChildNode(node.modifiers, "modifiers");
148 visitChildNode(node.returnType, "returnType"); 148 visitChildNode(node.returnType, "returnType");
149 visitChildNode(node.name, "name"); 149 visitChildNode(node.name, "name");
150 visitChildNode(node.parameters, "parameters"); 150 visitChildNode(node.parameters, "parameters");
151 visitChildNode(node.initializers, "initializers"); 151 visitChildNode(node.initializers, "initializers");
152 visitChildNode(node.body, "body"); 152 visitChildNode(node.body, "body");
153 closeNode(); 153 closeNode();
154 } 154 }
155 155
156 visitFunctionTypeAnnotation(FunctionTypeAnnotation node) {
157 openNode(node, "FunctionTypeAnnotation");
158 visitChildNode(node.returnType, "returnType");
159 visitChildNode(node.typeParameters, "typeParameters");
160 visitChildNode(node.formals, "formals");
161 closeNode();
162 }
163
156 visitIdentifier(Identifier node) { 164 visitIdentifier(Identifier node) {
157 openAndCloseNode(node, "Identifier", {"token": node.token}); 165 openAndCloseNode(node, "Identifier", {"token": node.token});
158 } 166 }
159 167
160 visitIf(If node) { 168 visitIf(If node) {
161 visitNodeWithChildren(node, "If"); 169 visitNodeWithChildren(node, "If");
162 } 170 }
163 171
164 visitLabel(Label node) { 172 visitLabel(Label node) {
165 visitNodeWithChildren(node, "Label"); 173 visitNodeWithChildren(node, "Label");
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 var params = {"delimiter": node.delimiter}; 245 var params = {"delimiter": node.delimiter};
238 if (node.isEmpty) { 246 if (node.isEmpty) {
239 openAndCloseNode(node, "NodeList", params); 247 openAndCloseNode(node, "NodeList", params);
240 } else { 248 } else {
241 openNode(node, "NodeList", params); 249 openNode(node, "NodeList", params);
242 node.visitChildren(this); 250 node.visitChildren(this);
243 closeNode(); 251 closeNode();
244 } 252 }
245 } 253 }
246 254
255 visitNominalTypeAnnotation(NominalTypeAnnotation node) {
256 openNode(node, "NominalTypeAnnotation");
257 visitChildNode(node.typeName, "typeName");
258 visitChildNode(node.typeArguments, "typeArguments");
259 closeNode();
260 }
261
247 visitOperator(Operator node) { 262 visitOperator(Operator node) {
248 openAndCloseNode(node, "Operator", {"value": node.token}); 263 openAndCloseNode(node, "Operator", {"value": node.token});
249 } 264 }
250 265
251 visitParenthesizedExpression(ParenthesizedExpression node) { 266 visitParenthesizedExpression(ParenthesizedExpression node) {
252 visitNodeWithChildren(node, "ParenthesizedExpression"); 267 visitNodeWithChildren(node, "ParenthesizedExpression");
253 } 268 }
254 269
255 visitRedirectingFactoryBody(RedirectingFactoryBody node) { 270 visitRedirectingFactoryBody(RedirectingFactoryBody node) {
256 openNode(node, "RedirectingFactoryBody"); 271 openNode(node, "RedirectingFactoryBody");
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 353 }
339 354
340 visitAwait(Await node) { 355 visitAwait(Await node) {
341 visitNodeWithChildren(node, "Await"); 356 visitNodeWithChildren(node, "Await");
342 } 357 }
343 358
344 visitTryStatement(TryStatement node) { 359 visitTryStatement(TryStatement node) {
345 visitNodeWithChildren(node, "TryStatement"); 360 visitNodeWithChildren(node, "TryStatement");
346 } 361 }
347 362
348 visitTypeAnnotation(TypeAnnotation node) {
349 openNode(node, "TypeAnnotation");
350 visitChildNode(node.typeName, "typeName");
351 visitChildNode(node.typeArguments, "typeArguments");
352 closeNode();
353 }
354
355 visitTypedef(Typedef node) { 363 visitTypedef(Typedef node) {
356 visitNodeWithChildren(node, "Typedef"); 364 visitNodeWithChildren(node, "Typedef");
357 } 365 }
358 366
359 visitTypeVariable(TypeVariable node) { 367 visitTypeVariable(TypeVariable node) {
360 openNode(node, "TypeVariable"); 368 openNode(node, "TypeVariable");
361 visitChildNode(node.name, "name"); 369 visitChildNode(node.name, "name");
362 visitChildNode(node.bound, "bound"); 370 visitChildNode(node.bound, "bound");
363 closeNode(); 371 closeNode();
364 } 372 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 473 }
466 474
467 visitExpression(Expression node) { 475 visitExpression(Expression node) {
468 unimplemented('visitNode', node: node); 476 unimplemented('visitNode', node: node);
469 } 477 }
470 478
471 visitGotoStatement(GotoStatement node) { 479 visitGotoStatement(GotoStatement node) {
472 unimplemented('visitNode', node: node); 480 unimplemented('visitNode', node: node);
473 } 481 }
474 482
483 visitTypeAnnotation(TypeAnnotation node) {
484 unimplemented('visitNode', node: node);
485 }
486
475 unimplemented(String message, {Node node}) { 487 unimplemented(String message, {Node node}) {
476 throw message; 488 throw message;
477 } 489 }
478 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698