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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 } | 1384 } |
1385 writeSymbol('['); | 1385 writeSymbol('['); |
1386 writeList(positional.skip(node.requiredParameterCount), writeType); | 1386 writeList(positional.skip(node.requiredParameterCount), writeType); |
1387 writeSymbol(']'); | 1387 writeSymbol(']'); |
1388 } | 1388 } |
1389 if (node.namedParameters.isNotEmpty) { | 1389 if (node.namedParameters.isNotEmpty) { |
1390 if (node.positionalParameters.isNotEmpty) { | 1390 if (node.positionalParameters.isNotEmpty) { |
1391 writeComma(); | 1391 writeComma(); |
1392 } | 1392 } |
1393 writeSymbol('{'); | 1393 writeSymbol('{'); |
1394 writeList(node.namedParameters.keys, (name) { | 1394 writeList(node.namedParameters, visitNamedType); |
1395 writeType(node.namedParameters[name]); | |
1396 writeWord(name); | |
1397 }); | |
1398 writeSymbol('}'); | 1395 writeSymbol('}'); |
1399 } | 1396 } |
1400 writeSymbol(')'); | 1397 writeSymbol(')'); |
1401 writeSpaced('→'); | 1398 writeSpaced('→'); |
1402 writeType(node.returnType); | 1399 writeType(node.returnType); |
1403 } | 1400 } |
1404 | 1401 |
| 1402 visitNamedType(NamedType node) { |
| 1403 writeWord(node.name); |
| 1404 writeSymbol(':'); |
| 1405 writeSpace(); |
| 1406 writeType(node.type); |
| 1407 } |
| 1408 |
1405 visitTypeParameterType(TypeParameterType node) { | 1409 visitTypeParameterType(TypeParameterType node) { |
1406 writeTypeParameterReference(node.parameter); | 1410 writeTypeParameterReference(node.parameter); |
1407 } | 1411 } |
1408 | 1412 |
1409 visitTypeParameter(TypeParameter node) { | 1413 visitTypeParameter(TypeParameter node) { |
1410 writeWord(getTypeParameterName(node)); | 1414 writeWord(getTypeParameterName(node)); |
1411 writeSpaced('extends'); | 1415 writeSpaced('extends'); |
1412 writeType(node.bound); | 1416 writeType(node.bound); |
1413 } | 1417 } |
1414 | 1418 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 } | 1529 } |
1526 throw 'illegal ProcedureKind: $kind'; | 1530 throw 'illegal ProcedureKind: $kind'; |
1527 } | 1531 } |
1528 | 1532 |
1529 class ExpressionPrinter { | 1533 class ExpressionPrinter { |
1530 final Printer writeer; | 1534 final Printer writeer; |
1531 final int minimumPrecedence; | 1535 final int minimumPrecedence; |
1532 | 1536 |
1533 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1537 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
1534 } | 1538 } |
OLD | NEW |