| 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 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 * @param absoluteUri the absolute URI to be resolved | 511 * @param absoluteUri the absolute URI to be resolved |
| 512 * @return a source object representing the absolute URI | 512 * @return a source object representing the absolute URI |
| 513 */ | 513 */ |
| 514 Source forUri(String absoluteUri) { | 514 Source forUri(String absoluteUri) { |
| 515 try { | 515 try { |
| 516 Uri uri = parseUriWithException(absoluteUri); | 516 Uri uri = parseUriWithException(absoluteUri); |
| 517 if (uri.isAbsolute) { | 517 if (uri.isAbsolute) { |
| 518 return _internalResolveUri(null, uri); | 518 return _internalResolveUri(null, uri); |
| 519 } | 519 } |
| 520 } catch (exception) { | 520 } catch (exception) { |
| 521 AnalysisEngine.instance.logger.logError2("Could not resolve URI: ${absolut
eUri}", exception); | 521 AnalysisEngine.instance.logger.logError2("Could not resolve URI: $absolute
Uri", exception); |
| 522 } | 522 } |
| 523 return null; | 523 return null; |
| 524 } | 524 } |
| 525 | 525 |
| 526 /** | 526 /** |
| 527 * Return a source object representing the given absolute URI, or `null` if th
e URI is not | 527 * Return a source object representing the given absolute URI, or `null` if th
e URI is not |
| 528 * an absolute URI. | 528 * an absolute URI. |
| 529 * | 529 * |
| 530 * @param absoluteUri the absolute URI to be resolved | 530 * @param absoluteUri the absolute URI to be resolved |
| 531 * @return a source object representing the absolute URI | 531 * @return a source object representing the absolute URI |
| 532 */ | 532 */ |
| 533 Source forUri2(Uri absoluteUri) { | 533 Source forUri2(Uri absoluteUri) { |
| 534 if (absoluteUri.isAbsolute) { | 534 if (absoluteUri.isAbsolute) { |
| 535 try { | 535 try { |
| 536 return _internalResolveUri(null, absoluteUri); | 536 return _internalResolveUri(null, absoluteUri); |
| 537 } on AnalysisException catch (exception, stackTrace) { | 537 } on AnalysisException catch (exception, stackTrace) { |
| 538 AnalysisEngine.instance.logger.logError2("Could not resolve URI: ${absol
uteUri}", new CaughtException(exception, stackTrace)); | 538 AnalysisEngine.instance.logger.logError2("Could not resolve URI: $absolu
teUri", new CaughtException(exception, stackTrace)); |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 return null; | 541 return null; |
| 542 } | 542 } |
| 543 | 543 |
| 544 /** | 544 /** |
| 545 * Return a source object that is equal to the source object used to obtain th
e given encoding. | 545 * Return a source object that is equal to the source object used to obtain th
e given encoding. |
| 546 * | 546 * |
| 547 * @param encoding the encoding of a source object | 547 * @param encoding the encoding of a source object |
| 548 * @return a source object that is described by the given encoding | 548 * @return a source object that is described by the given encoding |
| 549 * @throws IllegalArgumentException if the argument is not a valid encoding | 549 * @throws IllegalArgumentException if the argument is not a valid encoding |
| 550 * @see Source#getEncoding() | 550 * @see Source#getEncoding() |
| 551 */ | 551 */ |
| 552 Source fromEncoding(String encoding) { | 552 Source fromEncoding(String encoding) { |
| 553 Source source = forUri(encoding); | 553 Source source = forUri(encoding); |
| 554 if (source == null) { | 554 if (source == null) { |
| 555 throw new IllegalArgumentException("Invalid source encoding: ${encoding}")
; | 555 throw new IllegalArgumentException("Invalid source encoding: $encoding"); |
| 556 } | 556 } |
| 557 return source; | 557 return source; |
| 558 } | 558 } |
| 559 | 559 |
| 560 /** | 560 /** |
| 561 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the
re | 561 * Return the [DartSdk] associated with this [SourceFactory], or `null` if the
re |
| 562 * is no such SDK. | 562 * is no such SDK. |
| 563 * | 563 * |
| 564 * @return the [DartSdk] associated with this [SourceFactory], or `null` if | 564 * @return the [DartSdk] associated with this [SourceFactory], or `null` if |
| 565 * there is no such SDK | 565 * there is no such SDK |
| (...skipping 27 matching lines...) Expand all Loading... |
| 593 * @return the source representing the contained URI | 593 * @return the source representing the contained URI |
| 594 */ | 594 */ |
| 595 Source resolveUri(Source containingSource, String containedUri) { | 595 Source resolveUri(Source containingSource, String containedUri) { |
| 596 if (containedUri == null || containedUri.isEmpty) { | 596 if (containedUri == null || containedUri.isEmpty) { |
| 597 return null; | 597 return null; |
| 598 } | 598 } |
| 599 try { | 599 try { |
| 600 // Force the creation of an escaped URI to deal with spaces, etc. | 600 // Force the creation of an escaped URI to deal with spaces, etc. |
| 601 return _internalResolveUri(containingSource, parseUriWithException(contain
edUri)); | 601 return _internalResolveUri(containingSource, parseUriWithException(contain
edUri)); |
| 602 } catch (exception) { | 602 } catch (exception) { |
| 603 AnalysisEngine.instance.logger.logError2("Could not resolve URI (${contain
edUri}) relative to source (${containingSource.fullName})", exception); | 603 AnalysisEngine.instance.logger.logError2("Could not resolve URI ($containe
dUri) relative to source (${containingSource.fullName})", exception); |
| 604 return null; | 604 return null; |
| 605 } | 605 } |
| 606 } | 606 } |
| 607 | 607 |
| 608 /** | 608 /** |
| 609 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 609 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
| 610 * be computed. | 610 * be computed. |
| 611 * | 611 * |
| 612 * @param source the source to get URI for | 612 * @param source the source to get URI for |
| 613 * @return the absolute URI representing the given source | 613 * @return the absolute URI representing the given source |
| (...skipping 24 matching lines...) Expand all Loading... |
| 638 * | 638 * |
| 639 * @param containingSource the source containing the given URI | 639 * @param containingSource the source containing the given URI |
| 640 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 640 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 641 * @return the source representing the contained URI | 641 * @return the source representing the contained URI |
| 642 * @throws AnalysisException if either the contained URI is invalid or if it c
annot be resolved | 642 * @throws AnalysisException if either the contained URI is invalid or if it c
annot be resolved |
| 643 * against the source object's URI | 643 * against the source object's URI |
| 644 */ | 644 */ |
| 645 Source _internalResolveUri(Source containingSource, Uri containedUri) { | 645 Source _internalResolveUri(Source containingSource, Uri containedUri) { |
| 646 if (!containedUri.isAbsolute) { | 646 if (!containedUri.isAbsolute) { |
| 647 if (containingSource == null) { | 647 if (containingSource == null) { |
| 648 throw new AnalysisException("Cannot resolve a relative URI without a con
taining source: ${containedUri}"); | 648 throw new AnalysisException("Cannot resolve a relative URI without a con
taining source: $containedUri"); |
| 649 } | 649 } |
| 650 containedUri = containingSource.resolveRelativeUri(containedUri); | 650 containedUri = containingSource.resolveRelativeUri(containedUri); |
| 651 } | 651 } |
| 652 for (UriResolver resolver in _resolvers) { | 652 for (UriResolver resolver in _resolvers) { |
| 653 Source result = resolver.resolveAbsolute(containedUri); | 653 Source result = resolver.resolveAbsolute(containedUri); |
| 654 if (result != null) { | 654 if (result != null) { |
| 655 return result; | 655 return result; |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 return null; | 658 return null; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 | 904 |
| 905 /** | 905 /** |
| 906 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 906 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
| 907 * be computed. | 907 * be computed. |
| 908 * | 908 * |
| 909 * @param source the source to get URI for | 909 * @param source the source to get URI for |
| 910 * @return the absolute URI representing the given source | 910 * @return the absolute URI representing the given source |
| 911 */ | 911 */ |
| 912 Uri restoreAbsolute(Source source) => null; | 912 Uri restoreAbsolute(Source source) => null; |
| 913 } | 913 } |
| OLD | NEW |