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

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

Issue 2616163002: Remove REPLACE_IMPORT_URI Quick Fix. (Closed)
Patch Set: Created 3 years, 11 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/plugin/protocol/protocol.dart' 9 import 'package:analysis_server/plugin/protocol/protocol.dart'
10 show SourceChange, SourceEdit; 10 show SourceChange, SourceEdit;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 if (parent is PropertyAccess && parent.propertyName == node) { 152 if (parent is PropertyAccess && parent.propertyName == node) {
153 node = parent; 153 node = parent;
154 continue; 154 continue;
155 } 155 }
156 return node; 156 return node;
157 } 157 }
158 } 158 }
159 159
160 /** 160 /**
161 * Attempts to convert the given absolute path into an absolute URI, such as
162 * "dart" or "package" URI.
163 *
164 * [context] - the [AnalysisContext] to work in.
165 * [path] - the absolute path, not `null`.
166 *
167 * Returns the absolute (non-file) URI or `null`.
168 */
169 String findNonFileUri(AnalysisContext context, String path) {
170 Source fileSource =
171 new NonExistingSource(path, toUri(path), UriKind.FILE_URI);
172 Uri uri = context.sourceFactory.restoreUri(fileSource);
173 if (uri == null || uri.scheme == 'file') {
174 return null;
175 }
176 return uri.toString();
177 }
178
179 /**
180 * Returns the EOL to use for the given [code]. 161 * Returns the EOL to use for the given [code].
181 */ 162 */
182 String getCodeEndOfLine(String code) { 163 String getCodeEndOfLine(String code) {
183 if (code.contains('\r\n')) { 164 if (code.contains('\r\n')) {
184 return '\r\n'; 165 return '\r\n';
185 } 166 }
186 return '\n'; 167 return '\n';
187 } 168 }
188 169
189 /** 170 /**
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 _InvertedCondition expr, int newOperatorPrecedence) { 1646 _InvertedCondition expr, int newOperatorPrecedence) {
1666 if (expr._precedence < newOperatorPrecedence) { 1647 if (expr._precedence < newOperatorPrecedence) {
1667 return "(${expr._source})"; 1648 return "(${expr._source})";
1668 } 1649 }
1669 return expr._source; 1650 return expr._source;
1670 } 1651 }
1671 1652
1672 static _InvertedCondition _simple(String source) => 1653 static _InvertedCondition _simple(String source) =>
1673 new _InvertedCondition(2147483647, source); 1654 new _InvertedCondition(2147483647, source);
1674 } 1655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698