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/src/protocol.dart' | 9 import 'package:analysis_server/src/protocol.dart' |
10 show SourceChange, SourceEdit; | 10 show SourceChange, SourceEdit; |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 } | 1023 } |
1024 | 1024 |
1025 /** | 1025 /** |
1026 * Returns the source to reference [type] in this [CompilationUnit]. | 1026 * Returns the source to reference [type] in this [CompilationUnit]. |
1027 * | 1027 * |
1028 * Fills [librariesToImport] with [LibraryElement]s whose elements are | 1028 * Fills [librariesToImport] with [LibraryElement]s whose elements are |
1029 * used by the generated source, but not imported. | 1029 * used by the generated source, but not imported. |
1030 */ | 1030 */ |
1031 String getTypeSource(DartType type, Set<LibraryElement> librariesToImport) { | 1031 String getTypeSource(DartType type, Set<LibraryElement> librariesToImport) { |
1032 StringBuffer sb = new StringBuffer(); | 1032 StringBuffer sb = new StringBuffer(); |
| 1033 // type parameter |
| 1034 if (!_isTypeVisible(type)) { |
| 1035 return 'dynamic'; |
| 1036 } |
1033 // just a Function, not FunctionTypeAliasElement | 1037 // just a Function, not FunctionTypeAliasElement |
1034 if (type is FunctionType && type.element is! FunctionTypeAliasElement) { | 1038 if (type is FunctionType && type.element is! FunctionTypeAliasElement) { |
1035 return "Function"; | 1039 return "Function"; |
1036 } | 1040 } |
1037 // BottomType | 1041 // BottomType |
1038 if (type.isBottom) { | 1042 if (type.isBottom) { |
1039 return 'dynamic'; | 1043 return 'dynamic'; |
1040 } | 1044 } |
1041 // prepare element | 1045 // prepare element |
1042 Element element = type.element; | 1046 Element element = type.element; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 | 1562 |
1559 @override | 1563 @override |
1560 Object visitExpression(Expression node) { | 1564 Object visitExpression(Expression node) { |
1561 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1565 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
1562 return super.visitNode(node); | 1566 return super.visitNode(node); |
1563 } | 1567 } |
1564 operands.add(node); | 1568 operands.add(node); |
1565 return null; | 1569 return null; |
1566 } | 1570 } |
1567 } | 1571 } |
OLD | NEW |