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 library engine.source; | 3 library engine.source; |
4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
5 import 'sdk.dart' show DartSdk; | 5 import 'sdk.dart' show DartSdk; |
6 import 'engine.dart' show AnalysisContext; | 6 import 'engine.dart' show AnalysisContext; |
7 /** | 7 /** |
8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing | 8 * Instances of the class `SourceFactory` resolve possibly relative URI's agains
t an existing |
9 * [Source]. | 9 * [Source]. |
10 * | 10 * |
11 * @coverage dart.engine.source | 11 * @coverage dart.engine.source |
12 */ | 12 */ |
13 class SourceFactory { | 13 class SourceFactory { |
14 | 14 |
15 /** | 15 /** |
16 * The analysis context that this source factory is associated with. | 16 * The analysis context that this source factory is associated with. |
17 */ | 17 */ |
18 AnalysisContext _context; | 18 AnalysisContext context; |
19 | 19 |
20 /** | 20 /** |
21 * The resolvers used to resolve absolute URI's. | 21 * The resolvers used to resolve absolute URI's. |
22 */ | 22 */ |
23 List<UriResolver> _resolvers; | 23 List<UriResolver> _resolvers; |
24 | 24 |
25 /** | 25 /** |
26 * A cache of content used to override the default content of a source. | 26 * A cache of content used to override the default content of a source. |
27 */ | 27 */ |
28 ContentCache _contentCache; | 28 ContentCache contentCache; |
29 | 29 |
30 /** | 30 /** |
31 * Initialize a newly created source factory. | 31 * Initialize a newly created source factory. |
32 * | 32 * |
33 * @param contentCache the cache holding content used to override the default
content of a source | 33 * @param contentCache the cache holding content used to override the default
content of a source |
34 * @param resolvers the resolvers used to resolve absolute URI's | 34 * @param resolvers the resolvers used to resolve absolute URI's |
35 */ | 35 */ |
36 SourceFactory.con1(ContentCache contentCache, List<UriResolver> resolvers) { | 36 SourceFactory.con1(ContentCache contentCache, List<UriResolver> resolvers) { |
37 this._contentCache = contentCache; | 37 this.contentCache = contentCache; |
38 this._resolvers = resolvers; | 38 this._resolvers = resolvers; |
39 } | 39 } |
40 | 40 |
41 /** | 41 /** |
42 * Initialize a newly created source factory. | 42 * Initialize a newly created source factory. |
43 * | 43 * |
44 * @param resolvers the resolvers used to resolve absolute URI's | 44 * @param resolvers the resolvers used to resolve absolute URI's |
45 */ | 45 */ |
46 SourceFactory.con2(List<UriResolver> resolvers) : this.con1(new ContentCache()
, resolvers); | 46 SourceFactory.con2(List<UriResolver> resolvers) : this.con1(new ContentCache()
, resolvers); |
47 | 47 |
(...skipping 27 matching lines...) Expand all Loading... |
75 if (encoding.length < 2) { | 75 if (encoding.length < 2) { |
76 throw new IllegalArgumentException("Invalid encoding length"); | 76 throw new IllegalArgumentException("Invalid encoding length"); |
77 } | 77 } |
78 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0)); | 78 UriKind kind = UriKind.fromEncoding(encoding.codeUnitAt(0)); |
79 if (kind == null) { | 79 if (kind == null) { |
80 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin
d}"); | 80 throw new IllegalArgumentException("Invalid source kind in encoding: ${kin
d}"); |
81 } | 81 } |
82 try { | 82 try { |
83 Uri uri = parseUriWithException(encoding.substring(1)); | 83 Uri uri = parseUriWithException(encoding.substring(1)); |
84 for (UriResolver resolver in _resolvers) { | 84 for (UriResolver resolver in _resolvers) { |
85 Source result = resolver.fromEncoding(_contentCache, kind, uri); | 85 Source result = resolver.fromEncoding(contentCache, kind, uri); |
86 if (result != null) { | 86 if (result != null) { |
87 return result; | 87 return result; |
88 } | 88 } |
89 } | 89 } |
90 throw new IllegalArgumentException("No resolver for kind: ${kind}"); | 90 throw new IllegalArgumentException("No resolver for kind: ${kind}"); |
91 } catch (exception) { | 91 } catch (exception) { |
92 throw new IllegalArgumentException("Invalid URI in encoding"); | 92 throw new IllegalArgumentException("Invalid URI in encoding"); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 /** | 96 /** |
97 * Return a cache of content used to override the default content of a source. | |
98 * | |
99 * @return a cache of content used to override the default content of a source | |
100 */ | |
101 ContentCache get contentCache => _contentCache; | |
102 | |
103 /** | |
104 * Return the analysis context that this source factory is associated with. | |
105 * | |
106 * @return the analysis context that this source factory is associated with | |
107 */ | |
108 AnalysisContext get context => _context; | |
109 | |
110 /** | |
111 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the
re | 97 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the
re |
112 * is no such SDK. | 98 * is no such SDK. |
113 * | 99 * |
114 * @return the [DartSdk] associated with this [SourceFactory], or `null` if | 100 * @return the [DartSdk] associated with this [SourceFactory], or `null` if |
115 * there is no such SDK | 101 * there is no such SDK |
116 */ | 102 */ |
117 DartSdk get dartSdk { | 103 DartSdk get dartSdk { |
118 for (UriResolver resolver in _resolvers) { | 104 for (UriResolver resolver in _resolvers) { |
119 if (resolver is DartUriResolver) { | 105 if (resolver is DartUriResolver) { |
120 DartUriResolver dartUriResolver = resolver as DartUriResolver; | 106 DartUriResolver dartUriResolver = resolver as DartUriResolver; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 149 |
164 /** | 150 /** |
165 * Set the contents of the given source to the given contents. This has the ef
fect of overriding | 151 * Set the contents of the given source to the given contents. This has the ef
fect of overriding |
166 * the default contents of the source. If the contents are `null` the override
is removed so | 152 * the default contents of the source. If the contents are `null` the override
is removed so |
167 * that the default contents will be returned. | 153 * that the default contents will be returned. |
168 * | 154 * |
169 * @param source the source whose contents are being overridden | 155 * @param source the source whose contents are being overridden |
170 * @param contents the new contents of the source | 156 * @param contents the new contents of the source |
171 * @return `true` if the new cached contents are different from the old, else
`false` | 157 * @return `true` if the new cached contents are different from the old, else
`false` |
172 */ | 158 */ |
173 bool setContents(Source source, String contents) => _contentCache.setContents(
source, contents); | 159 bool setContents(Source source, String contents) => contentCache.setContents(s
ource, contents); |
174 | |
175 /** | |
176 * Set the analysis context that this source factory is associated with to the
given context. | |
177 * | |
178 * <b>Note:</b> This method should only be invoked by | |
179 * [AnalysisContextImpl#setSourceFactory] and is only public out of | |
180 * necessity. | |
181 * | |
182 * @param context the analysis context that this source factory is associated
with | |
183 */ | |
184 void set context(AnalysisContext context2) { | |
185 this._context = context2; | |
186 } | |
187 | 160 |
188 /** | 161 /** |
189 * Return the contents of the given source, or `null` if this factory does not
override the | 162 * Return the contents of the given source, or `null` if this factory does not
override the |
190 * contents of the source. | 163 * contents of the source. |
191 * | 164 * |
192 * <b>Note:</b> This method is not intended to be used except by | 165 * <b>Note:</b> This method is not intended to be used except by |
193 * [FileBasedSource#getContents]. | 166 * [FileBasedSource#getContents]. |
194 * | 167 * |
195 * @param source the source whose content is to be returned | 168 * @param source the source whose content is to be returned |
196 * @return the contents of the given source | 169 * @return the contents of the given source |
197 */ | 170 */ |
198 String getContents(Source source) => _contentCache.getContents(source); | 171 String getContents(Source source) => contentCache.getContents(source); |
199 | 172 |
200 /** | 173 /** |
201 * Return the modification stamp of the given source, or `null` if this factor
y does not | 174 * Return the modification stamp of the given source, or `null` if this factor
y does not |
202 * override the contents of the source. | 175 * override the contents of the source. |
203 * | 176 * |
204 * <b>Note:</b> This method is not intended to be used except by | 177 * <b>Note:</b> This method is not intended to be used except by |
205 * [FileBasedSource#getModificationStamp]. | 178 * [FileBasedSource#getModificationStamp]. |
206 * | 179 * |
207 * @param source the source whose modification stamp is to be returned | 180 * @param source the source whose modification stamp is to be returned |
208 * @return the modification stamp of the given source | 181 * @return the modification stamp of the given source |
209 */ | 182 */ |
210 int getModificationStamp(Source source) => _contentCache.getModificationStamp(
source); | 183 int getModificationStamp(Source source) => contentCache.getModificationStamp(s
ource); |
211 | 184 |
212 /** | 185 /** |
213 * Return a source object representing the URI that results from resolving the
given (possibly | 186 * Return a source object representing the URI that results from resolving the
given (possibly |
214 * relative) contained URI against the URI associated with an existing source
object, or | 187 * relative) contained URI against the URI associated with an existing source
object, or |
215 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the | 188 * `null` if either the contained URI is invalid or if it cannot be resolved a
gainst the |
216 * source object's URI. | 189 * source object's URI. |
217 * | 190 * |
218 * @param containingSource the source containing the given URI | 191 * @param containingSource the source containing the given URI |
219 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 192 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
220 * @return the source representing the contained URI | 193 * @return the source representing the contained URI |
221 */ | 194 */ |
222 Source resolveUri2(Source containingSource, Uri containedUri) { | 195 Source resolveUri2(Source containingSource, Uri containedUri) { |
223 if (containedUri.isAbsolute) { | 196 if (containedUri.isAbsolute) { |
224 for (UriResolver resolver in _resolvers) { | 197 for (UriResolver resolver in _resolvers) { |
225 Source result = resolver.resolveAbsolute(_contentCache, containedUri); | 198 Source result = resolver.resolveAbsolute(contentCache, containedUri); |
226 if (result != null) { | 199 if (result != null) { |
227 return result; | 200 return result; |
228 } | 201 } |
229 } | 202 } |
230 return null; | 203 return null; |
231 } else { | 204 } else { |
232 return containingSource.resolveRelative(containedUri); | 205 return containingSource.resolveRelative(containedUri); |
233 } | 206 } |
234 } | 207 } |
235 } | 208 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 442 |
470 /** | 443 /** |
471 * A 'package:' URI. | 444 * A 'package:' URI. |
472 */ | 445 */ |
473 static final UriKind PACKAGE_URI = new UriKind('PACKAGE_URI', 2, 0x70); | 446 static final UriKind PACKAGE_URI = new UriKind('PACKAGE_URI', 2, 0x70); |
474 static final List<UriKind> values = [DART_URI, FILE_URI, PACKAGE_URI]; | 447 static final List<UriKind> values = [DART_URI, FILE_URI, PACKAGE_URI]; |
475 | 448 |
476 /** | 449 /** |
477 * The single character encoding used to identify this kind of URI. | 450 * The single character encoding used to identify this kind of URI. |
478 */ | 451 */ |
479 int _encoding = 0; | 452 int encoding = 0; |
480 | 453 |
481 /** | 454 /** |
482 * Initialize a newly created URI kind to have the given encoding. | 455 * Initialize a newly created URI kind to have the given encoding. |
483 * | 456 * |
484 * @param encoding the single character encoding used to identify this kind of
URI. | 457 * @param encoding the single character encoding used to identify this kind of
URI. |
485 */ | 458 */ |
486 UriKind(String name, int ordinal, int encoding) : super(name, ordinal) { | 459 UriKind(String name, int ordinal, int encoding) : super(name, ordinal) { |
487 this._encoding = encoding; | 460 this.encoding = encoding; |
488 } | 461 } |
489 | 462 |
490 /** | 463 /** |
491 * Return the URI kind represented by the given encoding, or `null` if there i
s no kind with | 464 * Return the URI kind represented by the given encoding, or `null` if there i
s no kind with |
492 * the given encoding. | 465 * the given encoding. |
493 * | 466 * |
494 * @param encoding the single character encoding used to identify the URI kind
to be returned | 467 * @param encoding the single character encoding used to identify the URI kind
to be returned |
495 * @return the URI kind represented by the given encoding | 468 * @return the URI kind represented by the given encoding |
496 */ | 469 */ |
497 static UriKind fromEncoding(int encoding) { | 470 static UriKind fromEncoding(int encoding) { |
498 while (true) { | 471 while (true) { |
499 if (encoding == 0x64) { | 472 if (encoding == 0x64) { |
500 return DART_URI; | 473 return DART_URI; |
501 } else if (encoding == 0x66) { | 474 } else if (encoding == 0x66) { |
502 return FILE_URI; | 475 return FILE_URI; |
503 } else if (encoding == 0x70) { | 476 } else if (encoding == 0x70) { |
504 return PACKAGE_URI; | 477 return PACKAGE_URI; |
505 } | 478 } |
506 break; | 479 break; |
507 } | 480 } |
508 return null; | 481 return null; |
509 } | 482 } |
510 | |
511 /** | |
512 * Return the single character encoding used to identify this kind of URI. | |
513 * | |
514 * @return the single character encoding used to identify this kind of URI | |
515 */ | |
516 int get encoding => _encoding; | |
517 } | 483 } |
518 /** | 484 /** |
519 * A source range defines an [Element]'s source coordinates relative to its [Sou
rce]. | 485 * A source range defines an [Element]'s source coordinates relative to its [Sou
rce]. |
520 * | 486 * |
521 * @coverage dart.engine.utilities | 487 * @coverage dart.engine.utilities |
522 */ | 488 */ |
523 class SourceRange { | 489 class SourceRange { |
524 | 490 |
525 /** | 491 /** |
526 * The 0-based index of the first character of the source code for this elemen
t, relative to the | 492 * The 0-based index of the first character of the source code for this elemen
t, relative to the |
527 * source buffer in which this element is contained. | 493 * source buffer in which this element is contained. |
528 */ | 494 */ |
529 int _offset = 0; | 495 int offset = 0; |
530 | 496 |
531 /** | 497 /** |
532 * The number of characters of the source code for this element, relative to t
he source buffer in | 498 * The number of characters of the source code for this element, relative to t
he source buffer in |
533 * which this element is contained. | 499 * which this element is contained. |
534 */ | 500 */ |
535 int _length = 0; | 501 int length = 0; |
536 | 502 |
537 /** | 503 /** |
538 * Initialize a newly created source range using the given offset and the give
n length. | 504 * Initialize a newly created source range using the given offset and the give
n length. |
539 * | 505 * |
540 * @param offset the given offset | 506 * @param offset the given offset |
541 * @param length the given length | 507 * @param length the given length |
542 */ | 508 */ |
543 SourceRange(int offset, int length) { | 509 SourceRange(int offset, int length) { |
544 this._offset = offset; | 510 this.offset = offset; |
545 this._length = length; | 511 this.length = length; |
546 } | 512 } |
547 | 513 |
548 /** | 514 /** |
549 * @return `true` if <code>x</code> is in [offset, offset + length) interval. | 515 * @return `true` if <code>x</code> is in [offset, offset + length) interval. |
550 */ | 516 */ |
551 bool contains(int x) => _offset <= x && x < _offset + _length; | 517 bool contains(int x) => offset <= x && x < offset + length; |
552 | 518 |
553 /** | 519 /** |
554 * @return `true` if <code>x</code> is in (offset, offset + length) interval. | 520 * @return `true` if <code>x</code> is in (offset, offset + length) interval. |
555 */ | 521 */ |
556 bool containsExclusive(int x) => _offset < x && x < _offset + _length; | 522 bool containsExclusive(int x) => offset < x && x < offset + length; |
557 | 523 |
558 /** | 524 /** |
559 * @return `true` if <code>otherRange</code> covers this [SourceRange]. | 525 * @return `true` if <code>otherRange</code> covers this [SourceRange]. |
560 */ | 526 */ |
561 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); | 527 bool coveredBy(SourceRange otherRange) => otherRange.covers(this); |
562 | 528 |
563 /** | 529 /** |
564 * @return `true` if this [SourceRange] covers <code>otherRange</code>. | 530 * @return `true` if this [SourceRange] covers <code>otherRange</code>. |
565 */ | 531 */ |
566 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; | 532 bool covers(SourceRange otherRange) => offset <= otherRange.offset && otherRan
ge.end <= end; |
567 | 533 |
568 /** | 534 /** |
569 * @return `true` if this [SourceRange] ends in <code>otherRange</code>. | 535 * @return `true` if this [SourceRange] ends in <code>otherRange</code>. |
570 */ | 536 */ |
571 bool endsIn(SourceRange otherRange) { | 537 bool endsIn(SourceRange otherRange) { |
572 int thisEnd = end; | 538 int thisEnd = end; |
573 return otherRange.contains(thisEnd); | 539 return otherRange.contains(thisEnd); |
574 } | 540 } |
575 bool operator ==(Object obj) { | 541 bool operator ==(Object obj) { |
576 if (obj is! SourceRange) { | 542 if (obj is! SourceRange) { |
577 return false; | 543 return false; |
578 } | 544 } |
579 SourceRange sourceRange = obj as SourceRange; | 545 SourceRange sourceRange = obj as SourceRange; |
580 return sourceRange.offset == _offset && sourceRange.length == _length; | 546 return sourceRange.offset == offset && sourceRange.length == length; |
581 } | 547 } |
582 | 548 |
583 /** | 549 /** |
584 * @return the 0-based index of the after-last character of the source code fo
r this element, | 550 * @return the 0-based index of the after-last character of the source code fo
r this element, |
585 * relative to the source buffer in which this element is contained. | 551 * relative to the source buffer in which this element is contained. |
586 */ | 552 */ |
587 int get end => _offset + _length; | 553 int get end => offset + length; |
588 | 554 |
589 /** | 555 /** |
590 * @return the expanded instance of [SourceRange], which has the same center. | 556 * @return the expanded instance of [SourceRange], which has the same center. |
591 */ | 557 */ |
592 SourceRange getExpanded(int delta) => new SourceRange(_offset - delta, delta +
_length + delta); | 558 SourceRange getExpanded(int delta) => new SourceRange(offset - delta, delta +
length + delta); |
593 | |
594 /** | |
595 * Returns the number of characters of the source code for this element, relat
ive to the source | |
596 * buffer in which this element is contained. | |
597 * | |
598 * @return the number of characters of the source code for this element, relat
ive to the source | |
599 * buffer in which this element is contained | |
600 */ | |
601 int get length => _length; | |
602 | 559 |
603 /** | 560 /** |
604 * @return the instance of [SourceRange] with end moved on "delta". | 561 * @return the instance of [SourceRange] with end moved on "delta". |
605 */ | 562 */ |
606 SourceRange getMoveEnd(int delta) => new SourceRange(_offset, _length + delta)
; | 563 SourceRange getMoveEnd(int delta) => new SourceRange(offset, length + delta); |
607 | |
608 /** | |
609 * Returns the 0-based index of the first character of the source code for thi
s element, relative | |
610 * to the source buffer in which this element is contained. | |
611 * | |
612 * @return the 0-based index of the first character of the source code for thi
s element, relative | |
613 * to the source buffer in which this element is contained | |
614 */ | |
615 int get offset => _offset; | |
616 | 564 |
617 /** | 565 /** |
618 * @return the expanded translated of [SourceRange], with moved start and the
same length. | 566 * @return the expanded translated of [SourceRange], with moved start and the
same length. |
619 */ | 567 */ |
620 SourceRange getTranslated(int delta) => new SourceRange(_offset + delta, _leng
th); | 568 SourceRange getTranslated(int delta) => new SourceRange(offset + delta, length
); |
621 int get hashCode => 31 * _offset + _length; | 569 int get hashCode => 31 * offset + length; |
622 | 570 |
623 /** | 571 /** |
624 * @return `true` if this [SourceRange] intersects with given. | 572 * @return `true` if this [SourceRange] intersects with given. |
625 */ | 573 */ |
626 bool intersects(SourceRange other) { | 574 bool intersects(SourceRange other) { |
627 if (other == null) { | 575 if (other == null) { |
628 return false; | 576 return false; |
629 } | 577 } |
630 if (end <= other.offset) { | 578 if (end <= other.offset) { |
631 return false; | 579 return false; |
632 } | 580 } |
633 if (offset >= other.end) { | 581 if (offset >= other.end) { |
634 return false; | 582 return false; |
635 } | 583 } |
636 return true; | 584 return true; |
637 } | 585 } |
638 | 586 |
639 /** | 587 /** |
640 * @return `true` if this [SourceRange] starts in <code>otherRange</code>. | 588 * @return `true` if this [SourceRange] starts in <code>otherRange</code>. |
641 */ | 589 */ |
642 bool startsIn(SourceRange otherRange) => otherRange.contains(_offset); | 590 bool startsIn(SourceRange otherRange) => otherRange.contains(offset); |
643 String toString() { | 591 String toString() { |
644 JavaStringBuilder builder = new JavaStringBuilder(); | 592 JavaStringBuilder builder = new JavaStringBuilder(); |
645 builder.append("[offset="); | 593 builder.append("[offset="); |
646 builder.append(_offset); | 594 builder.append(offset); |
647 builder.append(", length="); | 595 builder.append(", length="); |
648 builder.append(_length); | 596 builder.append(length); |
649 builder.append("]"); | 597 builder.append("]"); |
650 return builder.toString(); | 598 return builder.toString(); |
651 } | 599 } |
652 } | 600 } |
653 /** | 601 /** |
654 * The interface `SourceContainer` is used by clients to define a collection of
sources | 602 * The interface `SourceContainer` is used by clients to define a collection of
sources |
655 * | 603 * |
656 * Source containers are not used within analysis engine, but can be used by cli
ents to group | 604 * Source containers are not used within analysis engine, but can be used by cli
ents to group |
657 * sources for the purposes of accessing composite dependency information. For e
xample, the Eclipse | 605 * sources for the purposes of accessing composite dependency information. For e
xample, the Eclipse |
658 * client uses source containers to represent Eclipse projects, which allows it
to easily compute | 606 * client uses source containers to represent Eclipse projects, which allows it
to easily compute |
(...skipping 14 matching lines...) Expand all Loading... |
673 /** | 621 /** |
674 * Instances of the class `DartUriResolver` resolve `dart` URI's. | 622 * Instances of the class `DartUriResolver` resolve `dart` URI's. |
675 * | 623 * |
676 * @coverage dart.engine.source | 624 * @coverage dart.engine.source |
677 */ | 625 */ |
678 class DartUriResolver extends UriResolver { | 626 class DartUriResolver extends UriResolver { |
679 | 627 |
680 /** | 628 /** |
681 * The Dart SDK against which URI's are to be resolved. | 629 * The Dart SDK against which URI's are to be resolved. |
682 */ | 630 */ |
683 DartSdk _sdk; | 631 DartSdk dartSdk; |
684 | 632 |
685 /** | 633 /** |
686 * The name of the `dart` scheme. | 634 * The name of the `dart` scheme. |
687 */ | 635 */ |
688 static String _DART_SCHEME = "dart"; | 636 static String _DART_SCHEME = "dart"; |
689 | 637 |
690 /** | 638 /** |
691 * Return `true` if the given URI is a `dart:` URI. | 639 * Return `true` if the given URI is a `dart:` URI. |
692 * | 640 * |
693 * @param uri the URI being tested | 641 * @param uri the URI being tested |
694 * @return `true` if the given URI is a `dart:` URI | 642 * @return `true` if the given URI is a `dart:` URI |
695 */ | 643 */ |
696 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme; | 644 static bool isDartUri(Uri uri) => _DART_SCHEME == uri.scheme; |
697 | 645 |
698 /** | 646 /** |
699 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the | 647 * Initialize a newly created resolver to resolve Dart URI's against the given
platform within the |
700 * given Dart SDK. | 648 * given Dart SDK. |
701 * | 649 * |
702 * @param sdk the Dart SDK against which URI's are to be resolved | 650 * @param sdk the Dart SDK against which URI's are to be resolved |
703 */ | 651 */ |
704 DartUriResolver(DartSdk sdk) { | 652 DartUriResolver(DartSdk sdk) { |
705 this._sdk = sdk; | 653 this.dartSdk = sdk; |
706 } | 654 } |
707 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) { | 655 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) { |
708 if (identical(kind, UriKind.DART_URI)) { | 656 if (identical(kind, UriKind.DART_URI)) { |
709 return _sdk.fromEncoding(contentCache, kind, uri); | 657 return dartSdk.fromEncoding(contentCache, kind, uri); |
710 } | 658 } |
711 return null; | 659 return null; |
712 } | 660 } |
713 | |
714 /** | |
715 * Return the [DartSdk] against which URIs are to be resolved. | |
716 * | |
717 * @return the [DartSdk] against which URIs are to be resolved. | |
718 */ | |
719 DartSdk get dartSdk => _sdk; | |
720 Source resolveAbsolute(ContentCache contentCache, Uri uri) { | 661 Source resolveAbsolute(ContentCache contentCache, Uri uri) { |
721 if (!isDartUri(uri)) { | 662 if (!isDartUri(uri)) { |
722 return null; | 663 return null; |
723 } | 664 } |
724 return _sdk.mapDartUri(uri.toString()); | 665 return dartSdk.mapDartUri(uri.toString()); |
725 } | 666 } |
726 } | 667 } |
727 /** | 668 /** |
728 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information | 669 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information |
729 * within a source file. | 670 * within a source file. |
730 * | 671 * |
731 * @coverage dart.engine.utilities | 672 * @coverage dart.engine.utilities |
732 */ | 673 */ |
733 class LineInfo { | 674 class LineInfo { |
734 | 675 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 } | 711 } |
771 /** | 712 /** |
772 * Instances of the class `Location` represent the location of a character as a
line and | 713 * Instances of the class `Location` represent the location of a character as a
line and |
773 * column pair. | 714 * column pair. |
774 */ | 715 */ |
775 class LineInfo_Location { | 716 class LineInfo_Location { |
776 | 717 |
777 /** | 718 /** |
778 * The one-based index of the line containing the character. | 719 * The one-based index of the line containing the character. |
779 */ | 720 */ |
780 int _lineNumber = 0; | 721 int lineNumber = 0; |
781 | 722 |
782 /** | 723 /** |
783 * The one-based index of the column containing the character. | 724 * The one-based index of the column containing the character. |
784 */ | 725 */ |
785 int _columnNumber = 0; | 726 int columnNumber = 0; |
786 | 727 |
787 /** | 728 /** |
788 * Initialize a newly created location to represent the location of the charac
ter at the given | 729 * Initialize a newly created location to represent the location of the charac
ter at the given |
789 * line and column position. | 730 * line and column position. |
790 * | 731 * |
791 * @param lineNumber the one-based index of the line containing the character | 732 * @param lineNumber the one-based index of the line containing the character |
792 * @param columnNumber the one-based index of the column containing the charac
ter | 733 * @param columnNumber the one-based index of the column containing the charac
ter |
793 */ | 734 */ |
794 LineInfo_Location(int lineNumber, int columnNumber) { | 735 LineInfo_Location(int lineNumber, int columnNumber) { |
795 this._lineNumber = lineNumber; | 736 this.lineNumber = lineNumber; |
796 this._columnNumber = columnNumber; | 737 this.columnNumber = columnNumber; |
797 } | 738 } |
798 | |
799 /** | |
800 * Return the one-based index of the column containing the character. | |
801 * | |
802 * @return the one-based index of the column containing the character | |
803 */ | |
804 int get columnNumber => _columnNumber; | |
805 | |
806 /** | |
807 * Return the one-based index of the line containing the character. | |
808 * | |
809 * @return the one-based index of the line containing the character | |
810 */ | |
811 int get lineNumber => _lineNumber; | |
812 } | 739 } |
813 /** | 740 /** |
814 * Instances of class `ContentCache` hold content used to override the default c
ontent of a | 741 * Instances of class `ContentCache` hold content used to override the default c
ontent of a |
815 * [Source]. | 742 * [Source]. |
816 * | 743 * |
817 * @coverage dart.engine.source | 744 * @coverage dart.engine.source |
818 */ | 745 */ |
819 class ContentCache { | 746 class ContentCache { |
820 | 747 |
821 /** | 748 /** |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 if (contents == null) { | 794 if (contents == null) { |
868 _stampMap.remove(source); | 795 _stampMap.remove(source); |
869 return _contentMap.remove(source) != null; | 796 return _contentMap.remove(source) != null; |
870 } else { | 797 } else { |
871 _stampMap[source] = JavaSystem.currentTimeMillis(); | 798 _stampMap[source] = JavaSystem.currentTimeMillis(); |
872 String originalContents = javaMapPut(_contentMap, source, contents); | 799 String originalContents = javaMapPut(_contentMap, source, contents); |
873 return contents != originalContents; | 800 return contents != originalContents; |
874 } | 801 } |
875 } | 802 } |
876 } | 803 } |
OLD | NEW |