| 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 24 matching lines...) Expand all Loading... |
| 35 /** | 35 /** |
| 36 * Determines if the given [Source] is local. | 36 * Determines if the given [Source] is local. |
| 37 * | 37 * |
| 38 * @param source the [Source] to analyze | 38 * @param source the [Source] to analyze |
| 39 * @return `true` if the given [Source] is local | 39 * @return `true` if the given [Source] is local |
| 40 */ | 40 */ |
| 41 bool isLocal(Source source); | 41 bool isLocal(Source source); |
| 42 } | 42 } |
| 43 | 43 |
| 44 class LocalSourcePredicate_FALSE implements LocalSourcePredicate { | 44 class LocalSourcePredicate_FALSE implements LocalSourcePredicate { |
| 45 @override |
| 45 bool isLocal(Source source) => false; | 46 bool isLocal(Source source) => false; |
| 46 } | 47 } |
| 47 | 48 |
| 48 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { | 49 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { |
| 50 @override |
| 49 bool isLocal(Source source) => true; | 51 bool isLocal(Source source) => true; |
| 50 } | 52 } |
| 51 | 53 |
| 52 class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate { | 54 class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate { |
| 55 @override |
| 53 bool isLocal(Source source) => source.uriKind != UriKind.DART_URI; | 56 bool isLocal(Source source) => source.uriKind != UriKind.DART_URI; |
| 54 } | 57 } |
| 55 | 58 |
| 56 /** | 59 /** |
| 57 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing | 60 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing |
| 58 * [Source]. | 61 * [Source]. |
| 59 */ | 62 */ |
| 60 class SourceFactory { | 63 class SourceFactory { |
| 61 /** | 64 /** |
| 62 * The analysis context that this source factory is associated with. | 65 * The analysis context that this source factory is associated with. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 279 |
| 277 /** | 280 /** |
| 278 * Return `true` if the given object is a source that represents the same sour
ce code as | 281 * Return `true` if the given object is a source that represents the same sour
ce code as |
| 279 * this source. | 282 * this source. |
| 280 * | 283 * |
| 281 * @param object the object to be compared with this object | 284 * @param object the object to be compared with this object |
| 282 * @return `true` if the given object is a source that represents the same sou
rce code as | 285 * @return `true` if the given object is a source that represents the same sou
rce code as |
| 283 * this source | 286 * this source |
| 284 * @see Object#equals(Object) | 287 * @see Object#equals(Object) |
| 285 */ | 288 */ |
| 289 @override |
| 286 bool operator ==(Object object); | 290 bool operator ==(Object object); |
| 287 | 291 |
| 288 /** | 292 /** |
| 289 * Return `true` if this source exists. | 293 * Return `true` if this source exists. |
| 290 * | 294 * |
| 291 * Clients should consider using the the method [AnalysisContext#exists] becau
se | 295 * Clients should consider using the the method [AnalysisContext#exists] becau
se |
| 292 * contexts can have local overrides of the content of a source that the sourc
e is not aware of | 296 * contexts can have local overrides of the content of a source that the sourc
e is not aware of |
| 293 * and a source with local content is considered to exist even if there is no
file on disk. | 297 * and a source with local content is considered to exist even if there is no
file on disk. |
| 294 * | 298 * |
| 295 * @return `true` if this source exists | 299 * @return `true` if this source exists |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 * @return the kind of URI from which this source was originally derived | 362 * @return the kind of URI from which this source was originally derived |
| 359 */ | 363 */ |
| 360 UriKind get uriKind; | 364 UriKind get uriKind; |
| 361 | 365 |
| 362 /** | 366 /** |
| 363 * Return a hash code for this source. | 367 * Return a hash code for this source. |
| 364 * | 368 * |
| 365 * @return a hash code for this source | 369 * @return a hash code for this source |
| 366 * @see Object#hashCode() | 370 * @see Object#hashCode() |
| 367 */ | 371 */ |
| 372 @override |
| 368 int get hashCode; | 373 int get hashCode; |
| 369 | 374 |
| 370 /** | 375 /** |
| 371 * Return `true` if this source is in one of the system libraries. | 376 * Return `true` if this source is in one of the system libraries. |
| 372 * | 377 * |
| 373 * @return `true` if this is in a system library | 378 * @return `true` if this is in a system library |
| 374 */ | 379 */ |
| 375 bool get isInSystemLibrary; | 380 bool get isInSystemLibrary; |
| 376 | 381 |
| 377 /** | 382 /** |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; | 556 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; |
| 552 | 557 |
| 553 /** | 558 /** |
| 554 * @return `true` if this [SourceRange] ends in <code>otherRange</code>. | 559 * @return `true` if this [SourceRange] ends in <code>otherRange</code>. |
| 555 */ | 560 */ |
| 556 bool endsIn(SourceRange otherRange) { | 561 bool endsIn(SourceRange otherRange) { |
| 557 int thisEnd = end; | 562 int thisEnd = end; |
| 558 return otherRange.contains(thisEnd); | 563 return otherRange.contains(thisEnd); |
| 559 } | 564 } |
| 560 | 565 |
| 566 @override |
| 561 bool operator ==(Object obj) { | 567 bool operator ==(Object obj) { |
| 562 if (obj is! SourceRange) { | 568 if (obj is! SourceRange) { |
| 563 return false; | 569 return false; |
| 564 } | 570 } |
| 565 SourceRange sourceRange = obj as SourceRange; | 571 SourceRange sourceRange = obj as SourceRange; |
| 566 return sourceRange.offset == offset && sourceRange.length == length; | 572 return sourceRange.offset == offset && sourceRange.length == length; |
| 567 } | 573 } |
| 568 | 574 |
| 569 /** | 575 /** |
| 570 * @return the 0-based index of the after-last character of the source code fo
r this element, | 576 * @return the 0-based index of the after-last character of the source code fo
r this element, |
| 571 * relative to the source buffer in which this element is contained. | 577 * relative to the source buffer in which this element is contained. |
| 572 */ | 578 */ |
| 573 int get end => offset + length; | 579 int get end => offset + length; |
| 574 | 580 |
| 575 /** | 581 /** |
| 576 * @return the expanded instance of [SourceRange], which has the same center. | 582 * @return the expanded instance of [SourceRange], which has the same center. |
| 577 */ | 583 */ |
| 578 SourceRange getExpanded(int delta) => new SourceRange(offset - delta, delta +
length + delta); | 584 SourceRange getExpanded(int delta) => new SourceRange(offset - delta, delta +
length + delta); |
| 579 | 585 |
| 580 /** | 586 /** |
| 581 * @return the instance of [SourceRange] with end moved on "delta". | 587 * @return the instance of [SourceRange] with end moved on "delta". |
| 582 */ | 588 */ |
| 583 SourceRange getMoveEnd(int delta) => new SourceRange(offset, length + delta); | 589 SourceRange getMoveEnd(int delta) => new SourceRange(offset, length + delta); |
| 584 | 590 |
| 585 /** | 591 /** |
| 586 * @return the expanded translated of [SourceRange], with moved start and the
same length. | 592 * @return the expanded translated of [SourceRange], with moved start and the
same length. |
| 587 */ | 593 */ |
| 588 SourceRange getTranslated(int delta) => new SourceRange(offset + delta, length
); | 594 SourceRange getTranslated(int delta) => new SourceRange(offset + delta, length
); |
| 589 | 595 |
| 596 @override |
| 590 int get hashCode => 31 * offset + length; | 597 int get hashCode => 31 * offset + length; |
| 591 | 598 |
| 592 /** | 599 /** |
| 593 * @return `true` if this [SourceRange] intersects with given. | 600 * @return `true` if this [SourceRange] intersects with given. |
| 594 */ | 601 */ |
| 595 bool intersects(SourceRange other) { | 602 bool intersects(SourceRange other) { |
| 596 if (other == null) { | 603 if (other == null) { |
| 597 return false; | 604 return false; |
| 598 } | 605 } |
| 599 if (end <= other.offset) { | 606 if (end <= other.offset) { |
| 600 return false; | 607 return false; |
| 601 } | 608 } |
| 602 if (offset >= other.end) { | 609 if (offset >= other.end) { |
| 603 return false; | 610 return false; |
| 604 } | 611 } |
| 605 return true; | 612 return true; |
| 606 } | 613 } |
| 607 | 614 |
| 608 /** | 615 /** |
| 609 * @return `true` if this [SourceRange] starts in <code>otherRange</code>. | 616 * @return `true` if this [SourceRange] starts in <code>otherRange</code>. |
| 610 */ | 617 */ |
| 611 bool startsIn(SourceRange otherRange) => otherRange.contains(offset); | 618 bool startsIn(SourceRange otherRange) => otherRange.contains(offset); |
| 612 | 619 |
| 620 @override |
| 613 String toString() { | 621 String toString() { |
| 614 JavaStringBuilder builder = new JavaStringBuilder(); | 622 JavaStringBuilder builder = new JavaStringBuilder(); |
| 615 builder.append("[offset="); | 623 builder.append("[offset="); |
| 616 builder.append(offset); | 624 builder.append(offset); |
| 617 builder.append(", length="); | 625 builder.append(", length="); |
| 618 builder.append(length); | 626 builder.append(length); |
| 619 builder.append("]"); | 627 builder.append("]"); |
| 620 return builder.toString(); | 628 return builder.toString(); |
| 621 } | 629 } |
| 622 } | 630 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 /** | 672 /** |
| 665 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the | 673 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the |
| 666 * given Dart SDK. | 674 * given Dart SDK. |
| 667 * | 675 * |
| 668 * @param sdk the Dart SDK against which URI's are to be resolved | 676 * @param sdk the Dart SDK against which URI's are to be resolved |
| 669 */ | 677 */ |
| 670 DartUriResolver(DartSdk sdk) { | 678 DartUriResolver(DartSdk sdk) { |
| 671 this._sdk = sdk; | 679 this._sdk = sdk; |
| 672 } | 680 } |
| 673 | 681 |
| 682 @override |
| 674 Source fromEncoding(UriKind kind, Uri uri) { | 683 Source fromEncoding(UriKind kind, Uri uri) { |
| 675 if (identical(kind, UriKind.DART_URI)) { | 684 if (identical(kind, UriKind.DART_URI)) { |
| 676 return _sdk.fromEncoding(kind, uri); | 685 return _sdk.fromEncoding(kind, uri); |
| 677 } | 686 } |
| 678 return null; | 687 return null; |
| 679 } | 688 } |
| 680 | 689 |
| 681 /** | 690 /** |
| 682 * Return the [DartSdk] against which URIs are to be resolved. | 691 * Return the [DartSdk] against which URIs are to be resolved. |
| 683 * | 692 * |
| 684 * @return the [DartSdk] against which URIs are to be resolved. | 693 * @return the [DartSdk] against which URIs are to be resolved. |
| 685 */ | 694 */ |
| 686 DartSdk get dartSdk => _sdk; | 695 DartSdk get dartSdk => _sdk; |
| 687 | 696 |
| 697 @override |
| 688 Source resolveAbsolute(Uri uri) { | 698 Source resolveAbsolute(Uri uri) { |
| 689 if (!isDartUri(uri)) { | 699 if (!isDartUri(uri)) { |
| 690 return null; | 700 return null; |
| 691 } | 701 } |
| 692 return _sdk.mapDartUri(uri.toString()); | 702 return _sdk.mapDartUri(uri.toString()); |
| 693 } | 703 } |
| 694 } | 704 } |
| 695 | 705 |
| 696 /** | 706 /** |
| 697 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information | 707 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 int oldStamp = javaMapPut(_stampMap, source, newStamp); | 829 int oldStamp = javaMapPut(_stampMap, source, newStamp); |
| 820 // Occasionally, if this method is called in rapid succession, the timesta
mps are equal. | 830 // Occasionally, if this method is called in rapid succession, the timesta
mps are equal. |
| 821 // Guard against this by artificially incrementing the new timestamp | 831 // Guard against this by artificially incrementing the new timestamp |
| 822 if (newStamp == oldStamp) { | 832 if (newStamp == oldStamp) { |
| 823 _stampMap[source] = newStamp + 1; | 833 _stampMap[source] = newStamp + 1; |
| 824 } | 834 } |
| 825 return javaMapPut(_contentMap, source, contents); | 835 return javaMapPut(_contentMap, source, contents); |
| 826 } | 836 } |
| 827 } | 837 } |
| 828 } | 838 } |
| OLD | NEW |