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

Side by Side Diff: pkg/analyzer/lib/file_system/file_system.dart

Issue 1296653003: Fix most implementations of UriResolver.restoreAbsolute. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 file_system; 5 library file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:path/path.dart'; 10 import 'package:path/path.dart';
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 * [Resource]s. 133 * [Resource]s.
134 */ 134 */
135 abstract class ResourceProvider { 135 abstract class ResourceProvider {
136 /** 136 /**
137 * Get the path context used by this resource provider. 137 * Get the path context used by this resource provider.
138 */ 138 */
139 Context get pathContext; 139 Context get pathContext;
140 140
141 /** 141 /**
142 * Return a [File] that corresponds to the given [path]. 142 * Return a [File] that corresponds to the given [path].
143 * 143 *
144 * A file may or may not exist at this location. 144 * A file may or may not exist at this location.
145 */ 145 */
146 File getFile(String path); 146 File getFile(String path);
147 147
148 /** 148 /**
149 * Return a [Folder] that corresponds to the given [path]. 149 * Return a [Folder] that corresponds to the given [path].
150 * 150 *
151 * A folder may or may not exist at this location. 151 * A folder may or may not exist at this location.
152 */ 152 */
153 Folder getFolder(String path); 153 Folder getFolder(String path);
154 154
155 /** 155 /**
156 * Return the [Resource] that corresponds to the given [path]. 156 * Return the [Resource] that corresponds to the given [path].
157 */ 157 */
158 Resource getResource(String path); 158 Resource getResource(String path);
159 159
160 /** 160 /**
(...skipping 26 matching lines...) Expand all
187 } 187 }
188 Resource resource = 188 Resource resource =
189 _provider.getResource(_provider.pathContext.fromUri(uri)); 189 _provider.getResource(_provider.pathContext.fromUri(uri));
190 if (resource is File) { 190 if (resource is File) {
191 return resource.createSource(actualUri != null ? actualUri : uri); 191 return resource.createSource(actualUri != null ? actualUri : uri);
192 } 192 }
193 return null; 193 return null;
194 } 194 }
195 195
196 @override 196 @override
197 Uri restoreAbsolute(Source source) => source.uri; 197 Uri restoreAbsolute(Source source) =>
198 _provider.pathContext.toUri(source.fullName);
198 199
199 /** 200 /**
200 * Return `true` if the given [uri] is a `file` URI. 201 * Return `true` if the given [uri] is a `file` URI.
201 */ 202 */
202 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; 203 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME;
203 } 204 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/source/sdk_ext.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698