| OLD | NEW |
| 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 672 } |
| 673 writeWord('field'); | 673 writeWord('field'); |
| 674 writeSpace(); | 674 writeSpace(); |
| 675 writeAnnotatedType(node.type, annotator?.annotateField(this, node)); | 675 writeAnnotatedType(node.type, annotator?.annotateField(this, node)); |
| 676 writeName(getMemberName(node)); | 676 writeName(getMemberName(node)); |
| 677 if (node.initializer != null) { | 677 if (node.initializer != null) { |
| 678 writeSpaced('='); | 678 writeSpaced('='); |
| 679 writeExpression(node.initializer); | 679 writeExpression(node.initializer); |
| 680 } | 680 } |
| 681 if ((node.enclosingClass == null && | 681 if ((node.enclosingClass == null && |
| 682 node.enclosingLibrary.fileUri != node.fileUri) || | 682 node.enclosingLibrary.fileUri != node.fileUri) || |
| 683 (node.enclosingClass != null && | 683 (node.enclosingClass != null && |
| 684 node.enclosingClass.fileUri != node.fileUri)) { | 684 node.enclosingClass.fileUri != node.fileUri)) { |
| 685 writeWord("/* from ${node.fileUri} */"); | 685 writeWord("/* from ${node.fileUri} */"); |
| 686 } | 686 } |
| 687 endLine(';'); | 687 endLine(';'); |
| 688 } | 688 } |
| 689 | 689 |
| 690 visitProcedure(Procedure node) { | 690 visitProcedure(Procedure node) { |
| 691 writeAnnotationList(node.annotations); | 691 writeAnnotationList(node.annotations); |
| 692 writeIndentation(); | 692 writeIndentation(); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 } | 1320 } |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 visitArguments(Arguments node) { | 1323 visitArguments(Arguments node) { |
| 1324 if (node.types.isNotEmpty) { | 1324 if (node.types.isNotEmpty) { |
| 1325 writeSymbol('<'); | 1325 writeSymbol('<'); |
| 1326 writeList(node.types, writeType); | 1326 writeList(node.types, writeType); |
| 1327 writeSymbol('>'); | 1327 writeSymbol('>'); |
| 1328 } | 1328 } |
| 1329 writeSymbol('('); | 1329 writeSymbol('('); |
| 1330 var allArgs = [node.positional, node.named].expand((x) => x); | 1330 var allArgs = |
| 1331 <List<TreeNode>>[node.positional, node.named].expand((x) => x); |
| 1331 writeList(allArgs, writeNode); | 1332 writeList(allArgs, writeNode); |
| 1332 writeSymbol(')'); | 1333 writeSymbol(')'); |
| 1333 } | 1334 } |
| 1334 | 1335 |
| 1335 visitNamedExpression(NamedExpression node) { | 1336 visitNamedExpression(NamedExpression node) { |
| 1336 writeWord(node.name); | 1337 writeWord(node.name); |
| 1337 writeComma(':'); | 1338 writeComma(':'); |
| 1338 writeExpression(node.value); | 1339 writeExpression(node.value); |
| 1339 } | 1340 } |
| 1340 | 1341 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 } | 1550 } |
| 1550 throw 'illegal ProcedureKind: $kind'; | 1551 throw 'illegal ProcedureKind: $kind'; |
| 1551 } | 1552 } |
| 1552 | 1553 |
| 1553 class ExpressionPrinter { | 1554 class ExpressionPrinter { |
| 1554 final Printer writeer; | 1555 final Printer writeer; |
| 1555 final int minimumPrecedence; | 1556 final int minimumPrecedence; |
| 1556 | 1557 |
| 1557 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1558 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
| 1558 } | 1559 } |
| OLD | NEW |