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

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

Issue 16019002: Merge the dart:uri library into dart:core and update the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final cleanup Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.source; 4 library engine.source;
5 5
6 import 'dart:uri';
7 import 'java_core.dart'; 6 import 'java_core.dart';
8 import 'sdk.dart' show DartSdk; 7 import 'sdk.dart' show DartSdk;
9 import 'engine.dart' show AnalysisContext; 8 import 'engine.dart' show AnalysisContext;
10 9
11 /** 10 /**
12 * Instances of the class {@code SourceFactory} resolve possibly relative URI's against an existing{@link Source source}. 11 * Instances of the class {@code SourceFactory} resolve possibly relative URI's against an existing{@link Source source}.
13 * @coverage dart.engine.source 12 * @coverage dart.engine.source
14 */ 13 */
15 class SourceFactory { 14 class SourceFactory {
16 /** 15 /**
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 _jtd_constructor_333_impl(new ContentCache(), resolvers); 47 _jtd_constructor_333_impl(new ContentCache(), resolvers);
49 } 48 }
50 /** 49 /**
51 * Return a source object representing the given absolute URI, or {@code null} if the URI is not a 50 * Return a source object representing the given absolute URI, or {@code null} if the URI is not a
52 * valid URI or if it is not an absolute URI. 51 * valid URI or if it is not an absolute URI.
53 * @param absoluteUri the absolute URI to be resolved 52 * @param absoluteUri the absolute URI to be resolved
54 * @return a source object representing the absolute URI 53 * @return a source object representing the absolute URI
55 */ 54 */
56 Source forUri(String absoluteUri) { 55 Source forUri(String absoluteUri) {
57 try { 56 try {
58 Uri uri = new Uri(absoluteUri); 57 Uri uri = Uri.parse(absoluteUri);
59 if (uri.isAbsolute) { 58 if (uri.isAbsolute) {
60 return resolveUri2(null, uri); 59 return resolveUri2(null, uri);
61 } 60 }
62 } on URISyntaxException catch (exception) { 61 } on URISyntaxException catch (exception) {
63 } 62 }
64 return null; 63 return null;
65 } 64 }
66 /** 65 /**
67 * Return a source object that is equal to the source object used to obtain th e given encoding. 66 * Return a source object that is equal to the source object used to obtain th e given encoding.
68 * @param encoding the encoding of a source object 67 * @param encoding the encoding of a source object
69 * @return a source object that is described by the given encoding 68 * @return a source object that is described by the given encoding
70 * @throws IllegalArgumentException if the argument is not a valid encoding 69 * @throws IllegalArgumentException if the argument is not a valid encoding
71 * @see Source#getEncoding() 70 * @see Source#getEncoding()
72 */ 71 */
73 Source fromEncoding(String encoding) { 72 Source fromEncoding(String encoding) {
74 if (encoding.length < 2) { 73 if (encoding.length < 2) {
75 throw new IllegalArgumentException("Invalid encoding length"); 74 throw new IllegalArgumentException("Invalid encoding length");
76 } 75 }
77 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0)); 76 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0));
78 if (kind == null) { 77 if (kind == null) {
79 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin d}"); 78 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin d}");
80 } 79 }
81 try { 80 try {
82 Uri uri = new Uri(encoding.substring(1)); 81 Uri uri = Uri.parse(encoding.substring(1));
83 for (UriResolver resolver in _resolvers) { 82 for (UriResolver resolver in _resolvers) {
84 Source result = resolver.fromEncoding(_contentCache, kind, uri); 83 Source result = resolver.fromEncoding(_contentCache, kind, uri);
85 if (result != null) { 84 if (result != null) {
86 return result; 85 return result;
87 } 86 }
88 } 87 }
89 throw new IllegalArgumentException("No resolver for kind: ${kind}"); 88 throw new IllegalArgumentException("No resolver for kind: ${kind}");
90 } catch (exception) { 89 } catch (exception) {
91 throw new IllegalArgumentException("Invalid URI in encoding"); 90 throw new IllegalArgumentException("Invalid URI in encoding");
92 } 91 }
(...skipping 26 matching lines...) Expand all
119 /** 118 /**
120 * Return a source object representing the URI that results from resolving the given (possibly 119 * Return a source object representing the URI that results from resolving the given (possibly
121 * relative) contained URI against the URI associated with an existing source object, or{@code null} if either the contained URI is invalid or if it cannot be resolved against the 120 * relative) contained URI against the URI associated with an existing source object, or{@code null} if either the contained URI is invalid or if it cannot be resolved against the
122 * source object's URI. 121 * source object's URI.
123 * @param containingSource the source containing the given URI 122 * @param containingSource the source containing the given URI
124 * @param containedUri the (possibly relative) URI to be resolved against the containing source 123 * @param containedUri the (possibly relative) URI to be resolved against the containing source
125 * @return the source representing the contained URI 124 * @return the source representing the contained URI
126 */ 125 */
127 Source resolveUri(Source containingSource, String containedUri) { 126 Source resolveUri(Source containingSource, String containedUri) {
128 try { 127 try {
129 return resolveUri2(containingSource, new Uri(containedUri)); 128 return resolveUri2(containingSource, Uri.parse(containedUri));
130 } on URISyntaxException catch (exception) { 129 } on URISyntaxException catch (exception) {
131 return null; 130 return null;
132 } 131 }
133 } 132 }
134 /** 133 /**
135 * Set the contents of the given source to the given contents. This has the ef fect of overriding 134 * Set the contents of the given source to the given contents. This has the ef fect of overriding
136 * the default contents of the source. If the contents are {@code null} the ov erride is removed so 135 * the default contents of the source. If the contents are {@code null} the ov erride is removed so
137 * that the default contents will be returned. 136 * that the default contents will be returned.
138 * @param source the source whose contents are being overridden 137 * @param source the source whose contents are being overridden
139 * @param contents the new contents of the source 138 * @param contents the new contents of the source
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 */ 721 */
723 void setContents(Source source, String contents) { 722 void setContents(Source source, String contents) {
724 if (contents == null) { 723 if (contents == null) {
725 _contentMap.remove(source); 724 _contentMap.remove(source);
726 _stampMap.remove(source); 725 _stampMap.remove(source);
727 } else { 726 } else {
728 _contentMap[source] = contents; 727 _contentMap[source] = contents;
729 _stampMap[source] = JavaSystem.currentTimeMillis(); 728 _stampMap[source] = JavaSystem.currentTimeMillis();
730 } 729 }
731 } 730 }
732 } 731 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer_experimental/lib/src/generated/source_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698