| 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.ast; | 8 library engine.ast; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 9455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9466 | 9466 |
| 9467 @override | 9467 @override |
| 9468 Element get staticElement { | 9468 Element get staticElement { |
| 9469 if (_identifier == null) { | 9469 if (_identifier == null) { |
| 9470 return null; | 9470 return null; |
| 9471 } | 9471 } |
| 9472 return _identifier.staticElement; | 9472 return _identifier.staticElement; |
| 9473 } | 9473 } |
| 9474 | 9474 |
| 9475 /** | 9475 /** |
| 9476 * Return `true` if this type is a deferred type. |
| 9477 * |
| 9478 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form </i>p.
T</i> where <i>p</i> |
| 9479 * is a deferred prefix. |
| 9480 * |
| 9481 * @return `true` if this type is a deferred type |
| 9482 */ |
| 9483 bool get isDeferred { |
| 9484 Element element = _prefix.staticElement; |
| 9485 if (element is! PrefixElement) { |
| 9486 return false; |
| 9487 } |
| 9488 PrefixElement prefixElement = element as PrefixElement; |
| 9489 List<ImportElement> imports = prefixElement.enclosingElement.getImportsWithP
refix(prefixElement); |
| 9490 if (imports.length != 1) { |
| 9491 return false; |
| 9492 } |
| 9493 return imports[0].isDeferred; |
| 9494 } |
| 9495 |
| 9496 /** |
| 9476 * Set the identifier being prefixed to the given identifier. | 9497 * Set the identifier being prefixed to the given identifier. |
| 9477 * | 9498 * |
| 9478 * @param identifier the identifier being prefixed | 9499 * @param identifier the identifier being prefixed |
| 9479 */ | 9500 */ |
| 9480 void set identifier(SimpleIdentifier identifier) { | 9501 void set identifier(SimpleIdentifier identifier) { |
| 9481 this._identifier = becomeParentOf(identifier); | 9502 this._identifier = becomeParentOf(identifier); |
| 9482 } | 9503 } |
| 9483 | 9504 |
| 9484 /** | 9505 /** |
| 9485 * Set the prefix associated with the library in which the identifier is defin
ed to the given | 9506 * Set the prefix associated with the library in which the identifier is defin
ed to the given |
| (...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11422 Identifier get name => _name; | 11443 Identifier get name => _name; |
| 11423 | 11444 |
| 11424 /** | 11445 /** |
| 11425 * Return the type arguments associated with the type, or `null` if there are
no type | 11446 * Return the type arguments associated with the type, or `null` if there are
no type |
| 11426 * arguments. | 11447 * arguments. |
| 11427 * | 11448 * |
| 11428 * @return the type arguments associated with the type | 11449 * @return the type arguments associated with the type |
| 11429 */ | 11450 */ |
| 11430 TypeArgumentList get typeArguments => _typeArguments; | 11451 TypeArgumentList get typeArguments => _typeArguments; |
| 11431 | 11452 |
| 11453 /** |
| 11454 * Return `true` if this type is a deferred type. |
| 11455 * |
| 11456 * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form </i>p.
T</i> where <i>p</i> |
| 11457 * is a deferred prefix. |
| 11458 * |
| 11459 * @return `true` if this type is a deferred type |
| 11460 */ |
| 11461 bool get isDeferred { |
| 11462 Identifier identifier = name; |
| 11463 if (identifier is! PrefixedIdentifier) { |
| 11464 return false; |
| 11465 } |
| 11466 return (identifier as PrefixedIdentifier).isDeferred; |
| 11467 } |
| 11468 |
| 11432 @override | 11469 @override |
| 11433 bool get isSynthetic => _name.isSynthetic && _typeArguments == null; | 11470 bool get isSynthetic => _name.isSynthetic && _typeArguments == null; |
| 11434 | 11471 |
| 11435 /** | 11472 /** |
| 11436 * Set the name of the type to the given identifier. | 11473 * Set the name of the type to the given identifier. |
| 11437 * | 11474 * |
| 11438 * @param identifier the name of the type | 11475 * @param identifier the name of the type |
| 11439 */ | 11476 */ |
| 11440 void set name(Identifier identifier) { | 11477 void set name(Identifier identifier) { |
| 11441 _name = becomeParentOf(identifier); | 11478 _name = becomeParentOf(identifier); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11663 * | [PartDirective] | 11700 * | [PartDirective] |
| 11664 * </pre> | 11701 * </pre> |
| 11665 */ | 11702 */ |
| 11666 abstract class UriBasedDirective extends Directive { | 11703 abstract class UriBasedDirective extends Directive { |
| 11667 /** | 11704 /** |
| 11668 * The URI referenced by this directive. | 11705 * The URI referenced by this directive. |
| 11669 */ | 11706 */ |
| 11670 StringLiteral _uri; | 11707 StringLiteral _uri; |
| 11671 | 11708 |
| 11672 /** | 11709 /** |
| 11710 * The prefix of a URI using the `dart-ext` scheme to reference a native code
library. |
| 11711 */ |
| 11712 static String _DART_EXT_SCHEME = "dart-ext:"; |
| 11713 |
| 11714 /** |
| 11673 * The content of the URI. | 11715 * The content of the URI. |
| 11674 */ | 11716 */ |
| 11675 String uriContent; | 11717 String uriContent; |
| 11676 | 11718 |
| 11677 /** | 11719 /** |
| 11678 * The source to which the URI was resolved. | 11720 * The source to which the URI was resolved. |
| 11679 */ | 11721 */ |
| 11680 Source source; | 11722 Source source; |
| 11681 | 11723 |
| 11682 /** | 11724 /** |
| (...skipping 25 matching lines...) Expand all Loading... |
| 11708 | 11750 |
| 11709 /** | 11751 /** |
| 11710 * Set the URI referenced by this directive to the given URI. | 11752 * Set the URI referenced by this directive to the given URI. |
| 11711 * | 11753 * |
| 11712 * @param uri the URI referenced by this directive | 11754 * @param uri the URI referenced by this directive |
| 11713 */ | 11755 */ |
| 11714 void set uri(StringLiteral uri) { | 11756 void set uri(StringLiteral uri) { |
| 11715 this._uri = becomeParentOf(uri); | 11757 this._uri = becomeParentOf(uri); |
| 11716 } | 11758 } |
| 11717 | 11759 |
| 11760 /** |
| 11761 * Validate the given directive, but do not check for existance. |
| 11762 * |
| 11763 * @return a code indicating the problem if there is one, or `null` no problem |
| 11764 */ |
| 11765 UriValidationCode validate() { |
| 11766 StringLiteral uriLiteral = uri; |
| 11767 if (uriLiteral is StringInterpolation) { |
| 11768 return UriValidationCode.URI_WITH_INTERPOLATION; |
| 11769 } |
| 11770 String uriContent = this.uriContent; |
| 11771 if (uriContent == null) { |
| 11772 return UriValidationCode.INVALID_URI; |
| 11773 } |
| 11774 if (this is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME)) { |
| 11775 return UriValidationCode.URI_WITH_DART_EXT_SCHEME; |
| 11776 } |
| 11777 try { |
| 11778 parseUriWithException(Uri.encodeFull(uriContent)); |
| 11779 } on URISyntaxException catch (exception) { |
| 11780 return UriValidationCode.INVALID_URI; |
| 11781 } |
| 11782 return null; |
| 11783 } |
| 11784 |
| 11718 @override | 11785 @override |
| 11719 void visitChildren(AstVisitor visitor) { | 11786 void visitChildren(AstVisitor visitor) { |
| 11720 super.visitChildren(visitor); | 11787 super.visitChildren(visitor); |
| 11721 safelyVisitChild(_uri, visitor); | 11788 safelyVisitChild(_uri, visitor); |
| 11722 } | 11789 } |
| 11723 } | 11790 } |
| 11724 | 11791 |
| 11725 /** | 11792 /** |
| 11793 * Validation codes returned by [UriBasedDirective#validate]. |
| 11794 */ |
| 11795 class UriValidationCode extends Enum<UriValidationCode> { |
| 11796 static const UriValidationCode INVALID_URI = const UriValidationCode('INVALID_
URI', 0); |
| 11797 |
| 11798 static const UriValidationCode URI_WITH_INTERPOLATION = const UriValidationCod
e('URI_WITH_INTERPOLATION', 1); |
| 11799 |
| 11800 static const UriValidationCode URI_WITH_DART_EXT_SCHEME = const UriValidationC
ode('URI_WITH_DART_EXT_SCHEME', 2); |
| 11801 |
| 11802 static const List<UriValidationCode> values = const [ |
| 11803 INVALID_URI, |
| 11804 URI_WITH_INTERPOLATION, |
| 11805 URI_WITH_DART_EXT_SCHEME]; |
| 11806 |
| 11807 const UriValidationCode(String name, int ordinal) : super(name, ordinal); |
| 11808 } |
| 11809 |
| 11810 /** |
| 11726 * Instances of the class `VariableDeclaration` represent an identifier that has
an initial | 11811 * Instances of the class `VariableDeclaration` represent an identifier that has
an initial |
| 11727 * value associated with it. Instances of this class are always children of the
class | 11812 * value associated with it. Instances of this class are always children of the
class |
| 11728 * [VariableDeclarationList]. | 11813 * [VariableDeclarationList]. |
| 11729 * | 11814 * |
| 11730 * <pre> | 11815 * <pre> |
| 11731 * variableDeclaration ::= | 11816 * variableDeclaration ::= |
| 11732 * [SimpleIdentifier] ('=' [Expression])? | 11817 * [SimpleIdentifier] ('=' [Expression])? |
| 11733 * </pre> | 11818 * </pre> |
| 11734 */ | 11819 */ |
| 11735 class VariableDeclaration extends Declaration { | 11820 class VariableDeclaration extends Declaration { |
| (...skipping 5910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17646 _elements[index] = node; | 17731 _elements[index] = node; |
| 17647 } | 17732 } |
| 17648 void clear() { | 17733 void clear() { |
| 17649 _elements = <E> []; | 17734 _elements = <E> []; |
| 17650 } | 17735 } |
| 17651 int get length => _elements.length; | 17736 int get length => _elements.length; |
| 17652 void set length(int value) { | 17737 void set length(int value) { |
| 17653 throw new UnsupportedError("Cannot resize NodeList."); | 17738 throw new UnsupportedError("Cannot resize NodeList."); |
| 17654 } | 17739 } |
| 17655 } | 17740 } |
| OLD | NEW |