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

Side by Side Diff: lib/text/ast_to_text.dart

Issue 2439043002: Introduce Substitution class and Supertype class. (Closed)
Patch Set: Created 4 years, 2 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 | « lib/class_hierarchy.dart ('k') | lib/transformations/treeshaker.dart » ('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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.ast_to_text; 4 library kernel.ast_to_text;
5 5
6 import '../ast.dart'; 6 import '../ast.dart';
7 import '../import_table.dart'; 7 import '../import_table.dart';
8 import '../type_propagation/type_propagation.dart'; 8 import '../type_propagation/type_propagation.dart';
9 9
10 class Namer<T> { 10 class Namer<T> {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 type.accept(this); 412 type.accept(this);
413 } 413 }
414 } 414 }
415 415
416 void writeOptionalType(DartType type) { 416 void writeOptionalType(DartType type) {
417 if (type != null) { 417 if (type != null) {
418 type.accept(this); 418 type.accept(this);
419 } 419 }
420 } 420 }
421 421
422 visitSupertype(Supertype type) {
423 if (type == null) {
424 print('<No Supertype>');
425 } else {
426 writeClassReference(type.classNode);
427 if (type.typeArguments.isNotEmpty) {
428 writeSymbol('<');
429 writeList(type.typeArguments, writeType);
430 writeSymbol('>');
431 }
432 }
433 }
434
422 void writeModifier(bool isThere, String name) { 435 void writeModifier(bool isThere, String name) {
423 if (isThere) { 436 if (isThere) {
424 writeWord(name); 437 writeWord(name);
425 } 438 }
426 } 439 }
427 440
428 void writeName(Name name) { 441 void writeName(Name name) {
429 if (name?.name == '') { 442 if (name?.name == '') {
430 writeWord(emptyNameString); 443 writeWord(emptyNameString);
431 } else { 444 } else {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 715
703 visitClass(Class node) { 716 visitClass(Class node) {
704 writeAnnotationList(node.annotations); 717 writeAnnotationList(node.annotations);
705 writeIndentation(); 718 writeIndentation();
706 writeModifier(node.isAbstract, 'abstract'); 719 writeModifier(node.isAbstract, 'abstract');
707 writeWord('class'); 720 writeWord('class');
708 writeWord(getClassName(node)); 721 writeWord(getClassName(node));
709 writeTypeParameterList(node.typeParameters); 722 writeTypeParameterList(node.typeParameters);
710 if (node.isMixinApplication) { 723 if (node.isMixinApplication) {
711 writeSpaced('='); 724 writeSpaced('=');
712 writeType(node.supertype); 725 visitSupertype(node.supertype);
713 writeSpaced('with'); 726 writeSpaced('with');
714 writeType(node.mixedInType); 727 visitSupertype(node.mixedInType);
715 } else if (node.supertype != null) { 728 } else if (node.supertype != null) {
716 writeSpaced('extends'); 729 writeSpaced('extends');
717 writeType(node.supertype); 730 visitSupertype(node.supertype);
718 } 731 }
719 if (node.implementedTypes.isNotEmpty) { 732 if (node.implementedTypes.isNotEmpty) {
720 writeSpaced('implements'); 733 writeSpaced('implements');
721 writeList(node.implementedTypes, writeType); 734 writeList(node.implementedTypes, visitSupertype);
722 } 735 }
723 var endLineString = ' {'; 736 var endLineString = ' {';
724 if (node.enclosingLibrary.fileUri != node.fileUri) { 737 if (node.enclosingLibrary.fileUri != node.fileUri) {
725 endLineString += ' // from ${node.fileUri}'; 738 endLineString += ' // from ${node.fileUri}';
726 } 739 }
727 endLine(endLineString); 740 endLine(endLineString);
728 ++indentation; 741 ++indentation;
729 node.fields.forEach(writeNode); 742 node.fields.forEach(writeNode);
730 node.constructors.forEach(writeNode); 743 node.constructors.forEach(writeNode);
731 node.procedures.forEach(writeNode); 744 node.procedures.forEach(writeNode);
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 } 1549 }
1537 throw 'illegal ProcedureKind: $kind'; 1550 throw 'illegal ProcedureKind: $kind';
1538 } 1551 }
1539 1552
1540 class ExpressionPrinter { 1553 class ExpressionPrinter {
1541 final Printer writeer; 1554 final Printer writeer;
1542 final int minimumPrecedence; 1555 final int minimumPrecedence;
1543 1556
1544 ExpressionPrinter(this.writeer, this.minimumPrecedence); 1557 ExpressionPrinter(this.writeer, this.minimumPrecedence);
1545 } 1558 }
OLDNEW
« no previous file with comments | « lib/class_hierarchy.dart ('k') | lib/transformations/treeshaker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698