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

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

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 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
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 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens 6 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens
7 show IDENTIFIER_TOKEN, KEYWORD_TOKEN, PLUS_TOKEN; 7 show IDENTIFIER_TOKEN, KEYWORD_TOKEN, PLUS_TOKEN;
8 import '../util/util.dart'; 8 import '../util/util.dart';
9 import 'nodes.dart'; 9 import 'nodes.dart';
10 10
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 write(' '); 541 write(' ');
542 visit(node.expression); 542 visit(node.expression);
543 } 543 }
544 544
545 visitAwait(Await node) { 545 visitAwait(Await node) {
546 write(node.awaitToken.value); 546 write(node.awaitToken.value);
547 write(' '); 547 write(' ');
548 visit(node.expression); 548 visit(node.expression);
549 } 549 }
550 550
551 visitTypeAnnotation(TypeAnnotation node) { 551 visitNominalTypeAnnotation(NominalTypeAnnotation node) {
552 visit(node.typeName); 552 visit(node.typeName);
553 visit(node.typeArguments); 553 visit(node.typeArguments);
554 } 554 }
555 555
556 visitFunctionTypeAnnotation(FunctionTypeAnnotation node) {
557 visit(node.returnType);
558 write(' Function');
559 visit(node.typeParameters);
560 visit(node.formals);
561 }
562
556 visitTypeVariable(TypeVariable node) { 563 visitTypeVariable(TypeVariable node) {
557 visit(node.name); 564 visit(node.name);
558 if (node.bound != null) { 565 if (node.bound != null) {
559 write(' extends '); 566 write(' extends ');
560 visit(node.bound); 567 visit(node.bound);
561 } 568 }
562 } 569 }
563 570
564 visitVariableDefinitions(VariableDefinitions node) { 571 visitVariableDefinitions(VariableDefinitions node) {
565 if (node.metadata != null) { 572 if (node.metadata != null) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 visit(node.block); 771 visit(node.block);
765 } 772 }
766 773
767 visitTypedef(Typedef node) { 774 visitTypedef(Typedef node) {
768 addToken(node.typedefKeyword); 775 addToken(node.typedefKeyword);
769 if (node.returnType != null) { 776 if (node.returnType != null) {
770 visit(node.returnType); 777 visit(node.returnType);
771 write(' '); 778 write(' ');
772 } 779 }
773 visit(node.name); 780 visit(node.name);
774 if (node.typeParameters != null) { 781 if (node.templateParameters != null) {
775 visit(node.typeParameters); 782 visit(node.templateParameters);
776 } 783 }
777 visit(node.formals); 784 visit(node.formals);
778 write(node.endToken.value); 785 write(node.endToken.value);
779 } 786 }
780 787
781 visitLibraryName(LibraryName node) { 788 visitLibraryName(LibraryName node) {
782 addToken(node.libraryKeyword); 789 addToken(node.libraryKeyword);
783 node.visitChildren(this); 790 node.visitChildren(this);
784 write(node.getEndToken().value); 791 write(node.getEndToken().value);
785 newline(); 792 newline();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 throw 'internal error'; // Should not be called. 904 throw 'internal error'; // Should not be called.
898 } 905 }
899 906
900 visitStatement(Statement node) { 907 visitStatement(Statement node) {
901 throw 'internal error'; // Should not be called. 908 throw 'internal error'; // Should not be called.
902 } 909 }
903 910
904 visitStringNode(StringNode node) { 911 visitStringNode(StringNode node) {
905 throw 'internal error'; // Should not be called. 912 throw 'internal error'; // Should not be called.
906 } 913 }
914
915 visitTypeAnnotation(TypeAnnotation node) {
916 throw 'internal error'; // Should not be called.
917 }
907 } 918 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698