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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 buffer.write(' show '); | 581 buffer.write(' show '); |
582 buffer.write(e.shownNames.join(', ')); | 582 buffer.write(e.shownNames.join(', ')); |
583 } else if (e is HideElementCombinator) { | 583 } else if (e is HideElementCombinator) { |
584 buffer.write(' hide '); | 584 buffer.write(' hide '); |
585 buffer.write(e.hiddenNames.join(', ')); | 585 buffer.write(e.hiddenNames.join(', ')); |
586 } | 586 } |
587 } | 587 } |
588 | 588 |
589 void writeParameterElement(ParameterElement e) { | 589 void writeParameterElement(ParameterElement e) { |
590 String defaultValueSeparator; | 590 String defaultValueSeparator; |
591 Expression defaultValue = | 591 Expression defaultValue = e is ConstVariableElement |
592 e is DefaultParameterElementImpl ? e.constantInitializer : null; | 592 ? (e as ConstVariableElement).constantInitializer |
| 593 : null; |
593 String closeString; | 594 String closeString; |
594 ParameterKind kind = e.parameterKind; | 595 ParameterKind kind = e.parameterKind; |
595 if (kind == ParameterKind.REQUIRED) { | 596 if (kind == ParameterKind.REQUIRED) { |
596 closeString = ''; | 597 closeString = ''; |
597 } else if (kind == ParameterKind.POSITIONAL) { | 598 } else if (kind == ParameterKind.POSITIONAL) { |
598 buffer.write('['); | 599 buffer.write('['); |
599 defaultValueSeparator = ' = '; | 600 defaultValueSeparator = ' = '; |
600 closeString = ']'; | 601 closeString = ']'; |
601 } else if (kind == ParameterKind.NAMED) { | 602 } else if (kind == ParameterKind.NAMED) { |
602 buffer.write('{'); | 603 buffer.write('{'); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 return components.join(';'); | 859 return components.join(';'); |
859 } | 860 } |
860 } | 861 } |
861 | 862 |
862 class _Replacement { | 863 class _Replacement { |
863 final int offset; | 864 final int offset; |
864 final int end; | 865 final int end; |
865 final String text; | 866 final String text; |
866 _Replacement(this.offset, this.end, this.text); | 867 _Replacement(this.offset, this.end, this.text); |
867 } | 868 } |
OLD | NEW |