OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library services.src.correction.util; | 5 library services.src.correction.util; |
6 | 6 |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart' | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' |
10 show SourceChange, SourceEdit; | 10 show SourceChange, SourceEdit; |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 if (parametersBuffer.length != 1) { | 1122 if (parametersBuffer.length != 1) { |
1123 parametersBuffer.write(', '); | 1123 parametersBuffer.write(', '); |
1124 } | 1124 } |
1125 parametersBuffer.write(parameterType); | 1125 parametersBuffer.write(parameterType); |
1126 parametersBuffer.write(' '); | 1126 parametersBuffer.write(' '); |
1127 parametersBuffer.write(parameter.name); | 1127 parametersBuffer.write(parameter.name); |
1128 } | 1128 } |
1129 parametersBuffer.write(')'); | 1129 parametersBuffer.write(')'); |
1130 return getTypeSource(type.returnType, librariesToImport); | 1130 return getTypeSource(type.returnType, librariesToImport); |
1131 } | 1131 } |
1132 // BottomType | 1132 // <Bottom>, Null |
1133 if (type.isBottom) { | 1133 if (type.isBottom || type.isDartCoreNull) { |
1134 return 'dynamic'; | 1134 return 'dynamic'; |
1135 } | 1135 } |
1136 // prepare element | 1136 // prepare element |
1137 Element element = type.element; | 1137 Element element = type.element; |
1138 if (element == null) { | 1138 if (element == null) { |
1139 String source = type.toString(); | 1139 String source = type.toString(); |
1140 source = source.replaceAll('<dynamic>', ''); | 1140 source = source.replaceAll('<dynamic>', ''); |
1141 source = source.replaceAll('<dynamic, dynamic>', ''); | 1141 source = source.replaceAll('<dynamic, dynamic>', ''); |
1142 return source; | 1142 return source; |
1143 } | 1143 } |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 _InvertedCondition expr, int newOperatorPrecedence) { | 1646 _InvertedCondition expr, int newOperatorPrecedence) { |
1647 if (expr._precedence < newOperatorPrecedence) { | 1647 if (expr._precedence < newOperatorPrecedence) { |
1648 return "(${expr._source})"; | 1648 return "(${expr._source})"; |
1649 } | 1649 } |
1650 return expr._source; | 1650 return expr._source; |
1651 } | 1651 } |
1652 | 1652 |
1653 static _InvertedCondition _simple(String source) => | 1653 static _InvertedCondition _simple(String source) => |
1654 new _InvertedCondition(2147483647, source); | 1654 new _InvertedCondition(2147483647, source); |
1655 } | 1655 } |
OLD | NEW |