| OLD | NEW |
| 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'; | 6 import 'dart:uri'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Instances of the class {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. | 10 * Instances of the class {@code SourceFactory} resolve possibly relative URI's
against an existing{@link Source source}. |
| 11 * @coverage dart.engine.source |
| 11 */ | 12 */ |
| 12 class SourceFactory { | 13 class SourceFactory { |
| 13 /** | 14 /** |
| 14 * The resolvers used to resolve absolute URI's. | 15 * The resolvers used to resolve absolute URI's. |
| 15 */ | 16 */ |
| 16 List<UriResolver> _resolvers; | 17 List<UriResolver> _resolvers; |
| 17 /** | 18 /** |
| 18 * A cache of content used to override the default content of a source. | 19 * A cache of content used to override the default content of a source. |
| 19 */ | 20 */ |
| 20 ContentCache _contentCache; | 21 ContentCache _contentCache; |
| 21 /** | 22 /** |
| 22 * Initialize a newly created source factory. | 23 * Initialize a newly created source factory. |
| 23 * @param contentCache the cache holding content used to override the default
content of a source. | 24 * @param contentCache the cache holding content used to override the default
content of a source. |
| 24 * @param resolvers the resolvers used to resolve absolute URI's | 25 * @param resolvers the resolvers used to resolve absolute URI's |
| 25 */ | 26 */ |
| 26 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { | 27 SourceFactory.con1(ContentCache contentCache2, List<UriResolver> resolvers2) { |
| 27 _jtd_constructor_283_impl(contentCache2, resolvers2); | 28 _jtd_constructor_289_impl(contentCache2, resolvers2); |
| 28 } | 29 } |
| 29 _jtd_constructor_283_impl(ContentCache contentCache2, List<UriResolver> resolv
ers2) { | 30 _jtd_constructor_289_impl(ContentCache contentCache2, List<UriResolver> resolv
ers2) { |
| 30 this._contentCache = contentCache2; | 31 this._contentCache = contentCache2; |
| 31 this._resolvers = resolvers2; | 32 this._resolvers = resolvers2; |
| 32 } | 33 } |
| 33 /** | 34 /** |
| 34 * Initialize a newly created source factory. | 35 * Initialize a newly created source factory. |
| 35 * @param resolvers the resolvers used to resolve absolute URI's | 36 * @param resolvers the resolvers used to resolve absolute URI's |
| 36 */ | 37 */ |
| 37 SourceFactory.con2(List<UriResolver> resolvers) { | 38 SourceFactory.con2(List<UriResolver> resolvers) { |
| 38 _jtd_constructor_284_impl(resolvers); | 39 _jtd_constructor_290_impl(resolvers); |
| 39 } | 40 } |
| 40 _jtd_constructor_284_impl(List<UriResolver> resolvers) { | 41 _jtd_constructor_290_impl(List<UriResolver> resolvers) { |
| 41 _jtd_constructor_283_impl(new ContentCache(), [resolvers]); | 42 _jtd_constructor_289_impl(new ContentCache(), resolvers); |
| 42 } | 43 } |
| 43 /** | 44 /** |
| 44 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a | 45 * Return a source object representing the given absolute URI, or {@code null}
if the URI is not a |
| 45 * valid URI or if it is not an absolute URI. | 46 * valid URI or if it is not an absolute URI. |
| 46 * @param absoluteUri the absolute URI to be resolved | 47 * @param absoluteUri the absolute URI to be resolved |
| 47 * @return a source object representing the absolute URI | 48 * @return a source object representing the absolute URI |
| 48 */ | 49 */ |
| 49 Source forUri(String absoluteUri) { | 50 Source forUri(String absoluteUri) { |
| 50 try { | 51 try { |
| 51 Uri uri = new Uri.fromComponents(path: absoluteUri); | 52 Uri uri = new Uri(absoluteUri); |
| 52 if (uri.isAbsolute) { | 53 if (uri.isAbsolute) { |
| 53 return resolveUri2(null, uri); | 54 return resolveUri2(null, uri); |
| 54 } | 55 } |
| 55 } on URISyntaxException catch (exception) { | 56 } on URISyntaxException catch (exception) { |
| 56 } | 57 } |
| 57 return null; | 58 return null; |
| 58 } | 59 } |
| 59 /** | 60 /** |
| 60 * Return a source object that is equal to the source object used to obtain th
e given encoding, or{@code null} if the argument is not a valid encoding. | 61 * Return a source object that is equal to the source object used to obtain th
e given encoding, or{@code null} if the argument is not a valid encoding. |
| 61 * @param encoding the encoding of a source object | 62 * @param encoding the encoding of a source object |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return null; | 126 return null; |
| 126 } else { | 127 } else { |
| 127 return containingSource.resolveRelative(containedUri); | 128 return containingSource.resolveRelative(containedUri); |
| 128 } | 129 } |
| 129 } | 130 } |
| 130 } | 131 } |
| 131 /** | 132 /** |
| 132 * The abstract class {@code UriResolver} defines the behavior of objects that a
re used to resolve | 133 * The abstract class {@code UriResolver} defines the behavior of objects that a
re used to resolve |
| 133 * URI's for a source factory. Subclasses of this class are expected to resolve
a single scheme of | 134 * URI's for a source factory. Subclasses of this class are expected to resolve
a single scheme of |
| 134 * absolute URI. | 135 * absolute URI. |
| 136 * @coverage dart.engine.source |
| 135 */ | 137 */ |
| 136 abstract class UriResolver { | 138 abstract class UriResolver { |
| 137 /** | 139 /** |
| 138 * Initialize a newly created resolver. | 140 * Initialize a newly created resolver. |
| 139 */ | 141 */ |
| 140 UriResolver() : super() { | 142 UriResolver() : super() { |
| 141 } | 143 } |
| 142 /** | 144 /** |
| 143 * Resolve the given absolute URI. Return a {@link Source source} representing
the file to which | 145 * Resolve the given absolute URI. Return a {@link Source source} representing
the file to which |
| 144 * it was resolved, or {@code null} if it could not be resolved. | 146 * it was resolved, or {@code null} if it could not be resolved. |
| 145 * @param uri the URI to be resolved | 147 * @param uri the URI to be resolved |
| 146 * @return a {@link Source source} representing the URI to which given URI was
resolved | 148 * @return a {@link Source source} representing the URI to which given URI was
resolved |
| 147 */ | 149 */ |
| 148 Source resolveAbsolute(SourceFactory factory, Uri uri); | 150 Source resolveAbsolute(SourceFactory factory, Uri uri); |
| 149 } | 151 } |
| 150 /** | 152 /** |
| 151 * The interface {@code Source} defines the behavior of objects representing sou
rce code that can be | 153 * The interface {@code Source} defines the behavior of objects representing sou
rce code that can be |
| 152 * compiled. | 154 * compiled. |
| 155 * @coverage dart.engine.source |
| 153 */ | 156 */ |
| 154 abstract class Source { | 157 abstract class Source { |
| 155 /** | 158 /** |
| 156 * An empty array of sources. | 159 * An empty array of sources. |
| 157 */ | 160 */ |
| 158 static List<Source> EMPTY_ARRAY = new List<Source>(0); | 161 static List<Source> EMPTY_ARRAY = new List<Source>(0); |
| 159 /** | 162 /** |
| 160 * Return {@code true} if the given object is a source that represents the sam
e source code as | 163 * Return {@code true} if the given object is a source that represents the sam
e source code as |
| 161 * this source. | 164 * this source. |
| 162 * @param object the object to be compared with this object | 165 * @param object the object to be compared with this object |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 accept(CharBuffer contents); | 254 accept(CharBuffer contents); |
| 252 /** | 255 /** |
| 253 * Accept the contents of a source represented as a string. | 256 * Accept the contents of a source represented as a string. |
| 254 * @param contents the contents of the source | 257 * @param contents the contents of the source |
| 255 */ | 258 */ |
| 256 void accept2(String contents); | 259 void accept2(String contents); |
| 257 } | 260 } |
| 258 /** | 261 /** |
| 259 * The enumeration {@code SourceKind} defines the different kinds of sources tha
t are known to the | 262 * The enumeration {@code SourceKind} defines the different kinds of sources tha
t are known to the |
| 260 * analysis engine. | 263 * analysis engine. |
| 264 * @coverage dart.engine.source |
| 261 */ | 265 */ |
| 262 class SourceKind { | 266 class SourceKind { |
| 263 /** | 267 /** |
| 264 * A source containing HTML. The HTML might or might not contain Dart scripts. | 268 * A source containing HTML. The HTML might or might not contain Dart scripts. |
| 265 */ | 269 */ |
| 266 static final SourceKind HTML = new SourceKind('HTML', 0); | 270 static final SourceKind HTML = new SourceKind('HTML', 0); |
| 267 /** | 271 /** |
| 268 * A Dart compilation unit that is not a part of another library. Libraries mi
ght or might not | 272 * A Dart compilation unit that is not a part of another library. Libraries mi
ght or might not |
| 269 * contain any directives, including a library directive. | 273 * contain any directives, including a library directive. |
| 270 */ | 274 */ |
| 271 static final SourceKind LIBRARY = new SourceKind('LIBRARY', 1); | 275 static final SourceKind LIBRARY = new SourceKind('LIBRARY', 1); |
| 272 /** | 276 /** |
| 273 * A Dart compilation unit that is part of another library. Parts contain a pa
rt-of directive. | 277 * A Dart compilation unit that is part of another library. Parts contain a pa
rt-of directive. |
| 274 */ | 278 */ |
| 275 static final SourceKind PART = new SourceKind('PART', 2); | 279 static final SourceKind PART = new SourceKind('PART', 2); |
| 276 /** | 280 /** |
| 277 * An unknown kind of source. Used both when it is not possible to identify th
e kind of a source | 281 * An unknown kind of source. Used both when it is not possible to identify th
e kind of a source |
| 278 * and also when the kind of a source is not known without performing a comput
ation and the client | 282 * and also when the kind of a source is not known without performing a comput
ation and the client |
| 279 * does not want to spend the time to identify the kind. | 283 * does not want to spend the time to identify the kind. |
| 280 */ | 284 */ |
| 281 static final SourceKind UNKNOWN = new SourceKind('UNKNOWN', 3); | 285 static final SourceKind UNKNOWN = new SourceKind('UNKNOWN', 3); |
| 282 static final List<SourceKind> values = [HTML, LIBRARY, PART, UNKNOWN]; | 286 static final List<SourceKind> values = [HTML, LIBRARY, PART, UNKNOWN]; |
| 283 final String __name; | 287 final String __name; |
| 284 final int __ordinal; | 288 final int __ordinal; |
| 289 int get ordinal => __ordinal; |
| 285 SourceKind(this.__name, this.__ordinal) { | 290 SourceKind(this.__name, this.__ordinal) { |
| 286 } | 291 } |
| 287 String toString() => __name; | 292 String toString() => __name; |
| 288 } | 293 } |
| 289 /** | 294 /** |
| 290 * A source range defines an {@link Element}'s source coordinates relative to it
s {@link Source}. | 295 * A source range defines an {@link Element}'s source coordinates relative to it
s {@link Source}. |
| 296 * @coverage dart.engine.utilities |
| 291 */ | 297 */ |
| 292 class SourceRange { | 298 class SourceRange { |
| 293 /** | 299 /** |
| 294 * The 0-based index of the first character of the source code for this elemen
t, relative to the | 300 * The 0-based index of the first character of the source code for this elemen
t, relative to the |
| 295 * source buffer in which this element is contained. | 301 * source buffer in which this element is contained. |
| 296 */ | 302 */ |
| 297 int _offset = 0; | 303 int _offset = 0; |
| 298 /** | 304 /** |
| 299 * The number of characters of the source code for this element, relative to t
he source buffer in | 305 * The number of characters of the source code for this element, relative to t
he source buffer in |
| 300 * which this element is contained. | 306 * which this element is contained. |
| 301 */ | 307 */ |
| 302 int _length = 0; | 308 int _length = 0; |
| 303 /** | 309 /** |
| 304 * Initialize a newly created source range using the given offset and the give
n length. | 310 * Initialize a newly created source range using the given offset and the give
n length. |
| 305 * @param offset the given offset | 311 * @param offset the given offset |
| 306 * @param length the given length | 312 * @param length the given length |
| 307 */ | 313 */ |
| 308 SourceRange(int offset, int length) { | 314 SourceRange(int offset, int length) { |
| 309 this._offset = offset; | 315 this._offset = offset; |
| 310 this._length = length; | 316 this._length = length; |
| 311 } | 317 } |
| 312 /** | 318 /** |
| 313 * @return <code>true</code> if <code>x</code> is in [offset, offset + length)
interval. | 319 * @return <code>true</code> if <code>x</code> is in [offset, offset + length)
interval. |
| 314 */ | 320 */ |
| 315 bool contains(int x) => _offset <= x && x < _offset + _length; | 321 bool contains(int x) => _offset <= x && x < _offset + _length; |
| 316 /** | 322 /** |
| 323 * @return <code>true</code> if <code>x</code> is in (offset, offset + length)
interval. |
| 324 */ |
| 325 bool containsExclusive(int x) => _offset < x && x < _offset + _length; |
| 326 /** |
| 317 * @return <code>true</code> if <code>otherRange</code> covers this {@link Sou
rceRange}. | 327 * @return <code>true</code> if <code>otherRange</code> covers this {@link Sou
rceRange}. |
| 318 */ | 328 */ |
| 319 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); | 329 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); |
| 320 /** | 330 /** |
| 321 * @return <code>true</code> if this {@link SourceRange} covers <code>otherRan
ge</code>. | 331 * @return <code>true</code> if this {@link SourceRange} covers <code>otherRan
ge</code>. |
| 322 */ | 332 */ |
| 323 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; | 333 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; |
| 324 /** | 334 /** |
| 325 * @return <code>true</code> if this {@link SourceRange} ends in <code>otherRa
nge</code>. | 335 * @return <code>true</code> if this {@link SourceRange} ends in <code>otherRa
nge</code>. |
| 326 */ | 336 */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 return builder.toString(); | 402 return builder.toString(); |
| 393 } | 403 } |
| 394 } | 404 } |
| 395 /** | 405 /** |
| 396 * The interface {@code SourceContainer} is used by clients to define a collecti
on of sources | 406 * The interface {@code SourceContainer} is used by clients to define a collecti
on of sources |
| 397 * <p> | 407 * <p> |
| 398 * Source containers are not used within analysis engine, but can be used by cli
ents to group | 408 * Source containers are not used within analysis engine, but can be used by cli
ents to group |
| 399 * sources for the purposes of accessing composite dependency information. For e
xample, the Eclipse | 409 * sources for the purposes of accessing composite dependency information. For e
xample, the Eclipse |
| 400 * client uses source containers to represent Eclipse projects, which allows it
to easily compute | 410 * client uses source containers to represent Eclipse projects, which allows it
to easily compute |
| 401 * project-level dependencies. | 411 * project-level dependencies. |
| 412 * @coverage dart.engine.source |
| 402 */ | 413 */ |
| 403 abstract class SourceContainer { | 414 abstract class SourceContainer { |
| 404 /** | 415 /** |
| 405 * Determine if the specified source is part of the receiver's collection of s
ources. | 416 * Determine if the specified source is part of the receiver's collection of s
ources. |
| 406 * @param source the source in question | 417 * @param source the source in question |
| 407 * @return {@code true} if the receiver contains the source, else {@code false
} | 418 * @return {@code true} if the receiver contains the source, else {@code false
} |
| 408 */ | 419 */ |
| 409 bool contains(Source source); | 420 bool contains(Source source); |
| 410 } | 421 } |
| 411 /** | 422 /** |
| 412 * Instances of the class {@code LineInfo} encapsulate information about line an
d column information | 423 * Instances of the class {@code LineInfo} encapsulate information about line an
d column information |
| 413 * within a source file. | 424 * within a source file. |
| 425 * @coverage dart.engine.utilities |
| 414 */ | 426 */ |
| 415 class LineInfo { | 427 class LineInfo { |
| 416 /** | 428 /** |
| 417 * An array containing the offsets of the first character of each line in the
source code. | 429 * An array containing the offsets of the first character of each line in the
source code. |
| 418 */ | 430 */ |
| 419 List<int> _lineStarts; | 431 List<int> _lineStarts; |
| 420 /** | 432 /** |
| 421 * Initialize a newly created set of line information to represent the data en
coded in the given | 433 * Initialize a newly created set of line information to represent the data en
coded in the given |
| 422 * array. | 434 * array. |
| 423 * @param lineStarts the offsets of the first character of each line in the so
urce code | 435 * @param lineStarts the offsets of the first character of each line in the so
urce code |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 */ | 486 */ |
| 475 int get columnNumber => _columnNumber; | 487 int get columnNumber => _columnNumber; |
| 476 /** | 488 /** |
| 477 * Return the one-based index of the line containing the character. | 489 * Return the one-based index of the line containing the character. |
| 478 * @return the one-based index of the line containing the character | 490 * @return the one-based index of the line containing the character |
| 479 */ | 491 */ |
| 480 int get lineNumber => _lineNumber; | 492 int get lineNumber => _lineNumber; |
| 481 } | 493 } |
| 482 /** | 494 /** |
| 483 * Instances of class {@code ContentCache} hold content used to override the def
ault content of a{@link Source}. | 495 * Instances of class {@code ContentCache} hold content used to override the def
ault content of a{@link Source}. |
| 496 * @coverage dart.engine.source |
| 484 */ | 497 */ |
| 485 class ContentCache { | 498 class ContentCache { |
| 486 /** | 499 /** |
| 487 * A table mapping sources to the contents of those sources. This is used to o
verride the default | 500 * A table mapping sources to the contents of those sources. This is used to o
verride the default |
| 488 * contents of a source. | 501 * contents of a source. |
| 489 */ | 502 */ |
| 490 Map<Source, String> _contentMap = new Map<Source, String>(); | 503 Map<Source, String> _contentMap = new Map<Source, String>(); |
| 491 /** | 504 /** |
| 492 * A table mapping sources to the modification stamps of those sources. This i
s used when the | 505 * A table mapping sources to the modification stamps of those sources. This i
s used when the |
| 493 * default contents of a source has been overridden. | 506 * default contents of a source has been overridden. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 void setContents(Source source, String contents) { | 539 void setContents(Source source, String contents) { |
| 527 if (contents == null) { | 540 if (contents == null) { |
| 528 _contentMap.remove(source); | 541 _contentMap.remove(source); |
| 529 _stampMap.remove(source); | 542 _stampMap.remove(source); |
| 530 } else { | 543 } else { |
| 531 _contentMap[source] = contents; | 544 _contentMap[source] = contents; |
| 532 _stampMap[source] = JavaSystem.currentTimeMillis(); | 545 _stampMap[source] = JavaSystem.currentTimeMillis(); |
| 533 } | 546 } |
| 534 } | 547 } |
| 535 } | 548 } |
| OLD | NEW |