OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 writeBodyModifiers(e); | 436 writeBodyModifiers(e); |
437 | 437 |
438 buffer.writeln(' {}'); | 438 buffer.writeln(' {}'); |
439 } | 439 } |
440 | 440 |
441 void writeFunctionTypeAliasElement(FunctionTypeAliasElement e) { | 441 void writeFunctionTypeAliasElement(FunctionTypeAliasElement e) { |
442 writeDocumentation(e); | 442 writeDocumentation(e); |
443 writeMetadata(e, '', '\n'); | 443 writeMetadata(e, '', '\n'); |
444 | 444 |
445 buffer.write('typedef '); | 445 if (e is GenericTypeAliasElement) { |
446 writeType2(e.returnType); | 446 buffer.write('typedef '); |
| 447 writeName(e); |
| 448 writeTypeParameterElements(e.typeParameters); |
447 | 449 |
448 writeName(e); | 450 buffer.write(' = '); |
449 | 451 |
450 writeTypeParameterElements(e.typeParameters); | 452 writeType(e.function.returnType); |
451 writeParameterElements(e.parameters); | 453 buffer.write(' Function'); |
| 454 writeTypeParameterElements(e.function.typeParameters); |
| 455 writeParameterElements(e.function.parameters); |
| 456 } else { |
| 457 buffer.write('typedef '); |
| 458 writeType2(e.returnType); |
| 459 |
| 460 writeName(e); |
| 461 |
| 462 writeTypeParameterElements(e.typeParameters); |
| 463 writeParameterElements(e.parameters); |
| 464 } |
452 | 465 |
453 buffer.writeln(';'); | 466 buffer.writeln(';'); |
454 } | 467 } |
455 | 468 |
456 void writeIf(bool flag, String str) { | 469 void writeIf(bool flag, String str) { |
457 if (flag) { | 470 if (flag) { |
458 buffer.write(str); | 471 buffer.write(str); |
459 } | 472 } |
460 } | 473 } |
461 | 474 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 return components.join(';'); | 817 return components.join(';'); |
805 } | 818 } |
806 } | 819 } |
807 | 820 |
808 class _Replacement { | 821 class _Replacement { |
809 final int offset; | 822 final int offset; |
810 final int end; | 823 final int end; |
811 final String text; | 824 final String text; |
812 _Replacement(this.offset, this.end, this.text); | 825 _Replacement(this.offset, this.end, this.text); |
813 } | 826 } |
OLD | NEW |