Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/util.dart

Issue 1281313002: Fix regression in import fixups introduced by .packages support. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cleaner fix Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
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 findNonFileUri(AnalysisContext context, String path) {
108 Source fileSource = new NonExistingSource(path, null, UriKind.FILE_URI); 108 Source fileSource =
109 new NonExistingSource(path, toUri(path), UriKind.FILE_URI);
109 Uri uri = context.sourceFactory.restoreUri(fileSource); 110 Uri uri = context.sourceFactory.restoreUri(fileSource);
110 if (uri == null) { 111 if (uri == null || uri.scheme == 'file') {
111 return null; 112 return null;
112 } 113 }
113 return uri.toString(); 114 return uri.toString();
114 } 115 }
115 116
116 /** 117 /**
117 * Returns the EOL to use for the given [code]. 118 * Returns the EOL to use for the given [code].
118 */ 119 */
119 String getCodeEndOfLine(String code) { 120 String getCodeEndOfLine(String code) {
120 if (code.contains('\r\n')) { 121 if (code.contains('\r\n')) {
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1563
1563 @override 1564 @override
1564 Object visitExpression(Expression node) { 1565 Object visitExpression(Expression node) {
1565 if (node is BinaryExpression && node.operator.type == groupOperatorType) { 1566 if (node is BinaryExpression && node.operator.type == groupOperatorType) {
1566 return super.visitNode(node); 1567 return super.visitNode(node);
1567 } 1568 }
1568 operands.add(node); 1569 operands.add(node);
1569 return null; 1570 return null;
1570 } 1571 }
1571 } 1572 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698