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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 /** | 98 /** |
99 * Attempts to convert the given absolute path into an absolute URI, such as | 99 * Attempts to convert the given absolute path into an absolute URI, such as |
100 * "dart" or "package" URI. | 100 * "dart" or "package" URI. |
101 * | 101 * |
102 * [context] - the [AnalysisContext] to work in. | 102 * [context] - the [AnalysisContext] to work in. |
103 * [path] - the absolute path, not `null`. | 103 * [path] - the absolute path, not `null`. |
104 * | 104 * |
105 * Returns the absolute (non-file) URI or `null`. | 105 * Returns the absolute (non-file) URI or `null`. |
106 */ | 106 */ |
107 String findAbsoluteUri(AnalysisContext context, String path) { | 107 String findAbsoluteUri(AnalysisContext context, String path) { |
108 Source fileSource = new NonExistingSource(path, UriKind.FILE_URI); | 108 Source fileSource = new NonExistingSource(path, null, UriKind.FILE_URI); |
109 Uri uri = context.sourceFactory.restoreUri(fileSource); | 109 Uri uri = context.sourceFactory.restoreUri(fileSource); |
110 if (uri == null) { | 110 if (uri == null) { |
111 return null; | 111 return null; |
112 } | 112 } |
113 return uri.toString(); | 113 return uri.toString(); |
114 } | 114 } |
115 | 115 |
116 /** | 116 /** |
117 * Returns the EOL to use for the given [code]. | 117 * Returns the EOL to use for the given [code]. |
118 */ | 118 */ |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 | 1558 |
1559 @override | 1559 @override |
1560 Object visitExpression(Expression node) { | 1560 Object visitExpression(Expression node) { |
1561 if (node is BinaryExpression && node.operator.type == groupOperatorType) { | 1561 if (node is BinaryExpression && node.operator.type == groupOperatorType) { |
1562 return super.visitNode(node); | 1562 return super.visitNode(node); |
1563 } | 1563 } |
1564 operands.add(node); | 1564 operands.add(node); |
1565 return null; | 1565 return null; |
1566 } | 1566 } |
1567 } | 1567 } |
OLD | NEW |