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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.source.io; | 8 library engine.source.io; |
9 | 9 |
10 import 'source.dart'; | 10 import 'source.dart'; |
11 import 'java_core.dart'; | 11 import 'java_core.dart'; |
12 import 'java_io.dart'; | 12 import 'java_io.dart'; |
13 import 'engine.dart'; | 13 import 'engine.dart'; |
14 import 'utilities_general.dart'; | 14 import 'utilities_general.dart'; |
15 export 'source.dart'; | 15 export 'source.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * Instances of interface `LocalSourcePredicate` are used to determine if the gi
ven | 18 * Instances of interface `LocalSourcePredicate` are used to determine if the gi
ven |
19 * [Source] is "local" in some sense, so can be updated. | 19 * [Source] is "local" in some sense, so can be updated. |
20 * | |
21 * @coverage dart.engine.source | |
22 */ | 20 */ |
23 abstract class LocalSourcePredicate { | 21 abstract class LocalSourcePredicate { |
24 /** | 22 /** |
25 * Instance of [LocalSourcePredicate] that always returns `false`. | 23 * Instance of [LocalSourcePredicate] that always returns `false`. |
26 */ | 24 */ |
27 static final LocalSourcePredicate FALSE = new LocalSourcePredicate_FALSE(); | 25 static final LocalSourcePredicate FALSE = new LocalSourcePredicate_FALSE(); |
28 | 26 |
29 /** | 27 /** |
30 * Instance of [LocalSourcePredicate] that always returns `true`. | 28 * Instance of [LocalSourcePredicate] that always returns `true`. |
31 */ | 29 */ |
(...skipping 21 matching lines...) Expand all Loading... |
53 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { | 51 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { |
54 bool isLocal(Source source) => true; | 52 bool isLocal(Source source) => true; |
55 } | 53 } |
56 | 54 |
57 class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate { | 55 class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate { |
58 bool isLocal(Source source) => source.uriKind != UriKind.DART_URI; | 56 bool isLocal(Source source) => source.uriKind != UriKind.DART_URI; |
59 } | 57 } |
60 | 58 |
61 /** | 59 /** |
62 * Instances of the class `FileBasedSource` implement a source that represents a
file. | 60 * Instances of the class `FileBasedSource` implement a source that represents a
file. |
63 * | |
64 * @coverage dart.engine.source | |
65 */ | 61 */ |
66 class FileBasedSource implements Source { | 62 class FileBasedSource implements Source { |
67 /** | 63 /** |
68 * The file represented by this source. | 64 * The file represented by this source. |
69 */ | 65 */ |
70 JavaFile _file; | 66 JavaFile _file; |
71 | 67 |
72 /** | 68 /** |
73 * The cached encoding for this source. | 69 * The cached encoding for this source. |
74 */ | 70 */ |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 JavaFile get file => _file; | 186 JavaFile get file => _file; |
191 } | 187 } |
192 | 188 |
193 /** | 189 /** |
194 * Instances of the class `PackageUriResolver` resolve `package` URI's in the co
ntext of | 190 * Instances of the class `PackageUriResolver` resolve `package` URI's in the co
ntext of |
195 * an application. | 191 * an application. |
196 * | 192 * |
197 * For the purposes of sharing analysis, the path to each package under the "pac
kages" directory | 193 * For the purposes of sharing analysis, the path to each package under the "pac
kages" directory |
198 * should be canonicalized, but to preserve relative links within a package, the
remainder of the | 194 * should be canonicalized, but to preserve relative links within a package, the
remainder of the |
199 * path from the package directory to the leaf should not. | 195 * path from the package directory to the leaf should not. |
200 * | |
201 * @coverage dart.engine.source | |
202 */ | 196 */ |
203 class PackageUriResolver extends UriResolver { | 197 class PackageUriResolver extends UriResolver { |
204 /** | 198 /** |
205 * The package directories that `package` URI's are assumed to be relative to. | 199 * The package directories that `package` URI's are assumed to be relative to. |
206 */ | 200 */ |
207 List<JavaFile> _packagesDirectories; | 201 List<JavaFile> _packagesDirectories; |
208 | 202 |
209 /** | 203 /** |
210 * The name of the `package` scheme. | 204 * The name of the `package` scheme. |
211 */ | 205 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 333 } |
340 String rootPath = rootDir.getAbsolutePath(); | 334 String rootPath = rootDir.getAbsolutePath(); |
341 String filePath = file.getAbsolutePath(); | 335 String filePath = file.getAbsolutePath(); |
342 return filePath.startsWith("${rootPath}/lib"); | 336 return filePath.startsWith("${rootPath}/lib"); |
343 } | 337 } |
344 } | 338 } |
345 | 339 |
346 /** | 340 /** |
347 * Instances of the class [DirectoryBasedSourceContainer] represent a source con
tainer that | 341 * Instances of the class [DirectoryBasedSourceContainer] represent a source con
tainer that |
348 * contains all sources within a given directory. | 342 * contains all sources within a given directory. |
349 * | |
350 * @coverage dart.engine.source | |
351 */ | 343 */ |
352 class DirectoryBasedSourceContainer implements SourceContainer { | 344 class DirectoryBasedSourceContainer implements SourceContainer { |
353 /** | 345 /** |
354 * Append the system file separator to the given path unless the path already
ends with a | 346 * Append the system file separator to the given path unless the path already
ends with a |
355 * separator. | 347 * separator. |
356 * | 348 * |
357 * @param path the path to which the file separator is to be added | 349 * @param path the path to which the file separator is to be added |
358 * @return a path that ends with the system file separator | 350 * @return a path that ends with the system file separator |
359 */ | 351 */ |
360 static String appendFileSeparator(String path) { | 352 static String appendFileSeparator(String path) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 */ | 392 */ |
401 String get path => _path; | 393 String get path => _path; |
402 | 394 |
403 int get hashCode => _path.hashCode; | 395 int get hashCode => _path.hashCode; |
404 | 396 |
405 String toString() => "SourceContainer[${_path}]"; | 397 String toString() => "SourceContainer[${_path}]"; |
406 } | 398 } |
407 | 399 |
408 /** | 400 /** |
409 * Instances of the class `FileUriResolver` resolve `file` URI's. | 401 * Instances of the class `FileUriResolver` resolve `file` URI's. |
410 * | |
411 * @coverage dart.engine.source | |
412 */ | 402 */ |
413 class FileUriResolver extends UriResolver { | 403 class FileUriResolver extends UriResolver { |
414 /** | 404 /** |
415 * The name of the `file` scheme. | 405 * The name of the `file` scheme. |
416 */ | 406 */ |
417 static String FILE_SCHEME = "file"; | 407 static String FILE_SCHEME = "file"; |
418 | 408 |
419 /** | 409 /** |
420 * Return `true` if the given URI is a `file` URI. | 410 * Return `true` if the given URI is a `file` URI. |
421 * | 411 * |
422 * @param uri the URI being tested | 412 * @param uri the URI being tested |
423 * @return `true` if the given URI is a `file` URI | 413 * @return `true` if the given URI is a `file` URI |
424 */ | 414 */ |
425 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; | 415 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; |
426 | 416 |
427 Source fromEncoding(UriKind kind, Uri uri) { | 417 Source fromEncoding(UriKind kind, Uri uri) { |
428 if (identical(kind, UriKind.FILE_URI)) { | 418 if (identical(kind, UriKind.FILE_URI)) { |
429 return new FileBasedSource.con2(new JavaFile.fromUri(uri), kind); | 419 return new FileBasedSource.con2(new JavaFile.fromUri(uri), kind); |
430 } | 420 } |
431 return null; | 421 return null; |
432 } | 422 } |
433 | 423 |
434 Source resolveAbsolute(Uri uri) { | 424 Source resolveAbsolute(Uri uri) { |
435 if (!isFileUri(uri)) { | 425 if (!isFileUri(uri)) { |
436 return null; | 426 return null; |
437 } | 427 } |
438 return new FileBasedSource.con1(new JavaFile.fromUri(uri)); | 428 return new FileBasedSource.con1(new JavaFile.fromUri(uri)); |
439 } | 429 } |
440 } | 430 } |
OLD | NEW |