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 3977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3988 | 3988 |
3989 /** | 3989 /** |
3990 * The declaration of a class. | 3990 * The declaration of a class. |
3991 * | 3991 * |
3992 * > classDeclaration ::= | 3992 * > classDeclaration ::= |
3993 * > 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]? | 3993 * > 'abstract'? 'class' [SimpleIdentifier] [TypeParameterList]? |
3994 * > ([ExtendsClause] [WithClause]?)? | 3994 * > ([ExtendsClause] [WithClause]?)? |
3995 * > [ImplementsClause]? | 3995 * > [ImplementsClause]? |
3996 * > '{' [ClassMember]* '}' | 3996 * > '{' [ClassMember]* '}' |
3997 */ | 3997 */ |
3998 class ClassDeclaration extends CompilationUnitMember { | 3998 class ClassDeclaration extends NamedCompilationUnitMember { |
3999 /** | 3999 /** |
4000 * The 'abstract' keyword, or `null` if the keyword was absent. | 4000 * The 'abstract' keyword, or `null` if the keyword was absent. |
4001 */ | 4001 */ |
4002 Token abstractKeyword; | 4002 Token abstractKeyword; |
4003 | 4003 |
4004 /** | 4004 /** |
4005 * The token representing the 'class' keyword. | 4005 * The token representing the 'class' keyword. |
4006 */ | 4006 */ |
4007 Token classKeyword; | 4007 Token classKeyword; |
4008 | 4008 |
4009 /** | 4009 /** |
4010 * The name of the class being declared. | |
4011 */ | |
4012 SimpleIdentifier _name; | |
4013 | |
4014 /** | |
4015 * The type parameters for the class, or `null` if the class does not have any | 4010 * The type parameters for the class, or `null` if the class does not have any |
4016 * type parameters. | 4011 * type parameters. |
4017 */ | 4012 */ |
4018 TypeParameterList _typeParameters; | 4013 TypeParameterList _typeParameters; |
4019 | 4014 |
4020 /** | 4015 /** |
4021 * The extends clause for the class, or `null` if the class does not extend | 4016 * The extends clause for the class, or `null` if the class does not extend |
4022 * any other class. | 4017 * any other class. |
4023 */ | 4018 */ |
4024 ExtendsClause _extendsClause; | 4019 ExtendsClause _extendsClause; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4064 * have any type parameters. Any or all of the [extendsClause], [withClause], | 4059 * have any type parameters. Any or all of the [extendsClause], [withClause], |
4065 * and [implementsClause] can be `null` if the class does not have the | 4060 * and [implementsClause] can be `null` if the class does not have the |
4066 * corresponding clause. The list of [members] can be `null` if the class does | 4061 * corresponding clause. The list of [members] can be `null` if the class does |
4067 * not have any members. | 4062 * not have any members. |
4068 */ | 4063 */ |
4069 ClassDeclaration(Comment comment, List<Annotation> metadata, | 4064 ClassDeclaration(Comment comment, List<Annotation> metadata, |
4070 this.abstractKeyword, this.classKeyword, SimpleIdentifier name, | 4065 this.abstractKeyword, this.classKeyword, SimpleIdentifier name, |
4071 TypeParameterList typeParameters, ExtendsClause extendsClause, | 4066 TypeParameterList typeParameters, ExtendsClause extendsClause, |
4072 WithClause withClause, ImplementsClause implementsClause, | 4067 WithClause withClause, ImplementsClause implementsClause, |
4073 this.leftBracket, List<ClassMember> members, this.rightBracket) | 4068 this.leftBracket, List<ClassMember> members, this.rightBracket) |
4074 : super(comment, metadata) { | 4069 : super(comment, metadata, name) { |
4075 _name = _becomeParentOf(name); | |
4076 _typeParameters = _becomeParentOf(typeParameters); | 4070 _typeParameters = _becomeParentOf(typeParameters); |
4077 _extendsClause = _becomeParentOf(extendsClause); | 4071 _extendsClause = _becomeParentOf(extendsClause); |
4078 _withClause = _becomeParentOf(withClause); | 4072 _withClause = _becomeParentOf(withClause); |
4079 _implementsClause = _becomeParentOf(implementsClause); | 4073 _implementsClause = _becomeParentOf(implementsClause); |
4080 _members = new NodeList<ClassMember>(this, members); | 4074 _members = new NodeList<ClassMember>(this, members); |
4081 } | 4075 } |
4082 | 4076 |
4083 @override | 4077 @override |
4084 Iterable get childEntities => super._childEntities | 4078 Iterable get childEntities => super._childEntities |
4085 ..add(abstractKeyword) | 4079 ..add(abstractKeyword) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 * Return `true` if this class is declared to be an abstract class. | 4133 * Return `true` if this class is declared to be an abstract class. |
4140 */ | 4134 */ |
4141 bool get isAbstract => abstractKeyword != null; | 4135 bool get isAbstract => abstractKeyword != null; |
4142 | 4136 |
4143 /** | 4137 /** |
4144 * Return the members defined by the class. | 4138 * Return the members defined by the class. |
4145 */ | 4139 */ |
4146 NodeList<ClassMember> get members => _members; | 4140 NodeList<ClassMember> get members => _members; |
4147 | 4141 |
4148 /** | 4142 /** |
4149 * Return the name of the class being declared. | |
4150 */ | |
4151 SimpleIdentifier get name => _name; | |
4152 | |
4153 /** | |
4154 * Set the name of the class being declared to the given [identifier]. | |
4155 */ | |
4156 void set name(SimpleIdentifier identifier) { | |
4157 _name = _becomeParentOf(identifier); | |
4158 } | |
4159 | |
4160 /** | |
4161 * Return the native clause for this class, or `null` if the class does not | 4143 * Return the native clause for this class, or `null` if the class does not |
4162 * have a native clause. | 4144 * have a native clause. |
4163 */ | 4145 */ |
4164 NativeClause get nativeClause => _nativeClause; | 4146 NativeClause get nativeClause => _nativeClause; |
4165 | 4147 |
4166 /** | 4148 /** |
4167 * Set the native clause for this class to the given [nativeClause]. | 4149 * Set the native clause for this class to the given [nativeClause]. |
4168 */ | 4150 */ |
4169 void set nativeClause(NativeClause nativeClause) { | 4151 void set nativeClause(NativeClause nativeClause) { |
4170 _nativeClause = _becomeParentOf(nativeClause); | 4152 _nativeClause = _becomeParentOf(nativeClause); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 * A class type alias. | 4270 * A class type alias. |
4289 * | 4271 * |
4290 * > classTypeAlias ::= | 4272 * > classTypeAlias ::= |
4291 * > [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplicatio
n | 4273 * > [SimpleIdentifier] [TypeParameterList]? '=' 'abstract'? mixinApplicatio
n |
4292 * > | 4274 * > |
4293 * > mixinApplication ::= | 4275 * > mixinApplication ::= |
4294 * > [TypeName] [WithClause] [ImplementsClause]? ';' | 4276 * > [TypeName] [WithClause] [ImplementsClause]? ';' |
4295 */ | 4277 */ |
4296 class ClassTypeAlias extends TypeAlias { | 4278 class ClassTypeAlias extends TypeAlias { |
4297 /** | 4279 /** |
4298 * The name of the class being declared. | |
4299 */ | |
4300 SimpleIdentifier _name; | |
4301 | |
4302 /** | |
4303 * The type parameters for the class, or `null` if the class does not have any | 4280 * The type parameters for the class, or `null` if the class does not have any |
4304 * type parameters. | 4281 * type parameters. |
4305 */ | 4282 */ |
4306 TypeParameterList _typeParameters; | 4283 TypeParameterList _typeParameters; |
4307 | 4284 |
4308 /** | 4285 /** |
4309 * The token for the '=' separating the name from the definition. | 4286 * The token for the '=' separating the name from the definition. |
4310 */ | 4287 */ |
4311 Token equals; | 4288 Token equals; |
4312 | 4289 |
(...skipping 24 matching lines...) Expand all Loading... |
4337 * [comment] and [metadata] can be `null` if the class type alias does not | 4314 * [comment] and [metadata] can be `null` if the class type alias does not |
4338 * have the corresponding attribute. The [typeParameters] can be `null` if the | 4315 * have the corresponding attribute. The [typeParameters] can be `null` if the |
4339 * class does not have any type parameters. The [abstractKeyword] can be | 4316 * class does not have any type parameters. The [abstractKeyword] can be |
4340 * `null` if the class is not abstract. The [implementsClause] can be `null` | 4317 * `null` if the class is not abstract. The [implementsClause] can be `null` |
4341 * if the class does not implement any interfaces. | 4318 * if the class does not implement any interfaces. |
4342 */ | 4319 */ |
4343 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, | 4320 ClassTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, |
4344 SimpleIdentifier name, TypeParameterList typeParameters, this.equals, | 4321 SimpleIdentifier name, TypeParameterList typeParameters, this.equals, |
4345 this.abstractKeyword, TypeName superclass, WithClause withClause, | 4322 this.abstractKeyword, TypeName superclass, WithClause withClause, |
4346 ImplementsClause implementsClause, Token semicolon) | 4323 ImplementsClause implementsClause, Token semicolon) |
4347 : super(comment, metadata, keyword, semicolon) { | 4324 : super(comment, metadata, keyword, name, semicolon) { |
4348 _name = _becomeParentOf(name); | |
4349 _typeParameters = _becomeParentOf(typeParameters); | 4325 _typeParameters = _becomeParentOf(typeParameters); |
4350 _superclass = _becomeParentOf(superclass); | 4326 _superclass = _becomeParentOf(superclass); |
4351 _withClause = _becomeParentOf(withClause); | 4327 _withClause = _becomeParentOf(withClause); |
4352 _implementsClause = _becomeParentOf(implementsClause); | 4328 _implementsClause = _becomeParentOf(implementsClause); |
4353 } | 4329 } |
4354 | 4330 |
4355 @override | 4331 @override |
4356 Iterable get childEntities => super._childEntities | 4332 Iterable get childEntities => super._childEntities |
4357 ..add(typedefKeyword) | 4333 ..add(typedefKeyword) |
4358 ..add(_name) | 4334 ..add(_name) |
(...skipping 21 matching lines...) Expand all Loading... |
4380 void set implementsClause(ImplementsClause implementsClause) { | 4356 void set implementsClause(ImplementsClause implementsClause) { |
4381 _implementsClause = _becomeParentOf(implementsClause); | 4357 _implementsClause = _becomeParentOf(implementsClause); |
4382 } | 4358 } |
4383 | 4359 |
4384 /** | 4360 /** |
4385 * Return `true` if this class is declared to be an abstract class. | 4361 * Return `true` if this class is declared to be an abstract class. |
4386 */ | 4362 */ |
4387 bool get isAbstract => abstractKeyword != null; | 4363 bool get isAbstract => abstractKeyword != null; |
4388 | 4364 |
4389 /** | 4365 /** |
4390 * Return the name of the class being declared. | |
4391 */ | |
4392 SimpleIdentifier get name => _name; | |
4393 | |
4394 /** | |
4395 * Set the name of the class being declared to the given [identifier]. | |
4396 */ | |
4397 void set name(SimpleIdentifier name) { | |
4398 _name = _becomeParentOf(name); | |
4399 } | |
4400 | |
4401 /** | |
4402 * Return the name of the superclass of the class being declared. | 4366 * Return the name of the superclass of the class being declared. |
4403 */ | 4367 */ |
4404 TypeName get superclass => _superclass; | 4368 TypeName get superclass => _superclass; |
4405 | 4369 |
4406 /** | 4370 /** |
4407 * Set the name of the superclass of the class being declared to the given | 4371 * Set the name of the superclass of the class being declared to the given |
4408 * [superclass] name. | 4372 * [superclass] name. |
4409 */ | 4373 */ |
4410 void set superclass(TypeName superclass) { | 4374 void set superclass(TypeName superclass) { |
4411 _superclass = _becomeParentOf(superclass); | 4375 _superclass = _becomeParentOf(superclass); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4836 _declarations.accept(visitor); | 4800 _declarations.accept(visitor); |
4837 } else { | 4801 } else { |
4838 for (AstNode child in sortedDirectivesAndDeclarations) { | 4802 for (AstNode child in sortedDirectivesAndDeclarations) { |
4839 child.accept(visitor); | 4803 child.accept(visitor); |
4840 } | 4804 } |
4841 } | 4805 } |
4842 } | 4806 } |
4843 } | 4807 } |
4844 | 4808 |
4845 /** | 4809 /** |
4846 * A node that declares a name within the scope of a compilation unit. | 4810 * A node that declares one or more names within the scope of a compilation |
| 4811 * unit. |
4847 * | 4812 * |
4848 * > compilationUnitMember ::= | 4813 * > compilationUnitMember ::= |
4849 * > [ClassDeclaration] | 4814 * > [ClassDeclaration] |
4850 * > | [TypeAlias] | 4815 * > | [TypeAlias] |
4851 * > | [FunctionDeclaration] | 4816 * > | [FunctionDeclaration] |
4852 * > | [MethodDeclaration] | 4817 * > | [MethodDeclaration] |
4853 * > | [VariableDeclaration] | 4818 * > | [VariableDeclaration] |
4854 * > | [VariableDeclaration] | 4819 * > | [VariableDeclaration] |
4855 */ | 4820 */ |
4856 abstract class CompilationUnitMember extends Declaration { | 4821 abstract class CompilationUnitMember extends Declaration { |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5864 @override | 5829 @override |
5865 accept(AstVisitor visitor) => visitor.visitContinueStatement(this); | 5830 accept(AstVisitor visitor) => visitor.visitContinueStatement(this); |
5866 | 5831 |
5867 @override | 5832 @override |
5868 void visitChildren(AstVisitor visitor) { | 5833 void visitChildren(AstVisitor visitor) { |
5869 _safelyVisitChild(_label, visitor); | 5834 _safelyVisitChild(_label, visitor); |
5870 } | 5835 } |
5871 } | 5836 } |
5872 | 5837 |
5873 /** | 5838 /** |
5874 * A node that represents the declaration of a name. Each declared name is | 5839 * A node that represents the declaration of one or more names. Each declared |
5875 * visible within a name scope. | 5840 * name is visible within a name scope. |
5876 */ | 5841 */ |
5877 abstract class Declaration extends AnnotatedNode { | 5842 abstract class Declaration extends AnnotatedNode { |
5878 /** | 5843 /** |
5879 * Initialize a newly created declaration. Either or both of the [comment] and | 5844 * Initialize a newly created declaration. Either or both of the [comment] and |
5880 * [metadata] can be `null` if the declaration does not have the corresponding | 5845 * [metadata] can be `null` if the declaration does not have the corresponding |
5881 * attribute. | 5846 * attribute. |
5882 */ | 5847 */ |
5883 Declaration(Comment comment, List<Annotation> metadata) | 5848 Declaration(Comment comment, List<Annotation> metadata) |
5884 : super(comment, metadata); | 5849 : super(comment, metadata); |
5885 | 5850 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6593 _safelyVisitChild(_name, visitor); | 6558 _safelyVisitChild(_name, visitor); |
6594 } | 6559 } |
6595 } | 6560 } |
6596 | 6561 |
6597 /** | 6562 /** |
6598 * The declaration of an enumeration. | 6563 * The declaration of an enumeration. |
6599 * | 6564 * |
6600 * > enumType ::= | 6565 * > enumType ::= |
6601 * > metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleI
dentifier])* (',')? '}' | 6566 * > metadata 'enum' [SimpleIdentifier] '{' [SimpleIdentifier] (',' [SimpleI
dentifier])* (',')? '}' |
6602 */ | 6567 */ |
6603 class EnumDeclaration extends CompilationUnitMember { | 6568 class EnumDeclaration extends NamedCompilationUnitMember { |
6604 /** | 6569 /** |
6605 * The 'enum' keyword. | 6570 * The 'enum' keyword. |
6606 */ | 6571 */ |
6607 Token enumKeyword; | 6572 Token enumKeyword; |
6608 | 6573 |
6609 /** | 6574 /** |
6610 * The name of the enumeration. | |
6611 */ | |
6612 SimpleIdentifier _name; | |
6613 | |
6614 /** | |
6615 * The left curly bracket. | 6575 * The left curly bracket. |
6616 */ | 6576 */ |
6617 Token leftBracket; | 6577 Token leftBracket; |
6618 | 6578 |
6619 /** | 6579 /** |
6620 * The enumeration constants being declared. | 6580 * The enumeration constants being declared. |
6621 */ | 6581 */ |
6622 NodeList<EnumConstantDeclaration> _constants; | 6582 NodeList<EnumConstantDeclaration> _constants; |
6623 | 6583 |
6624 /** | 6584 /** |
6625 * The right curly bracket. | 6585 * The right curly bracket. |
6626 */ | 6586 */ |
6627 Token rightBracket; | 6587 Token rightBracket; |
6628 | 6588 |
6629 /** | 6589 /** |
6630 * Initialize a newly created enumeration declaration. Either or both of the | 6590 * Initialize a newly created enumeration declaration. Either or both of the |
6631 * [comment] and [metadata] can be `null` if the declaration does not have the | 6591 * [comment] and [metadata] can be `null` if the declaration does not have the |
6632 * corresponding attribute. The list of [constants] must contain at least one | 6592 * corresponding attribute. The list of [constants] must contain at least one |
6633 * value. | 6593 * value. |
6634 */ | 6594 */ |
6635 EnumDeclaration(Comment comment, List<Annotation> metadata, this.enumKeyword, | 6595 EnumDeclaration(Comment comment, List<Annotation> metadata, this.enumKeyword, |
6636 SimpleIdentifier name, this.leftBracket, | 6596 SimpleIdentifier name, this.leftBracket, |
6637 List<EnumConstantDeclaration> constants, this.rightBracket) | 6597 List<EnumConstantDeclaration> constants, this.rightBracket) |
6638 : super(comment, metadata) { | 6598 : super(comment, metadata, name) { |
6639 _name = _becomeParentOf(name); | |
6640 _constants = new NodeList<EnumConstantDeclaration>(this, constants); | 6599 _constants = new NodeList<EnumConstantDeclaration>(this, constants); |
6641 } | 6600 } |
6642 | 6601 |
6643 @override | 6602 @override |
6644 // TODO(brianwilkerson) Add commas? | 6603 // TODO(brianwilkerson) Add commas? |
6645 Iterable get childEntities => super._childEntities | 6604 Iterable get childEntities => super._childEntities |
6646 ..add(enumKeyword) | 6605 ..add(enumKeyword) |
6647 ..add(_name) | 6606 ..add(_name) |
6648 ..add(leftBracket) | 6607 ..add(leftBracket) |
6649 ..addAll(_constants) | 6608 ..addAll(_constants) |
(...skipping 22 matching lines...) Expand all Loading... |
6672 Token get keyword => enumKeyword; | 6631 Token get keyword => enumKeyword; |
6673 | 6632 |
6674 /** | 6633 /** |
6675 * Set the token for the 'enum' keyword to the given [token]. | 6634 * Set the token for the 'enum' keyword to the given [token]. |
6676 */ | 6635 */ |
6677 @deprecated // Use "this.enumKeyword" | 6636 @deprecated // Use "this.enumKeyword" |
6678 set keyword(Token token) { | 6637 set keyword(Token token) { |
6679 enumKeyword = token; | 6638 enumKeyword = token; |
6680 } | 6639 } |
6681 | 6640 |
6682 /** | |
6683 * Return the name of the enumeration. | |
6684 */ | |
6685 SimpleIdentifier get name => _name; | |
6686 | |
6687 /** | |
6688 * Set the name of the enumeration to the given [name]. | |
6689 */ | |
6690 void set name(SimpleIdentifier name) { | |
6691 _name = _becomeParentOf(name); | |
6692 } | |
6693 | |
6694 @override | 6641 @override |
6695 accept(AstVisitor visitor) => visitor.visitEnumDeclaration(this); | 6642 accept(AstVisitor visitor) => visitor.visitEnumDeclaration(this); |
6696 | 6643 |
6697 @override | 6644 @override |
6698 void visitChildren(AstVisitor visitor) { | 6645 void visitChildren(AstVisitor visitor) { |
6699 super.visitChildren(visitor); | 6646 super.visitChildren(visitor); |
6700 _safelyVisitChild(_name, visitor); | 6647 _safelyVisitChild(_name, visitor); |
6701 _constants.accept(visitor); | 6648 _constants.accept(visitor); |
6702 } | 6649 } |
6703 } | 6650 } |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7899 /** | 7846 /** |
7900 * A top-level declaration. | 7847 * A top-level declaration. |
7901 * | 7848 * |
7902 * > functionDeclaration ::= | 7849 * > functionDeclaration ::= |
7903 * > 'external' functionSignature | 7850 * > 'external' functionSignature |
7904 * > | functionSignature [FunctionBody] | 7851 * > | functionSignature [FunctionBody] |
7905 * > | 7852 * > |
7906 * > functionSignature ::= | 7853 * > functionSignature ::= |
7907 * > [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] | 7854 * > [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] |
7908 */ | 7855 */ |
7909 class FunctionDeclaration extends CompilationUnitMember { | 7856 class FunctionDeclaration extends NamedCompilationUnitMember { |
7910 /** | 7857 /** |
7911 * The token representing the 'external' keyword, or `null` if this is not an | 7858 * The token representing the 'external' keyword, or `null` if this is not an |
7912 * external function. | 7859 * external function. |
7913 */ | 7860 */ |
7914 Token externalKeyword; | 7861 Token externalKeyword; |
7915 | 7862 |
7916 /** | 7863 /** |
7917 * The return type of the function, or `null` if no return type was declared. | 7864 * The return type of the function, or `null` if no return type was declared. |
7918 */ | 7865 */ |
7919 TypeName _returnType; | 7866 TypeName _returnType; |
7920 | 7867 |
7921 /** | 7868 /** |
7922 * The token representing the 'get' or 'set' keyword, or `null` if this is a | 7869 * The token representing the 'get' or 'set' keyword, or `null` if this is a |
7923 * function declaration rather than a property declaration. | 7870 * function declaration rather than a property declaration. |
7924 */ | 7871 */ |
7925 Token propertyKeyword; | 7872 Token propertyKeyword; |
7926 | 7873 |
7927 /** | 7874 /** |
7928 * The name of the function, or `null` if the function is not named. | |
7929 */ | |
7930 SimpleIdentifier _name; | |
7931 | |
7932 /** | |
7933 * The function expression being wrapped. | 7875 * The function expression being wrapped. |
7934 */ | 7876 */ |
7935 FunctionExpression _functionExpression; | 7877 FunctionExpression _functionExpression; |
7936 | 7878 |
7937 /** | 7879 /** |
7938 * Initialize a newly created function declaration. Either or both of the | 7880 * Initialize a newly created function declaration. Either or both of the |
7939 * [comment] and [metadata] can be `null` if the function does not have the | 7881 * [comment] and [metadata] can be `null` if the function does not have the |
7940 * corresponding attribute. The [externalKeyword] can be `null` if the | 7882 * corresponding attribute. The [externalKeyword] can be `null` if the |
7941 * function is not an external function. The [returnType] can be `null` if no | 7883 * function is not an external function. The [returnType] can be `null` if no |
7942 * return type was specified. The [propertyKeyword] can be `null` if the | 7884 * return type was specified. The [propertyKeyword] can be `null` if the |
7943 * function is neither a getter or a setter. | 7885 * function is neither a getter or a setter. |
7944 */ | 7886 */ |
7945 FunctionDeclaration(Comment comment, List<Annotation> metadata, | 7887 FunctionDeclaration(Comment comment, List<Annotation> metadata, |
7946 this.externalKeyword, TypeName returnType, this.propertyKeyword, | 7888 this.externalKeyword, TypeName returnType, this.propertyKeyword, |
7947 SimpleIdentifier name, FunctionExpression functionExpression) | 7889 SimpleIdentifier name, FunctionExpression functionExpression) |
7948 : super(comment, metadata) { | 7890 : super(comment, metadata, name) { |
7949 _returnType = _becomeParentOf(returnType); | 7891 _returnType = _becomeParentOf(returnType); |
7950 _name = _becomeParentOf(name); | |
7951 _functionExpression = _becomeParentOf(functionExpression); | 7892 _functionExpression = _becomeParentOf(functionExpression); |
7952 } | 7893 } |
7953 | 7894 |
7954 @override | 7895 @override |
7955 Iterable get childEntities => super._childEntities | 7896 Iterable get childEntities => super._childEntities |
7956 ..add(externalKeyword) | 7897 ..add(externalKeyword) |
7957 ..add(_returnType) | 7898 ..add(_returnType) |
7958 ..add(propertyKeyword) | 7899 ..add(propertyKeyword) |
7959 ..add(_name) | 7900 ..add(_name) |
7960 ..add(_functionExpression); | 7901 ..add(_functionExpression); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7999 bool get isGetter => propertyKeyword != null && | 7940 bool get isGetter => propertyKeyword != null && |
8000 (propertyKeyword as KeywordToken).keyword == Keyword.GET; | 7941 (propertyKeyword as KeywordToken).keyword == Keyword.GET; |
8001 | 7942 |
8002 /** | 7943 /** |
8003 * Return `true` if this function declares a setter. | 7944 * Return `true` if this function declares a setter. |
8004 */ | 7945 */ |
8005 bool get isSetter => propertyKeyword != null && | 7946 bool get isSetter => propertyKeyword != null && |
8006 (propertyKeyword as KeywordToken).keyword == Keyword.SET; | 7947 (propertyKeyword as KeywordToken).keyword == Keyword.SET; |
8007 | 7948 |
8008 /** | 7949 /** |
8009 * Return the name of the function, or `null` if the function is not named. | |
8010 */ | |
8011 SimpleIdentifier get name => _name; | |
8012 | |
8013 /** | |
8014 * Set the name of the function to the given [identifier]. | |
8015 */ | |
8016 void set name(SimpleIdentifier identifier) { | |
8017 _name = _becomeParentOf(identifier); | |
8018 } | |
8019 | |
8020 /** | |
8021 * Return the return type of the function, or `null` if no return type was | 7950 * Return the return type of the function, or `null` if no return type was |
8022 * declared. | 7951 * declared. |
8023 */ | 7952 */ |
8024 TypeName get returnType => _returnType; | 7953 TypeName get returnType => _returnType; |
8025 | 7954 |
8026 /** | 7955 /** |
8027 * Set the return type of the function to the given [returnType]. | 7956 * Set the return type of the function to the given [returnType]. |
8028 */ | 7957 */ |
8029 void set returnType(TypeName returnType) { | 7958 void set returnType(TypeName returnType) { |
8030 _returnType = _becomeParentOf(returnType); | 7959 _returnType = _becomeParentOf(returnType); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8303 * > [TypeName]? [SimpleIdentifier] | 8232 * > [TypeName]? [SimpleIdentifier] |
8304 */ | 8233 */ |
8305 class FunctionTypeAlias extends TypeAlias { | 8234 class FunctionTypeAlias extends TypeAlias { |
8306 /** | 8235 /** |
8307 * The name of the return type of the function type being defined, or `null` | 8236 * The name of the return type of the function type being defined, or `null` |
8308 * if no return type was given. | 8237 * if no return type was given. |
8309 */ | 8238 */ |
8310 TypeName _returnType; | 8239 TypeName _returnType; |
8311 | 8240 |
8312 /** | 8241 /** |
8313 * The name of the function type being declared. | |
8314 */ | |
8315 SimpleIdentifier _name; | |
8316 | |
8317 /** | |
8318 * The type parameters for the function type, or `null` if the function type | 8242 * The type parameters for the function type, or `null` if the function type |
8319 * does not have any type parameters. | 8243 * does not have any type parameters. |
8320 */ | 8244 */ |
8321 TypeParameterList _typeParameters; | 8245 TypeParameterList _typeParameters; |
8322 | 8246 |
8323 /** | 8247 /** |
8324 * The parameters associated with the function type. | 8248 * The parameters associated with the function type. |
8325 */ | 8249 */ |
8326 FormalParameterList _parameters; | 8250 FormalParameterList _parameters; |
8327 | 8251 |
8328 /** | 8252 /** |
8329 * Initialize a newly created function type alias. Either or both of the | 8253 * Initialize a newly created function type alias. Either or both of the |
8330 * [comment] and [metadata] can be `null` if the function does not have the | 8254 * [comment] and [metadata] can be `null` if the function does not have the |
8331 * corresponding attribute. The [returnType] can be `null` if no return type | 8255 * corresponding attribute. The [returnType] can be `null` if no return type |
8332 * was specified. The [typeParameters] can be `null` if the function has no | 8256 * was specified. The [typeParameters] can be `null` if the function has no |
8333 * type parameters. | 8257 * type parameters. |
8334 */ | 8258 */ |
8335 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, | 8259 FunctionTypeAlias(Comment comment, List<Annotation> metadata, Token keyword, |
8336 TypeName returnType, SimpleIdentifier name, | 8260 TypeName returnType, SimpleIdentifier name, |
8337 TypeParameterList typeParameters, FormalParameterList parameters, | 8261 TypeParameterList typeParameters, FormalParameterList parameters, |
8338 Token semicolon) | 8262 Token semicolon) |
8339 : super(comment, metadata, keyword, semicolon) { | 8263 : super(comment, metadata, keyword, name, semicolon) { |
8340 _returnType = _becomeParentOf(returnType); | 8264 _returnType = _becomeParentOf(returnType); |
8341 _name = _becomeParentOf(name); | |
8342 _typeParameters = _becomeParentOf(typeParameters); | 8265 _typeParameters = _becomeParentOf(typeParameters); |
8343 _parameters = _becomeParentOf(parameters); | 8266 _parameters = _becomeParentOf(parameters); |
8344 } | 8267 } |
8345 | 8268 |
8346 @override | 8269 @override |
8347 Iterable get childEntities => super._childEntities | 8270 Iterable get childEntities => super._childEntities |
8348 ..add(typedefKeyword) | 8271 ..add(typedefKeyword) |
8349 ..add(_returnType) | 8272 ..add(_returnType) |
8350 ..add(_name) | 8273 ..add(_name) |
8351 ..add(_typeParameters) | 8274 ..add(_typeParameters) |
8352 ..add(_parameters) | 8275 ..add(_parameters) |
8353 ..add(semicolon); | 8276 ..add(semicolon); |
8354 | 8277 |
8355 @override | 8278 @override |
8356 FunctionTypeAliasElement get element => | 8279 FunctionTypeAliasElement get element => |
8357 _name != null ? (_name.staticElement as FunctionTypeAliasElement) : null; | 8280 _name != null ? (_name.staticElement as FunctionTypeAliasElement) : null; |
8358 | 8281 |
8359 /** | 8282 /** |
8360 * Return the name of the function type being declared. | |
8361 */ | |
8362 SimpleIdentifier get name => _name; | |
8363 | |
8364 /** | |
8365 * Set the name of the function type being declared to the given [name]. | |
8366 */ | |
8367 void set name(SimpleIdentifier name) { | |
8368 _name = _becomeParentOf(name); | |
8369 } | |
8370 | |
8371 /** | |
8372 * Return the parameters associated with the function type. | 8283 * Return the parameters associated with the function type. |
8373 */ | 8284 */ |
8374 FormalParameterList get parameters => _parameters; | 8285 FormalParameterList get parameters => _parameters; |
8375 | 8286 |
8376 /** | 8287 /** |
8377 * Set the parameters associated with the function type to the given list of | 8288 * Set the parameters associated with the function type to the given list of |
8378 * [parameters]. | 8289 * [parameters]. |
8379 */ | 8290 */ |
8380 void set parameters(FormalParameterList parameters) { | 8291 void set parameters(FormalParameterList parameters) { |
8381 _parameters = _becomeParentOf(parameters); | 8292 _parameters = _becomeParentOf(parameters); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8573 R visitBreakStatement(BreakStatement node) => visitStatement(node); | 8484 R visitBreakStatement(BreakStatement node) => visitStatement(node); |
8574 | 8485 |
8575 @override | 8486 @override |
8576 R visitCascadeExpression(CascadeExpression node) => visitExpression(node); | 8487 R visitCascadeExpression(CascadeExpression node) => visitExpression(node); |
8577 | 8488 |
8578 @override | 8489 @override |
8579 R visitCatchClause(CatchClause node) => visitNode(node); | 8490 R visitCatchClause(CatchClause node) => visitNode(node); |
8580 | 8491 |
8581 @override | 8492 @override |
8582 R visitClassDeclaration(ClassDeclaration node) => | 8493 R visitClassDeclaration(ClassDeclaration node) => |
8583 visitCompilationUnitMember(node); | 8494 visitNamedCompilationUnitMember(node); |
8584 | 8495 |
8585 R visitClassMember(ClassMember node) => visitDeclaration(node); | 8496 R visitClassMember(ClassMember node) => visitDeclaration(node); |
8586 | 8497 |
8587 @override | 8498 @override |
8588 R visitClassTypeAlias(ClassTypeAlias node) => visitTypeAlias(node); | 8499 R visitClassTypeAlias(ClassTypeAlias node) => visitTypeAlias(node); |
8589 | 8500 |
8590 R visitCombinator(Combinator node) => visitNode(node); | 8501 R visitCombinator(Combinator node) => visitNode(node); |
8591 | 8502 |
8592 @override | 8503 @override |
8593 R visitComment(Comment node) => visitNode(node); | 8504 R visitComment(Comment node) => visitNode(node); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8643 | 8554 |
8644 @override | 8555 @override |
8645 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); | 8556 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); |
8646 | 8557 |
8647 @override | 8558 @override |
8648 R visitEnumConstantDeclaration(EnumConstantDeclaration node) => | 8559 R visitEnumConstantDeclaration(EnumConstantDeclaration node) => |
8649 visitDeclaration(node); | 8560 visitDeclaration(node); |
8650 | 8561 |
8651 @override | 8562 @override |
8652 R visitEnumDeclaration(EnumDeclaration node) => | 8563 R visitEnumDeclaration(EnumDeclaration node) => |
8653 visitCompilationUnitMember(node); | 8564 visitNamedCompilationUnitMember(node); |
8654 | 8565 |
8655 @override | 8566 @override |
8656 R visitExportDirective(ExportDirective node) => visitNamespaceDirective(node); | 8567 R visitExportDirective(ExportDirective node) => visitNamespaceDirective(node); |
8657 | 8568 |
8658 R visitExpression(Expression node) => visitNode(node); | 8569 R visitExpression(Expression node) => visitNode(node); |
8659 | 8570 |
8660 @override | 8571 @override |
8661 R visitExpressionFunctionBody(ExpressionFunctionBody node) => | 8572 R visitExpressionFunctionBody(ExpressionFunctionBody node) => |
8662 visitFunctionBody(node); | 8573 visitFunctionBody(node); |
8663 | 8574 |
(...skipping 18 matching lines...) Expand all Loading... |
8682 @override | 8593 @override |
8683 R visitFormalParameterList(FormalParameterList node) => visitNode(node); | 8594 R visitFormalParameterList(FormalParameterList node) => visitNode(node); |
8684 | 8595 |
8685 @override | 8596 @override |
8686 R visitForStatement(ForStatement node) => visitStatement(node); | 8597 R visitForStatement(ForStatement node) => visitStatement(node); |
8687 | 8598 |
8688 R visitFunctionBody(FunctionBody node) => visitNode(node); | 8599 R visitFunctionBody(FunctionBody node) => visitNode(node); |
8689 | 8600 |
8690 @override | 8601 @override |
8691 R visitFunctionDeclaration(FunctionDeclaration node) => | 8602 R visitFunctionDeclaration(FunctionDeclaration node) => |
8692 visitCompilationUnitMember(node); | 8603 visitNamedCompilationUnitMember(node); |
8693 | 8604 |
8694 @override | 8605 @override |
8695 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => | 8606 R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => |
8696 visitStatement(node); | 8607 visitStatement(node); |
8697 | 8608 |
8698 @override | 8609 @override |
8699 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); | 8610 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); |
8700 | 8611 |
8701 @override | 8612 @override |
8702 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => | 8613 R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8768 | 8679 |
8769 @override | 8680 @override |
8770 R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node); | 8681 R visitMapLiteralEntry(MapLiteralEntry node) => visitNode(node); |
8771 | 8682 |
8772 @override | 8683 @override |
8773 R visitMethodDeclaration(MethodDeclaration node) => visitClassMember(node); | 8684 R visitMethodDeclaration(MethodDeclaration node) => visitClassMember(node); |
8774 | 8685 |
8775 @override | 8686 @override |
8776 R visitMethodInvocation(MethodInvocation node) => visitExpression(node); | 8687 R visitMethodInvocation(MethodInvocation node) => visitExpression(node); |
8777 | 8688 |
| 8689 R visitNamedCompilationUnitMember(NamedCompilationUnitMember node) => |
| 8690 visitCompilationUnitMember(node); |
| 8691 |
8778 @override | 8692 @override |
8779 R visitNamedExpression(NamedExpression node) => visitExpression(node); | 8693 R visitNamedExpression(NamedExpression node) => visitExpression(node); |
8780 | 8694 |
8781 R visitNamespaceDirective(NamespaceDirective node) => | 8695 R visitNamespaceDirective(NamespaceDirective node) => |
8782 visitUriBasedDirective(node); | 8696 visitUriBasedDirective(node); |
8783 | 8697 |
8784 @override | 8698 @override |
8785 R visitNativeClause(NativeClause node) => visitNode(node); | 8699 R visitNativeClause(NativeClause node) => visitNode(node); |
8786 | 8700 |
8787 @override | 8701 @override |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8886 @override | 8800 @override |
8887 R visitThrowExpression(ThrowExpression node) => visitExpression(node); | 8801 R visitThrowExpression(ThrowExpression node) => visitExpression(node); |
8888 | 8802 |
8889 @override | 8803 @override |
8890 R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => | 8804 R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => |
8891 visitCompilationUnitMember(node); | 8805 visitCompilationUnitMember(node); |
8892 | 8806 |
8893 @override | 8807 @override |
8894 R visitTryStatement(TryStatement node) => visitStatement(node); | 8808 R visitTryStatement(TryStatement node) => visitStatement(node); |
8895 | 8809 |
8896 R visitTypeAlias(TypeAlias node) => visitCompilationUnitMember(node); | 8810 R visitTypeAlias(TypeAlias node) => visitNamedCompilationUnitMember(node); |
8897 | 8811 |
8898 @override | 8812 @override |
8899 R visitTypeArgumentList(TypeArgumentList node) => visitNode(node); | 8813 R visitTypeArgumentList(TypeArgumentList node) => visitNode(node); |
8900 | 8814 |
8901 R visitTypedLiteral(TypedLiteral node) => visitLiteral(node); | 8815 R visitTypedLiteral(TypedLiteral node) => visitLiteral(node); |
8902 | 8816 |
8903 @override | 8817 @override |
8904 R visitTypeName(TypeName node) => visitNode(node); | 8818 R visitTypeName(TypeName node) => visitNode(node); |
8905 | 8819 |
8906 @override | 8820 @override |
(...skipping 3010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11917 | 11831 |
11918 @override | 11832 @override |
11919 void visitChildren(AstVisitor visitor) { | 11833 void visitChildren(AstVisitor visitor) { |
11920 _safelyVisitChild(_target, visitor); | 11834 _safelyVisitChild(_target, visitor); |
11921 _safelyVisitChild(_methodName, visitor); | 11835 _safelyVisitChild(_methodName, visitor); |
11922 _safelyVisitChild(_argumentList, visitor); | 11836 _safelyVisitChild(_argumentList, visitor); |
11923 } | 11837 } |
11924 } | 11838 } |
11925 | 11839 |
11926 /** | 11840 /** |
| 11841 * A node that declares a single name within the scope of a compilation unit. |
| 11842 */ |
| 11843 abstract class NamedCompilationUnitMember extends CompilationUnitMember { |
| 11844 /** |
| 11845 * The name of the member being declared. |
| 11846 */ |
| 11847 SimpleIdentifier _name; |
| 11848 |
| 11849 /** |
| 11850 * Initialize a newly created compilation unit member with the given [name]. |
| 11851 * Either or both of the [comment] and [metadata] can be `null` if the member |
| 11852 * does not have the corresponding attribute. |
| 11853 */ |
| 11854 NamedCompilationUnitMember( |
| 11855 Comment comment, List<Annotation> metadata, SimpleIdentifier name) |
| 11856 : super(comment, metadata) { |
| 11857 _name = _becomeParentOf(name); |
| 11858 } |
| 11859 |
| 11860 /** |
| 11861 * Return the name of the member being declared. |
| 11862 */ |
| 11863 SimpleIdentifier get name => _name; |
| 11864 |
| 11865 /** |
| 11866 * Set the name of the member being declared to the given [identifier]. |
| 11867 */ |
| 11868 void set name(SimpleIdentifier identifier) { |
| 11869 _name = _becomeParentOf(identifier); |
| 11870 } |
| 11871 } |
| 11872 |
| 11873 /** |
11927 * An expression that has a name associated with it. They are used in method | 11874 * An expression that has a name associated with it. They are used in method |
11928 * invocations when there are named parameters. | 11875 * invocations when there are named parameters. |
11929 * | 11876 * |
11930 * > namedExpression ::= | 11877 * > namedExpression ::= |
11931 * > [Label] [Expression] | 11878 * > [Label] [Expression] |
11932 */ | 11879 */ |
11933 class NamedExpression extends Expression { | 11880 class NamedExpression extends Expression { |
11934 /** | 11881 /** |
11935 * The name associated with the expression. | 11882 * The name associated with the expression. |
11936 */ | 11883 */ |
(...skipping 6784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18721 /** | 18668 /** |
18722 * The declaration of a type alias. | 18669 * The declaration of a type alias. |
18723 * | 18670 * |
18724 * > typeAlias ::= | 18671 * > typeAlias ::= |
18725 * > 'typedef' typeAliasBody | 18672 * > 'typedef' typeAliasBody |
18726 * > | 18673 * > |
18727 * > typeAliasBody ::= | 18674 * > typeAliasBody ::= |
18728 * > classTypeAlias | 18675 * > classTypeAlias |
18729 * > | functionTypeAlias | 18676 * > | functionTypeAlias |
18730 */ | 18677 */ |
18731 abstract class TypeAlias extends CompilationUnitMember { | 18678 abstract class TypeAlias extends NamedCompilationUnitMember { |
18732 /** | 18679 /** |
18733 * The token representing the 'typedef' keyword. | 18680 * The token representing the 'typedef' keyword. |
18734 */ | 18681 */ |
18735 Token typedefKeyword; | 18682 Token typedefKeyword; |
18736 | 18683 |
18737 /** | 18684 /** |
18738 * The semicolon terminating the declaration. | 18685 * The semicolon terminating the declaration. |
18739 */ | 18686 */ |
18740 Token semicolon; | 18687 Token semicolon; |
18741 | 18688 |
18742 /** | 18689 /** |
18743 * Initialize a newly created type alias. Either or both of the [comment] and | 18690 * Initialize a newly created type alias. Either or both of the [comment] and |
18744 * [metadata] can be `null` if the declaration does not have the corresponding | 18691 * [metadata] can be `null` if the declaration does not have the corresponding |
18745 * attribute. | 18692 * attribute. |
18746 */ | 18693 */ |
18747 TypeAlias(Comment comment, List<Annotation> metadata, this.typedefKeyword, | 18694 TypeAlias(Comment comment, List<Annotation> metadata, this.typedefKeyword, |
18748 this.semicolon) | 18695 SimpleIdentifier name, this.semicolon) |
18749 : super(comment, metadata); | 18696 : super(comment, metadata, name); |
18750 | 18697 |
18751 @override | 18698 @override |
18752 Token get endToken => semicolon; | 18699 Token get endToken => semicolon; |
18753 | 18700 |
18754 @override | 18701 @override |
18755 Token get firstTokenAfterCommentAndMetadata => typedefKeyword; | 18702 Token get firstTokenAfterCommentAndMetadata => typedefKeyword; |
18756 | 18703 |
18757 /** | 18704 /** |
18758 * Return the token representing the 'typedef' keyword. | 18705 * Return the token representing the 'typedef' keyword. |
18759 */ | 18706 */ |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20152 } | 20099 } |
20153 | 20100 |
20154 @override | 20101 @override |
20155 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); | 20102 accept(AstVisitor visitor) => visitor.visitYieldStatement(this); |
20156 | 20103 |
20157 @override | 20104 @override |
20158 void visitChildren(AstVisitor visitor) { | 20105 void visitChildren(AstVisitor visitor) { |
20159 _safelyVisitChild(_expression, visitor); | 20106 _safelyVisitChild(_expression, visitor); |
20160 } | 20107 } |
20161 } | 20108 } |
OLD | NEW |