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/src/generated/source.dart

Issue 1262213002: Ensure actual URIs are properly processed. (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 // 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; 8 library engine.source;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 @override 111 @override
112 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 112 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
113 String mapping = _urlMappings[uri.toString()]; 113 String mapping = _urlMappings[uri.toString()];
114 if (mapping == null) return null; 114 if (mapping == null) return null;
115 115
116 Uri fileUri = new Uri.file(mapping); 116 Uri fileUri = new Uri.file(mapping);
117 if (!fileUri.isAbsolute) return null; 117 if (!fileUri.isAbsolute) return null;
118 118
119 JavaFile javaFile = new JavaFile.fromUri(fileUri); 119 JavaFile javaFile = new JavaFile.fromUri(fileUri);
120 return new FileBasedSource(javaFile, actualUri); 120 return new FileBasedSource(javaFile, actualUri != null ? actualUri : uri);
121 } 121 }
122 } 122 }
123 123
124 /** 124 /**
125 * Instances of the class `DartUriResolver` resolve `dart` URI's. 125 * Instances of the class `DartUriResolver` resolve `dart` URI's.
126 */ 126 */
127 class DartUriResolver extends UriResolver { 127 class DartUriResolver extends UriResolver {
128 /** 128 /**
129 * The name of the `dart` scheme. 129 * The name of the `dart` scheme.
130 */ 130 */
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 Source _internalResolveUri(Source containingSource, Uri containedUri) { 809 Source _internalResolveUri(Source containingSource, Uri containedUri) {
810 if (!containedUri.isAbsolute) { 810 if (!containedUri.isAbsolute) {
811 if (containingSource == null) { 811 if (containingSource == null) {
812 throw new AnalysisException( 812 throw new AnalysisException(
813 "Cannot resolve a relative URI without a containing source: $contain edUri"); 813 "Cannot resolve a relative URI without a containing source: $contain edUri");
814 } 814 }
815 containedUri = containingSource.resolveRelativeUri(containedUri); 815 containedUri = containingSource.resolveRelativeUri(containedUri);
816 } 816 }
817 817
818 Uri actualUri = containedUri; 818 Uri actualUri = containedUri;
819 819
820 // Check .packages and update target and actual URIs as appropriate. 820 // Check .packages and update target and actual URIs as appropriate.
821 if (_packages != null && containedUri.scheme == 'package') { 821 if (_packages != null && containedUri.scheme == 'package') {
822 Uri packageUri = 822 Uri packageUri =
823 _packages.resolve(containedUri, notFound: (Uri packageUri) => null); 823 _packages.resolve(containedUri, notFound: (Uri packageUri) => null);
824 824
825 if (packageUri != null) { 825 if (packageUri != null) {
826 // Ensure scheme is set. 826 // Ensure scheme is set.
827 if (packageUri.scheme == '') { 827 if (packageUri.scheme == '') {
828 packageUri = packageUri.replace(scheme: 'file'); 828 packageUri = packageUri.replace(scheme: 'file');
829 } 829 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 1077
1078 /** 1078 /**
1079 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot 1079 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot
1080 * be computed. 1080 * be computed.
1081 * 1081 *
1082 * @param source the source to get URI for 1082 * @param source the source to get URI for
1083 * @return the absolute URI representing the given source 1083 * @return the absolute URI representing the given source
1084 */ 1084 */
1085 Uri restoreAbsolute(Source source) => null; 1085 Uri restoreAbsolute(Source source) => null;
1086 } 1086 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/src/generated/source_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698