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

Side by Side Diff: pkg/analyzer/lib/src/generated/source.dart

Issue 1928623002: Fix ExplicitSourceResolver's handling of missing files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source_io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analyzer.src.generated.source; 5 library analyzer.src.generated.source;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
11 import 'package:analyzer/src/context/source.dart'; 11 import 'package:analyzer/src/context/source.dart';
12 import 'package:analyzer/src/generated/engine.dart'; 12 import 'package:analyzer/src/generated/engine.dart';
13 import 'package:analyzer/src/generated/java_core.dart'; 13 import 'package:analyzer/src/generated/java_core.dart';
14 import 'package:analyzer/src/generated/java_engine.dart'; 14 import 'package:analyzer/src/generated/java_engine.dart';
15 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; 15 import 'package:analyzer/src/generated/java_io.dart' show JavaFile;
16 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; 16 import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
17 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; 17 import 'package:analyzer/src/generated/source_io.dart'
18 show FileBasedSource, FileUriResolver, PackageUriResolver;
18 import 'package:analyzer/task/model.dart'; 19 import 'package:analyzer/task/model.dart';
19 import 'package:package_config/packages.dart'; 20 import 'package:package_config/packages.dart';
20 import 'package:path/path.dart' as pathos; 21 import 'package:path/path.dart' as pathos;
21 22
22 /** 23 /**
23 * A function that is used to visit [ContentCache] entries. 24 * A function that is used to visit [ContentCache] entries.
24 */ 25 */
25 typedef void ContentCacheVisitor(String fullPath, int stamp, String contents); 26 typedef void ContentCacheVisitor(String fullPath, int stamp, String contents);
26 27
27 /** 28 /**
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 return DART_URI; 889 return DART_URI;
889 } else if (encoding == 0x66) { 890 } else if (encoding == 0x66) {
890 return FILE_URI; 891 return FILE_URI;
891 } else if (encoding == 0x70) { 892 } else if (encoding == 0x70) {
892 return PACKAGE_URI; 893 return PACKAGE_URI;
893 } 894 }
894 break; 895 break;
895 } 896 }
896 return null; 897 return null;
897 } 898 }
899
900 /**
901 * Return the URI kind corresponding to the given scheme string.
902 */
903 static UriKind fromScheme(String scheme) {
904 if (scheme == PackageUriResolver.PACKAGE_SCHEME) {
905 return UriKind.PACKAGE_URI;
906 } else if (scheme == DartUriResolver.DART_SCHEME) {
907 return UriKind.DART_URI;
908 } else if (scheme == FileUriResolver.FILE_SCHEME) {
909 return UriKind.FILE_URI;
910 }
911 return UriKind.FILE_URI;
912 }
898 } 913 }
899 914
900 /** 915 /**
901 * The abstract class `UriResolver` defines the behavior of objects that are use d to resolve 916 * The abstract class `UriResolver` defines the behavior of objects that are use d to resolve
902 * URI's for a source factory. Subclasses of this class are expected to resolve a single scheme of 917 * URI's for a source factory. Subclasses of this class are expected to resolve a single scheme of
903 * absolute URI. 918 * absolute URI.
904 */ 919 */
905 abstract class UriResolver { 920 abstract class UriResolver {
906 /** 921 /**
907 * Resolve the given absolute URI. Return a [Source] representing the file to which 922 * Resolve the given absolute URI. Return a [Source] representing the file to which
908 * it was resolved, whether or not the resulting source exists, or `null` if i t could not be 923 * it was resolved, whether or not the resulting source exists, or `null` if i t could not be
909 * resolved because the URI is invalid. 924 * resolved because the URI is invalid.
910 * 925 *
911 * @param uri the URI to be resolved 926 * @param uri the URI to be resolved
912 * @param actualUri the actual uri for this source -- if `null`, the value of [uri] will be used 927 * @param actualUri the actual uri for this source -- if `null`, the value of [uri] will be used
913 * @return a [Source] representing the file to which given URI was resolved 928 * @return a [Source] representing the file to which given URI was resolved
914 */ 929 */
915 Source resolveAbsolute(Uri uri, [Uri actualUri]); 930 Source resolveAbsolute(Uri uri, [Uri actualUri]);
916 931
917 /** 932 /**
918 * Return an absolute URI that represents the given [source], or `null` if a 933 * Return an absolute URI that represents the given [source], or `null` if a
919 * valid URI cannot be computed. 934 * valid URI cannot be computed.
920 * 935 *
921 * The computation should be based solely on [source.fullName]. 936 * The computation should be based solely on [source.fullName].
922 */ 937 */
923 Uri restoreAbsolute(Source source) => null; 938 Uri restoreAbsolute(Source source) => null;
924 } 939 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/source_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698