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; | 8 library engine.source; |
9 | 9 |
10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a | 86 * Return a source object representing the given absolute URI, or `null` if th
e URI is not a |
87 * valid URI or if it is not an absolute URI. | 87 * valid URI or if it is not an absolute URI. |
88 * | 88 * |
89 * @param absoluteUri the absolute URI to be resolved | 89 * @param absoluteUri the absolute URI to be resolved |
90 * @return a source object representing the absolute URI | 90 * @return a source object representing the absolute URI |
91 */ | 91 */ |
92 Source forUri(String absoluteUri) { | 92 Source forUri(String absoluteUri) { |
93 try { | 93 try { |
94 Uri uri = parseUriWithException(absoluteUri); | 94 Uri uri = parseUriWithException(absoluteUri); |
95 if (uri.isAbsolute) { | 95 if (uri.isAbsolute) { |
96 return resolveUri2(null, uri); | 96 return internalResolveUri(null, uri); |
97 } | 97 } |
98 } on URISyntaxException catch (exception) { | 98 } on URISyntaxException catch (exception) { |
99 } | 99 } |
100 return null; | 100 return null; |
101 } | 101 } |
102 | 102 |
103 /** | 103 /** |
104 * Return a source object that is equal to the source object used to obtain th
e given encoding. | 104 * Return a source object that is equal to the source object used to obtain th
e given encoding. |
105 * | 105 * |
106 * @param encoding the encoding of a source object | 106 * @param encoding the encoding of a source object |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 * @param containingSource the source containing the given URI | 164 * @param containingSource the source containing the given URI |
165 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 165 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
166 * @return the source representing the contained URI | 166 * @return the source representing the contained URI |
167 */ | 167 */ |
168 Source resolveUri(Source containingSource, String containedUri) { | 168 Source resolveUri(Source containingSource, String containedUri) { |
169 if (containedUri == null || containedUri.isEmpty) { | 169 if (containedUri == null || containedUri.isEmpty) { |
170 return null; | 170 return null; |
171 } | 171 } |
172 try { | 172 try { |
173 // Force the creation of an escaped URI to deal with spaces, etc. | 173 // Force the creation of an escaped URI to deal with spaces, etc. |
174 return resolveUri2(containingSource, parseUriWithException(containedUri)); | 174 return internalResolveUri(containingSource, parseUriWithException(containe
dUri)); |
175 } on URISyntaxException catch (exception) { | 175 } on URISyntaxException catch (exception) { |
176 return null; | 176 return null; |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 /** | 180 /** |
181 * Return an absolute URI that represents the given source. | 181 * Return an absolute URI that represents the given source. |
182 * | 182 * |
183 * @param source the source to get URI for | 183 * @param source the source to get URI for |
184 * @return the absolute URI representing the given source, may be `null` | 184 * @return the absolute URI representing the given source, may be `null` |
(...skipping 20 matching lines...) Expand all Loading... |
205 /** | 205 /** |
206 * Return a source object representing the URI that results from resolving the
given (possibly | 206 * Return a source object representing the URI that results from resolving the
given (possibly |
207 * relative) contained URI against the URI associated with an existing source
object, or | 207 * relative) contained URI against the URI associated with an existing source
object, or |
208 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the | 208 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the |
209 * source object's URI. | 209 * source object's URI. |
210 * | 210 * |
211 * @param containingSource the source containing the given URI | 211 * @param containingSource the source containing the given URI |
212 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 212 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
213 * @return the source representing the contained URI | 213 * @return the source representing the contained URI |
214 */ | 214 */ |
215 Source resolveUri2(Source containingSource, Uri containedUri) { | 215 Source internalResolveUri(Source containingSource, Uri containedUri) { |
216 if (containedUri.isAbsolute) { | 216 if (containedUri.isAbsolute) { |
217 for (UriResolver resolver in _resolvers) { | 217 for (UriResolver resolver in _resolvers) { |
218 Source result = resolver.resolveAbsolute(containedUri); | 218 Source result = resolver.resolveAbsolute(containedUri); |
219 if (result != null) { | 219 if (result != null) { |
220 return result; | 220 return result; |
221 } | 221 } |
222 } | 222 } |
223 return null; | 223 return null; |
224 } else { | 224 } else { |
225 return containingSource.resolveRelative(containedUri); | 225 return containingSource.resolveRelative(containedUri); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 int oldStamp = javaMapPut(_stampMap, source, newStamp); | 831 int oldStamp = javaMapPut(_stampMap, source, newStamp); |
832 // Occasionally, if this method is called in rapid succession, the timesta
mps are equal. | 832 // Occasionally, if this method is called in rapid succession, the timesta
mps are equal. |
833 // Guard against this by artificially incrementing the new timestamp | 833 // Guard against this by artificially incrementing the new timestamp |
834 if (newStamp == oldStamp) { | 834 if (newStamp == oldStamp) { |
835 _stampMap[source] = newStamp + 1; | 835 _stampMap[source] = newStamp + 1; |
836 } | 836 } |
837 return javaMapPut(_contentMap, source, contents); | 837 return javaMapPut(_contentMap, source, contents); |
838 } | 838 } |
839 } | 839 } |
840 } | 840 } |
OLD | NEW |