From c9474ebaaaa2f263eddcb2ca89dfad205f684cc6 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Tue, 2 Apr 2024 17:29:29 +0000 Subject: [PATCH 01/12] meta: Introduce TargetKind.directive Fixes https://github.com/dart-lang/sdk/issues/52274 Change-Id: I67884caf86502d4edd848eb32a30097488e09db9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360480 Reviewed-by: Brian Wilkerson Commit-Queue: Samuel Rawlins --- pkg/meta/CHANGELOG.md | 2 ++ pkg/meta/lib/meta_meta.dart | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md index c9c846153fa1..2691028656ad 100644 --- a/pkg/meta/CHANGELOG.md +++ b/pkg/meta/CHANGELOG.md @@ -2,6 +2,8 @@ - Introduce `TargetKind.constructor`, to indicate that an annotation is valid on any constructor. +- Introduce `TargetKind.directive`, to indicate that an annotation is valid on + any directive. - Introduce `TargetKind.typeParamteer`, to indicate that an annotation is valid on any type parameter. - Introduce `@doNotSubmit` to annotate members that should not be submitted to diff --git a/pkg/meta/lib/meta_meta.dart b/pkg/meta/lib/meta_meta.dart index f1de463ade61..b055ba567905 100644 --- a/pkg/meta/lib/meta_meta.dart +++ b/pkg/meta/lib/meta_meta.dart @@ -48,6 +48,11 @@ class TargetKind { /// because there is no way to annotate a primary constructor. static const constructor = TargetKind._('constructors', 'constructor'); + /// Indicates that an annotation is valid on any directive in a library or + /// part file, whether it's a `library`, `import`, `export`, `part`, or + /// `part of` directive. + static const directive = TargetKind._('directives', 'directive'); + /// Indicates that an annotation is valid on any enum declaration. static const enumType = TargetKind._('enums', 'enumType'); @@ -119,6 +124,7 @@ class TargetKind { static const values = [ classType, constructor, + directive, enumType, extension, extensionType, From 919d405617da97079668ce18301fca14946138e4 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Tue, 2 Apr 2024 17:47:22 +0000 Subject: [PATCH 02/12] Augment. Parse 'augment' for extension declaration. Change-Id: I66bff906ed990a84b4c48bd1c32ef6ac7f1c21b3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360121 Commit-Queue: Konstantin Shcheglov Reviewed-by: Brian Wilkerson Reviewed-by: Johnni Winther --- .../lib/src/macros/code_optimizer.dart | 3 +- .../lib/src/parser/forwarding_listener.dart | 12 +- .../lib/src/parser/listener.dart | 7 +- .../lib/src/parser/parser_impl.dart | 9 +- pkg/analyzer/lib/src/dart/ast/ast.dart | 12 +- pkg/analyzer/lib/src/fasta/ast_builder.dart | 11 +- .../src/dart/parser/extension_type_test.dart | 26 ++++ .../fasta/kernel/macro/annotation_parser.dart | 7 +- .../lib/src/fasta/source/diet_listener.dart | 7 +- .../lib/src/fasta/source/outline_builder.dart | 7 +- .../lib/src/fasta/util/parser_ast_helper.dart | 16 +- .../lib/src/fasta/util/textual_outline.dart | 4 +- .../extension_named_type.dart.expect | 4 +- ...tension_named_type.dart.intertwined.expect | 6 +- .../extension_type.dart.expect | 4 +- .../extension_type.dart.intertwined.expect | 6 +- .../inline_class/extends_with.dart.expect | 92 ++++++------ .../extends_with.dart.intertwined.expect | 138 +++++++++--------- .../inline_class/extension_type.dart.expect | 28 ++-- .../extension_type.dart.intertwined.expect | 42 +++--- .../extension_type_const.dart.expect | 28 ++-- ...tension_type_const.dart.intertwined.expect | 42 +++--- .../extension_type_missing_name.dart.expect | 32 ++-- ..._type_missing_name.dart.intertwined.expect | 48 +++--- .../extension_type_on.dart.expect | 16 +- .../extension_type_on.dart.intertwined.expect | 24 +-- .../inline_class/no_body.dart.expect | 12 +- .../no_body.dart.intertwined.expect | 18 +-- .../no_primary_constructor.dart.expect | 36 ++--- ...rimary_constructor.dart.intertwined.expect | 54 +++---- pkg/front_end/test/parser_test_listener.dart | 15 +- pkg/front_end/test/parser_test_parser.dart | 5 +- 32 files changed, 418 insertions(+), 353 deletions(-) diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/code_optimizer.dart b/pkg/_fe_analyzer_shared/lib/src/macros/code_optimizer.dart index fc4bb55e7e31..fe51702812b6 100644 --- a/pkg/_fe_analyzer_shared/lib/src/macros/code_optimizer.dart +++ b/pkg/_fe_analyzer_shared/lib/src/macros/code_optimizer.dart @@ -279,7 +279,8 @@ class _Listener extends Listener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { + void beginExtensionTypeDeclaration( + Token? augmentToken, Token extensionKeyword, Token name) { declaredNames.add(name.lexeme); } diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart index cae695e7bb03..6b4a31eb4ca2 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart @@ -2088,8 +2088,10 @@ class ForwardingListener implements Listener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { - listener?.beginExtensionTypeDeclaration(extensionKeyword, name); + void beginExtensionTypeDeclaration( + Token? augmentToken, Token extensionKeyword, Token name) { + listener?.beginExtensionTypeDeclaration( + augmentToken, extensionKeyword, name); } @override @@ -2100,10 +2102,10 @@ class ForwardingListener implements Listener { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { listener?.endExtensionTypeDeclaration( - beginToken, extensionKeyword, typeKeyword, endToken); + beginToken, augmentToken, extensionKeyword, typeKeyword, endToken); } @override diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart index d4cc3e87ed41..a1c58dbf9da5 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart @@ -267,15 +267,16 @@ class Listener implements UnescapeErrorListener { /// - type variables /// /// At this point we have parsed the name and type parameter declarations. - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) {} + void beginExtensionTypeDeclaration( + Token? augmentKeyword, Token extensionKeyword, Token name) {} /// Handle the end of an extension methods declaration. Substructures: /// - substructures from [beginExtensionTypeDeclaration] /// - primary constructor formals /// - implements clause /// - body - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { logEvent('ExtensionTypeDeclaration'); } diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart index a510ff0d00ca..06fe1d8a2e70 100644 --- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart +++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart @@ -3068,7 +3068,7 @@ class Parser { // 'extension' 'type' Token typeKeyword = token.next!; return parseExtensionTypeDeclaration( - beginToken, token.next!, extensionKeyword, typeKeyword); + beginToken, token.next!, augmentToken, extensionKeyword, typeKeyword); } else { return parseExtensionDeclaration( beginToken, token, augmentToken, extensionKeyword); @@ -3178,7 +3178,7 @@ class Parser { /// ('.' )? '{' * '}' /// Token parseExtensionTypeDeclaration(Token beginToken, Token token, - Token extensionKeyword, Token typeKeyword) { + Token? augmentToken, Token extensionKeyword, Token typeKeyword) { assert(token.isIdentifier && token.lexeme == 'type'); Token? constKeyword = null; if (optional('const', token.next!)) { @@ -3199,7 +3199,8 @@ class Parser { token = name; token = computeTypeParamOrArg(token, /* inDeclaration = */ true) .parseVariables(token, this); - listener.beginExtensionTypeDeclaration(extensionKeyword, name); + listener.beginExtensionTypeDeclaration( + augmentToken, extensionKeyword, name); if (optional('(', token.next!) || optional('.', token.next!)) { Token beginPrimaryConstructor = token.next!; listener.beginPrimaryConstructor(beginPrimaryConstructor); @@ -3234,7 +3235,7 @@ class Parser { token = parseClassOrMixinOrExtensionBody( token, DeclarationKind.ExtensionType, name.lexeme); listener.endExtensionTypeDeclaration( - beginToken, extensionKeyword, typeKeyword, token); + beginToken, augmentToken, extensionKeyword, typeKeyword, token); return token; } diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart index 1e1269b7d7d3..1db20c465994 100644 --- a/pkg/analyzer/lib/src/dart/ast/ast.dart +++ b/pkg/analyzer/lib/src/dart/ast/ast.dart @@ -6797,6 +6797,10 @@ final class ExtensionOverrideImpl extends ExpressionImpl @experimental abstract final class ExtensionTypeDeclaration implements NamedCompilationUnitMember { + /// The 'augment' keyword, or `null` if the keyword was absent. + @experimental + Token? get augmentKeyword; + /// The 'const' keyword. Token? get constKeyword; @@ -6830,6 +6834,9 @@ abstract final class ExtensionTypeDeclaration final class ExtensionTypeDeclarationImpl extends NamedCompilationUnitMemberImpl implements ExtensionTypeDeclaration { + @override + final Token? augmentKeyword; + @override final Token extensionKeyword; @@ -6863,6 +6870,7 @@ final class ExtensionTypeDeclarationImpl extends NamedCompilationUnitMemberImpl ExtensionTypeDeclarationImpl({ required super.comment, required super.metadata, + required this.augmentKeyword, required this.extensionKeyword, required this.typeKeyword, required this.constKeyword, @@ -6884,10 +6892,12 @@ final class ExtensionTypeDeclarationImpl extends NamedCompilationUnitMemberImpl Token get endToken => rightBracket; @override - Token get firstTokenAfterCommentAndMetadata => extensionKeyword; + Token get firstTokenAfterCommentAndMetadata => + augmentKeyword ?? extensionKeyword; @override ChildEntities get _childEntities => super._childEntities + ..addToken('augmentKeyword', augmentKeyword) ..addToken('extensionKeyword', extensionKeyword) ..addToken('typeKeyword', typeKeyword) ..addToken('constKeyword', constKeyword) diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart index 65b701ad230d..89e86437a511 100644 --- a/pkg/analyzer/lib/src/fasta/ast_builder.dart +++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart @@ -332,7 +332,8 @@ class AstBuilder extends StackListener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { + void beginExtensionTypeDeclaration( + Token? augmentKeyword, Token extensionKeyword, Token name) { assert(optional('extension', extensionKeyword)); assert(_classLikeBuilder == null); @@ -343,6 +344,7 @@ class AstBuilder extends StackListener { _classLikeBuilder = _ExtensionTypeDeclarationBuilder( comment: comment, metadata: metadata, + augmentKeyword: augmentKeyword, extensionKeyword: extensionKeyword, name: name, typeParameters: typeParameters, @@ -1635,8 +1637,8 @@ class AstBuilder extends StackListener { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { final implementsClause = pop(NullValues.IdentifierList) as ImplementsClauseImpl?; var representation = pop(const NullValue()) @@ -6143,6 +6145,7 @@ class _ExtensionDeclarationBuilder extends _ClassLikeDeclarationBuilder { } class _ExtensionTypeDeclarationBuilder extends _ClassLikeDeclarationBuilder { + final Token? augmentKeyword; final Token extensionKeyword; final Token name; @@ -6152,6 +6155,7 @@ class _ExtensionTypeDeclarationBuilder extends _ClassLikeDeclarationBuilder { required super.typeParameters, required super.leftBracket, required super.rightBracket, + required this.augmentKeyword, required this.extensionKeyword, required this.name, }); @@ -6165,6 +6169,7 @@ class _ExtensionTypeDeclarationBuilder extends _ClassLikeDeclarationBuilder { return ExtensionTypeDeclarationImpl( comment: comment, metadata: metadata, + augmentKeyword: augmentKeyword, extensionKeyword: extensionKeyword, typeKeyword: typeKeyword, constKeyword: constKeyword, diff --git a/pkg/analyzer/test/src/dart/parser/extension_type_test.dart b/pkg/analyzer/test/src/dart/parser/extension_type_test.dart index c4e2b2211d1e..44a25386af80 100644 --- a/pkg/analyzer/test/src/dart/parser/extension_type_test.dart +++ b/pkg/analyzer/test/src/dart/parser/extension_type_test.dart @@ -15,6 +15,32 @@ main() { @reflectiveTest class ExtensionTypeDeclarationParserTest extends ParserDiagnosticsTest { + test_augment() { + final parseResult = parseStringWithErrors(r''' +library augment 'a.dart'; + +augment extension type A(int it) {} +'''); + parseResult.assertNoErrors(); + + final node = parseResult.findNode.singleExtensionTypeDeclaration; + assertParsedNodeText(node, r''' +ExtensionTypeDeclaration + augmentKeyword: augment + extensionKeyword: extension + typeKeyword: type + name: A + representation: RepresentationDeclaration + leftParenthesis: ( + fieldType: NamedType + name: int + fieldName: it + rightParenthesis: ) + leftBracket: { + rightBracket: } +'''); + } + test_error_fieldModifier_const() { final parseResult = parseStringWithErrors(r''' extension type A(const int it) {} diff --git a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart index 93201fde4fe6..76479074df5d 100644 --- a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart +++ b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart @@ -2358,7 +2358,8 @@ class _MacroListener implements Listener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { + void beginExtensionTypeDeclaration( + Token? augmentToken, Token extensionKeyword, Token name) { _unsupported(); } @@ -2369,8 +2370,8 @@ class _MacroListener implements Listener { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token? typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token? typeKeyword, Token endToken) { _unsupported(); } diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart index 8a0594866e6a..5bfecb32e4f7 100644 --- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart +++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart @@ -1019,7 +1019,8 @@ class DietListener extends StackListenerImpl { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token nameToken) { + void beginExtensionTypeDeclaration( + Token? augmentToken, Token extensionKeyword, Token nameToken) { debugEvent("beginExtensionTypeDeclaration"); push(new SimpleIdentifier(nameToken)); push(extensionKeyword); @@ -1081,8 +1082,8 @@ class DietListener extends StackListenerImpl { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { debugEvent("endExtensionTypeDeclaration"); checkEmpty(extensionKeyword.charOffset); } diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart index 14c1bbabeb3d..91b929002daf 100644 --- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart +++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart @@ -1555,7 +1555,8 @@ class OutlineBuilder extends StackListenerImpl { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token nameToken) { + void beginExtensionTypeDeclaration( + Token? augmentToken, Token extensionKeyword, Token nameToken) { assert(checkState(extensionKeyword, [ValueKinds.NominalVariableListOrNull, ValueKinds.MetadataListOrNull])); debugEvent("beginExtensionTypeDeclaration"); @@ -1575,8 +1576,8 @@ class OutlineBuilder extends StackListenerImpl { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { assert(checkState(extensionKeyword, [ ValueKinds.TypeBuilderListOrNull, ValueKinds.NominalVariableListOrNull, diff --git a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart index 084bcc860ba9..bf00f7f5b701 100644 --- a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart +++ b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart @@ -316,20 +316,23 @@ abstract class AbstractParserAstListener implements Listener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { + void beginExtensionTypeDeclaration( + Token? augmentKeyword, Token extensionKeyword, Token name) { ExtensionTypeDeclarationBegin data = new ExtensionTypeDeclarationBegin( ParserAstType.BEGIN, + augmentKeyword: augmentKeyword, extensionKeyword: extensionKeyword, name: name); seen(data); } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { ExtensionTypeDeclarationEnd data = new ExtensionTypeDeclarationEnd( ParserAstType.END, beginToken: beginToken, + augmentToken: augmentToken, extensionKeyword: extensionKeyword, typeKeyword: typeKeyword, endToken: endToken); @@ -3610,15 +3613,17 @@ class ExtensionDeclarationEnd extends ParserAstNode { } class ExtensionTypeDeclarationBegin extends ParserAstNode { + final Token? augmentKeyword; final Token extensionKeyword; final Token name; ExtensionTypeDeclarationBegin(ParserAstType type, - {required this.extensionKeyword, required this.name}) + {this.augmentKeyword, required this.extensionKeyword, required this.name}) : super("ExtensionTypeDeclaration", type); @override Map get deprecatedArguments => { + "augmentKeyword": augmentKeyword, "extensionKeyword": extensionKeyword, "name": name, }; @@ -3626,12 +3631,14 @@ class ExtensionTypeDeclarationBegin extends ParserAstNode { class ExtensionTypeDeclarationEnd extends ParserAstNode { final Token beginToken; + final Token? augmentToken; final Token extensionKeyword; final Token typeKeyword; final Token endToken; ExtensionTypeDeclarationEnd(ParserAstType type, {required this.beginToken, + this.augmentToken, required this.extensionKeyword, required this.typeKeyword, required this.endToken}) @@ -3640,6 +3647,7 @@ class ExtensionTypeDeclarationEnd extends ParserAstNode { @override Map get deprecatedArguments => { "beginToken": beginToken, + "augmentToken": augmentToken, "extensionKeyword": extensionKeyword, "typeKeyword": typeKeyword, "endToken": endToken, diff --git a/pkg/front_end/lib/src/fasta/util/textual_outline.dart b/pkg/front_end/lib/src/fasta/util/textual_outline.dart index dfe7884383ca..f05536509c2b 100644 --- a/pkg/front_end/lib/src/fasta/util/textual_outline.dart +++ b/pkg/front_end/lib/src/fasta/util/textual_outline.dart @@ -816,8 +816,8 @@ class TextualOutlineListener extends Listener { } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { classStartToChunk[beginToken] = new _ExtensionTypeDeclarationChunk(beginToken, endToken); } diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.expect index 502d19e657f0..f5e37420ef34 100644 --- a/pkg/front_end/parser_testcases/extension_named_type.dart.expect +++ b/pkg/front_end/parser_testcases/extension_named_type.dart.expect @@ -28,7 +28,7 @@ beginCompilationUnit(class) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(A) - beginExtensionTypeDeclaration(extension, on) + beginExtensionTypeDeclaration(null, extension, on) handleRecoverableError(MissingPrimaryConstructor, on, on) handleNoPrimaryConstructor(on, null) handleImplements(null, 0) @@ -55,7 +55,7 @@ beginCompilationUnit(class) endExtensionTypeMethod(null, method, (, null, }) endMember() endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 1, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(test) beginMetadataStar(test) endMetadataStar(0) diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect index 29289023042c..36ac1d2171f2 100644 --- a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect @@ -36,9 +36,9 @@ parseUnit(class) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(A) - listener: beginExtensionTypeDeclaration(extension, on) + listener: beginExtensionTypeDeclaration(null, extension, on) reportRecoverableError(on, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, on, on) listener: handleNoPrimaryConstructor(on, null) @@ -95,7 +95,7 @@ parseUnit(class) listener: endMember() notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 1, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(test) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) diff --git a/pkg/front_end/parser_testcases/extension_type.dart.expect b/pkg/front_end/parser_testcases/extension_type.dart.expect index 6438fca5590b..d667af9ea232 100644 --- a/pkg/front_end/parser_testcases/extension_type.dart.expect +++ b/pkg/front_end/parser_testcases/extension_type.dart.expect @@ -32,7 +32,7 @@ beginCompilationUnit(class) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(on) - beginExtensionTypeDeclaration(extension, E) + beginExtensionTypeDeclaration(null, extension, E) handleRecoverableError(MissingPrimaryConstructor, E, E) handleNoPrimaryConstructor(E, null) handleImplements(null, 0) @@ -47,6 +47,6 @@ beginCompilationUnit(class) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(2, ) diff --git a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect index 385f0e93ace3..32d8728e4699 100644 --- a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect @@ -36,9 +36,9 @@ parseUnit(class) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(on) - listener: beginExtensionTypeDeclaration(extension, E) + listener: beginExtensionTypeDeclaration(null, extension, E) reportRecoverableError(E, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, E, E) listener: handleNoPrimaryConstructor(E, null) @@ -67,7 +67,7 @@ parseUnit(class) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(class) listener: endCompilationUnit(2, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect index 728520eb8deb..8b0058bb7e6c 100644 --- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect @@ -153,7 +153,7 @@ beginCompilationUnit(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET1) + beginExtensionTypeDeclaration(null, extension, ET1) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -178,13 +178,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET2) + beginExtensionTypeDeclaration(null, extension, ET2) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -212,13 +212,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET3) + beginExtensionTypeDeclaration(null, extension, ET3) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -249,13 +249,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET4) + beginExtensionTypeDeclaration(null, extension, ET4) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -286,13 +286,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET5) + beginExtensionTypeDeclaration(null, extension, ET5) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -326,13 +326,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET6) + beginExtensionTypeDeclaration(null, extension, ET6) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -360,13 +360,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET7) + beginExtensionTypeDeclaration(null, extension, ET7) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -397,13 +397,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET8) + beginExtensionTypeDeclaration(null, extension, ET8) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -437,13 +437,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET9) + beginExtensionTypeDeclaration(null, extension, ET9) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -477,13 +477,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET10) + beginExtensionTypeDeclaration(null, extension, ET10) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -520,13 +520,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET11) + beginExtensionTypeDeclaration(null, extension, ET11) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -554,13 +554,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET12) + beginExtensionTypeDeclaration(null, extension, ET12) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -591,13 +591,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET13) + beginExtensionTypeDeclaration(null, extension, ET13) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -631,13 +631,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET14) + beginExtensionTypeDeclaration(null, extension, ET14) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -671,13 +671,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET15) + beginExtensionTypeDeclaration(null, extension, ET15) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -714,13 +714,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET16) + beginExtensionTypeDeclaration(null, extension, ET16) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -752,13 +752,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET17) + beginExtensionTypeDeclaration(null, extension, ET17) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -793,13 +793,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET18) + beginExtensionTypeDeclaration(null, extension, ET18) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -837,13 +837,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET19) + beginExtensionTypeDeclaration(null, extension, ET19) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -881,13 +881,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET20) + beginExtensionTypeDeclaration(null, extension, ET20) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -928,13 +928,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET21) + beginExtensionTypeDeclaration(null, extension, ET21) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -963,13 +963,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET22) + beginExtensionTypeDeclaration(null, extension, ET22) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -1002,13 +1002,13 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET23) + beginExtensionTypeDeclaration(null, extension, ET23) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -1036,6 +1036,6 @@ beginCompilationUnit(extension) handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(23, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect index e313a48260e9..12eb38dea076 100644 --- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect @@ -9,9 +9,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET1) + listener: beginExtensionTypeDeclaration(null, extension, ET1) listener: beginPrimaryConstructor(() parseFormalParameters(ET1, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -54,7 +54,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -63,9 +63,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET2) + listener: beginExtensionTypeDeclaration(null, extension, ET2) listener: beginPrimaryConstructor(() parseFormalParameters(ET2, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -111,7 +111,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -120,9 +120,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET3) + listener: beginExtensionTypeDeclaration(null, extension, ET3) listener: beginPrimaryConstructor(() parseFormalParameters(ET3, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -171,7 +171,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -180,9 +180,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET4) + listener: beginExtensionTypeDeclaration(null, extension, ET4) listener: beginPrimaryConstructor(() parseFormalParameters(ET4, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -233,7 +233,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -242,9 +242,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET5) + listener: beginExtensionTypeDeclaration(null, extension, ET5) listener: beginPrimaryConstructor(() parseFormalParameters(ET5, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -298,7 +298,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -307,9 +307,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET6) + listener: beginExtensionTypeDeclaration(null, extension, ET6) listener: beginPrimaryConstructor(() parseFormalParameters(ET6, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -355,7 +355,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -364,9 +364,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET7) + listener: beginExtensionTypeDeclaration(null, extension, ET7) listener: beginPrimaryConstructor(() parseFormalParameters(ET7, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -415,7 +415,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -424,9 +424,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET8) + listener: beginExtensionTypeDeclaration(null, extension, ET8) listener: beginPrimaryConstructor(() parseFormalParameters(ET8, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -478,7 +478,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -487,9 +487,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET9) + listener: beginExtensionTypeDeclaration(null, extension, ET9) listener: beginPrimaryConstructor(() parseFormalParameters(ET9, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -543,7 +543,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -552,9 +552,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET10) + listener: beginExtensionTypeDeclaration(null, extension, ET10) listener: beginPrimaryConstructor(() parseFormalParameters(ET10, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -611,7 +611,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -620,9 +620,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET11) + listener: beginExtensionTypeDeclaration(null, extension, ET11) listener: beginPrimaryConstructor(() parseFormalParameters(ET11, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -668,7 +668,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -677,9 +677,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET12) + listener: beginExtensionTypeDeclaration(null, extension, ET12) listener: beginPrimaryConstructor(() parseFormalParameters(ET12, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -728,7 +728,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -737,9 +737,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET13) + listener: beginExtensionTypeDeclaration(null, extension, ET13) listener: beginPrimaryConstructor(() parseFormalParameters(ET13, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -791,7 +791,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -800,9 +800,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET14) + listener: beginExtensionTypeDeclaration(null, extension, ET14) listener: beginPrimaryConstructor(() parseFormalParameters(ET14, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -856,7 +856,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -865,9 +865,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET15) + listener: beginExtensionTypeDeclaration(null, extension, ET15) listener: beginPrimaryConstructor(() parseFormalParameters(ET15, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -924,7 +924,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -933,9 +933,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET16) + listener: beginExtensionTypeDeclaration(null, extension, ET16) listener: beginPrimaryConstructor(() parseFormalParameters(ET16, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -986,7 +986,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -995,9 +995,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET17) + listener: beginExtensionTypeDeclaration(null, extension, ET17) listener: beginPrimaryConstructor(() parseFormalParameters(ET17, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1051,7 +1051,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1060,9 +1060,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET18) + listener: beginExtensionTypeDeclaration(null, extension, ET18) listener: beginPrimaryConstructor(() parseFormalParameters(ET18, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1119,7 +1119,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1128,9 +1128,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET19) + listener: beginExtensionTypeDeclaration(null, extension, ET19) listener: beginPrimaryConstructor(() parseFormalParameters(ET19, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1189,7 +1189,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1198,9 +1198,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET20) + listener: beginExtensionTypeDeclaration(null, extension, ET20) listener: beginPrimaryConstructor(() parseFormalParameters(ET20, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1262,7 +1262,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1271,9 +1271,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET21) + listener: beginExtensionTypeDeclaration(null, extension, ET21) listener: beginPrimaryConstructor(() parseFormalParameters(ET21, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1319,7 +1319,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1328,9 +1328,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET22) + listener: beginExtensionTypeDeclaration(null, extension, ET22) listener: beginPrimaryConstructor(() parseFormalParameters(ET22, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1387,7 +1387,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -1396,9 +1396,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET23) + listener: beginExtensionTypeDeclaration(null, extension, ET23) listener: beginPrimaryConstructor(() parseFormalParameters(ET23, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -1444,7 +1444,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(23, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.expect index 39259bd34464..0cffd0f67ec5 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.expect @@ -9,7 +9,7 @@ beginCompilationUnit(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType1) + beginExtensionTypeDeclaration(null, extension, ExtensionType1) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -26,13 +26,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType2) + beginExtensionTypeDeclaration(null, extension, ExtensionType2) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -55,7 +55,7 @@ beginCompilationUnit(extension) handleImplements(implements, 2) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -71,7 +71,7 @@ beginCompilationUnit(extension) handleType(num, null) endTypeVariable(>, 0, extends, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ExtensionType3) + beginExtensionTypeDeclaration(null, extension, ExtensionType3) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(T) @@ -88,13 +88,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType4) + beginExtensionTypeDeclaration(null, extension, ExtensionType4) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -441,13 +441,13 @@ beginCompilationUnit(extension) endExtensionTypeMethod(null, static, (, null, ;) endMember() endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 14, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ExtensionType5) + beginExtensionTypeDeclaration(null, extension, ExtensionType5) beginPrimaryConstructor(.) handleNewAsIdentifier(new) handleIdentifier(new, primaryConstructorDeclaration) @@ -466,13 +466,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ExtensionType6) + beginExtensionTypeDeclaration(null, extension, ExtensionType6) beginPrimaryConstructor(.) handleIdentifier(id, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -490,7 +490,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -506,7 +506,7 @@ beginCompilationUnit(extension) handleType(num, null) endTypeVariable(>, 0, extends, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ExtensionType7) + beginExtensionTypeDeclaration(null, extension, ExtensionType7) beginPrimaryConstructor(.) handleIdentifier(id, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -524,6 +524,6 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(7, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect index db05f09572af..772863177163 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect @@ -9,9 +9,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType1) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType1) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType1, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -36,7 +36,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -45,9 +45,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType2) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType2) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType2, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -78,7 +78,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -87,7 +87,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) parseMetadataStar(<) listener: beginMetadataStar(T) @@ -101,7 +101,7 @@ parseUnit(extension) listener: handleType(num, null) listener: endTypeVariable(>, 0, extends, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ExtensionType3) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType3) listener: beginPrimaryConstructor(() parseFormalParameters(>, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -126,7 +126,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -135,9 +135,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType4) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType4) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType4, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -821,7 +821,7 @@ parseUnit(extension) listener: endMember() notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 14, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -830,9 +830,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ExtensionType5) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType5) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) rewriter() @@ -861,7 +861,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -870,9 +870,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ExtensionType6) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType6) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(id, primaryConstructorDeclaration) @@ -899,7 +899,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -908,7 +908,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) parseMetadataStar(<) listener: beginMetadataStar(T) @@ -922,7 +922,7 @@ parseUnit(extension) listener: handleType(num, null) listener: endTypeVariable(>, 0, extends, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ExtensionType7) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType7) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(id, primaryConstructorDeclaration) @@ -949,7 +949,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(7, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.expect index 3a96744121a4..bc84058e8f55 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.expect @@ -9,7 +9,7 @@ beginCompilationUnit(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType1) + beginExtensionTypeDeclaration(null, extension, ExtensionType1) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -26,13 +26,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType2) + beginExtensionTypeDeclaration(null, extension, ExtensionType2) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -55,7 +55,7 @@ beginCompilationUnit(extension) handleImplements(implements, 2) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -71,7 +71,7 @@ beginCompilationUnit(extension) handleType(num, null) endTypeVariable(>, 0, extends, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ExtensionType3) + beginExtensionTypeDeclaration(null, extension, ExtensionType3) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(T) @@ -88,13 +88,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ExtensionType4) + beginExtensionTypeDeclaration(null, extension, ExtensionType4) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -441,13 +441,13 @@ beginCompilationUnit(extension) endExtensionTypeMethod(null, static, (, null, ;) endMember() endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 14, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ExtensionType5) + beginExtensionTypeDeclaration(null, extension, ExtensionType5) beginPrimaryConstructor(.) handleNewAsIdentifier(new) handleIdentifier(new, primaryConstructorDeclaration) @@ -466,13 +466,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ExtensionType6) + beginExtensionTypeDeclaration(null, extension, ExtensionType6) beginPrimaryConstructor(.) handleIdentifier(id, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -490,7 +490,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -506,7 +506,7 @@ beginCompilationUnit(extension) handleType(num, null) endTypeVariable(>, 0, extends, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ExtensionType7) + beginExtensionTypeDeclaration(null, extension, ExtensionType7) beginPrimaryConstructor(.) handleIdentifier(id, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -524,6 +524,6 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(7, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect index e9efab189ed8..07bf68eab352 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect @@ -9,9 +9,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType1) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType1) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType1, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -36,7 +36,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -45,9 +45,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType2) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType2) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType2, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -78,7 +78,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -87,7 +87,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) parseMetadataStar(<) listener: beginMetadataStar(T) @@ -101,7 +101,7 @@ parseUnit(extension) listener: handleType(num, null) listener: endTypeVariable(>, 0, extends, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ExtensionType3) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType3) listener: beginPrimaryConstructor(() parseFormalParameters(>, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -126,7 +126,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -135,9 +135,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ExtensionType4) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType4) listener: beginPrimaryConstructor(() parseFormalParameters(ExtensionType4, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -825,7 +825,7 @@ parseUnit(extension) listener: endMember() notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 14, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -834,9 +834,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ExtensionType5) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType5) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) rewriter() @@ -865,7 +865,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -874,9 +874,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ExtensionType6) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType6) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(id, primaryConstructorDeclaration) @@ -903,7 +903,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -912,7 +912,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) parseMetadataStar(<) listener: beginMetadataStar(T) @@ -926,7 +926,7 @@ parseUnit(extension) listener: handleType(num, null) listener: endTypeVariable(>, 0, extends, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ExtensionType7) + listener: beginExtensionTypeDeclaration(null, extension, ExtensionType7) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(id, primaryConstructorDeclaration) @@ -953,7 +953,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(7, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect index 59488caaf436..c90a93b75119 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect @@ -38,7 +38,7 @@ beginCompilationUnit(extension) beginExtensionDeclarationPrelude(extension) handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, () handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -55,14 +55,14 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, () handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -79,14 +79,14 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -104,14 +104,14 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .) handleNoTypeVariables(.) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -129,7 +129,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -144,7 +144,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -161,7 +161,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -176,7 +176,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -193,7 +193,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -208,7 +208,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -226,7 +226,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -241,7 +241,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ) + beginExtensionTypeDeclaration(null, extension, ) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) beginFormalParameters((, MemberKind.PrimaryConstructor) @@ -259,6 +259,6 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(8, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect index 2263603249c4..95f9be265359 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect @@ -9,13 +9,13 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], messageOnToken: null) reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, () rewriter() listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(() parseFormalParameters(, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -40,7 +40,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -49,13 +49,13 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], messageOnToken: null) reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, () rewriter() listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(() parseFormalParameters(, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -80,7 +80,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -89,13 +89,13 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], messageOnToken: null) reportRecoverableError(., Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .) rewriter() listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -122,7 +122,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -131,13 +131,13 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], messageOnToken: null) reportRecoverableError(., Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .) rewriter() listener: handleNoTypeVariables(.) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -164,7 +164,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -173,7 +173,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null) reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) @@ -187,7 +187,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(() parseFormalParameters(>, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -212,7 +212,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -221,7 +221,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null) reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) @@ -235,7 +235,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(() parseFormalParameters(>, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -260,7 +260,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -269,7 +269,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null) reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) @@ -283,7 +283,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -310,7 +310,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -319,7 +319,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null) reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}]) listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <) @@ -333,7 +333,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ) + listener: beginExtensionTypeDeclaration(null, extension, ) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -360,7 +360,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(8, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect index ddfaf0ba7626..45a3e0f23479 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect @@ -3,7 +3,7 @@ beginCompilationUnit(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, on) + beginExtensionTypeDeclaration(null, extension, on) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -20,13 +20,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, on) + beginExtensionTypeDeclaration(null, extension, on) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -43,13 +43,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, on) + beginExtensionTypeDeclaration(null, extension, on) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -75,13 +75,13 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, on) + beginExtensionTypeDeclaration(null, extension, on) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(i) @@ -103,6 +103,6 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(4, ) diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect index f99d3b7ecc4a..f633c1c74d50 100644 --- a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect @@ -9,9 +9,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, on) + listener: beginExtensionTypeDeclaration(null, extension, on) listener: beginPrimaryConstructor(() parseFormalParameters(on, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -36,7 +36,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -45,9 +45,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, on) + listener: beginExtensionTypeDeclaration(null, extension, on) listener: beginPrimaryConstructor(() parseFormalParameters(on, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -72,7 +72,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -81,9 +81,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, on) + listener: beginExtensionTypeDeclaration(null, extension, on) listener: beginPrimaryConstructor(() parseFormalParameters(on, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -120,7 +120,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -129,9 +129,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, on) + listener: beginExtensionTypeDeclaration(null, extension, on) listener: beginPrimaryConstructor(() parseFormalParameters(on, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -164,7 +164,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(4, ) diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect index 9be3769ef652..5c1baa8c6ea2 100644 --- a/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect @@ -122,7 +122,7 @@ beginCompilationUnit(class) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET1) + beginExtensionTypeDeclaration(null, extension, ET1) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -145,7 +145,7 @@ beginCompilationUnit(class) handleRecoverableError(ExpectedExtensionTypeBody, ), )) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(;) beginMetadataStar(;) endMetadataStar(0) @@ -157,7 +157,7 @@ beginCompilationUnit(class) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET2) + beginExtensionTypeDeclaration(null, extension, ET2) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -183,7 +183,7 @@ beginCompilationUnit(class) handleRecoverableError(ExpectedExtensionTypeBody, Foo, Foo) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(;) beginMetadataStar(;) endMetadataStar(0) @@ -195,7 +195,7 @@ beginCompilationUnit(class) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(() - beginExtensionTypeDeclaration(extension, ET3) + beginExtensionTypeDeclaration(null, extension, ET3) beginPrimaryConstructor(() beginFormalParameters((, MemberKind.PrimaryConstructor) beginMetadataStar(int) @@ -224,7 +224,7 @@ beginCompilationUnit(class) handleRecoverableError(ExpectedExtensionTypeBody, Bar, Bar) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(;) beginMetadataStar(;) endMetadataStar(0) diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect index 4a7e83bf0014..35cbbdcab662 100644 --- a/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect @@ -151,9 +151,9 @@ parseUnit(class) parseTopLevelKeywordDeclaration(extension, ;, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET1) + listener: beginExtensionTypeDeclaration(null, extension, ET1) listener: beginPrimaryConstructor(() parseFormalParameters(ET1, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -196,7 +196,7 @@ parseUnit(class) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(;) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -215,9 +215,9 @@ parseUnit(class) parseTopLevelKeywordDeclaration(extension, ;, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET2) + listener: beginExtensionTypeDeclaration(null, extension, ET2) listener: beginPrimaryConstructor(() parseFormalParameters(ET2, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -263,7 +263,7 @@ parseUnit(class) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(;) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -282,9 +282,9 @@ parseUnit(class) parseTopLevelKeywordDeclaration(extension, ;, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(() - listener: beginExtensionTypeDeclaration(extension, ET3) + listener: beginExtensionTypeDeclaration(null, extension, ET3) listener: beginPrimaryConstructor(() parseFormalParameters(ET3, MemberKind.PrimaryConstructor) parseFormalParametersRest((, MemberKind.PrimaryConstructor) @@ -333,7 +333,7 @@ parseUnit(class) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(;) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect index 56525152154a..14d5d011e870 100644 --- a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect +++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect @@ -41,19 +41,19 @@ beginCompilationUnit(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables({) - beginExtensionTypeDeclaration(extension, ET1) + beginExtensionTypeDeclaration(null, extension, ET1) handleRecoverableError(MissingPrimaryConstructor, ET1, ET1) handleNoPrimaryConstructor(ET1, null) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(implements) - beginExtensionTypeDeclaration(extension, ET2) + beginExtensionTypeDeclaration(null, extension, ET2) handleRecoverableError(MissingPrimaryConstructor, ET2, ET2) handleNoPrimaryConstructor(ET2, null) handleIdentifier(Foo, typeReference) @@ -62,13 +62,13 @@ beginCompilationUnit(extension) handleImplements(implements, 1) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) beginExtensionDeclarationPrelude(extension) handleNoTypeVariables(implements) - beginExtensionTypeDeclaration(extension, ET3) + beginExtensionTypeDeclaration(null, extension, ET3) handleRecoverableError(MissingPrimaryConstructor, ET3, ET3) handleNoPrimaryConstructor(ET3, null) handleIdentifier(Foo, typeReference) @@ -80,7 +80,7 @@ beginCompilationUnit(extension) handleImplements(implements, 2) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -94,13 +94,13 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET4) + beginExtensionTypeDeclaration(null, extension, ET4) handleRecoverableError(MissingPrimaryConstructor, >, >) handleNoPrimaryConstructor(>, null) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -114,7 +114,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET5) + beginExtensionTypeDeclaration(null, extension, ET5) handleRecoverableError(MissingPrimaryConstructor, >, >) handleNoPrimaryConstructor(>, null) handleIdentifier(Foo, typeReference) @@ -123,7 +123,7 @@ beginCompilationUnit(extension) handleImplements(implements, 1) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -137,7 +137,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET6) + beginExtensionTypeDeclaration(null, extension, ET6) handleRecoverableError(MissingPrimaryConstructor, >, >) handleNoPrimaryConstructor(>, null) handleIdentifier(Foo, typeReference) @@ -149,7 +149,7 @@ beginCompilationUnit(extension) handleImplements(implements, 2) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -163,7 +163,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET7) + beginExtensionTypeDeclaration(null, extension, ET7) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) handleRecoverableError(MissingPrimaryConstructorParameters, name, name) @@ -172,7 +172,7 @@ beginCompilationUnit(extension) handleImplements(null, 0) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -186,7 +186,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET8) + beginExtensionTypeDeclaration(null, extension, ET8) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) handleRecoverableError(MissingPrimaryConstructorParameters, name, name) @@ -198,7 +198,7 @@ beginCompilationUnit(extension) handleImplements(implements, 1) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration(extension) beginMetadataStar(extension) endMetadataStar(0) @@ -212,7 +212,7 @@ beginCompilationUnit(extension) handleNoType(T) endTypeVariable(>, 0, null, null) endTypeVariables(<, >) - beginExtensionTypeDeclaration(extension, ET9) + beginExtensionTypeDeclaration(null, extension, ET9) beginPrimaryConstructor(.) handleIdentifier(name, primaryConstructorDeclaration) handleRecoverableError(MissingPrimaryConstructorParameters, name, name) @@ -227,6 +227,6 @@ beginCompilationUnit(extension) handleImplements(implements, 2) beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - endExtensionTypeDeclaration(extension, extension, type, }) + endExtensionTypeDeclaration(extension, null, extension, type, }) endTopLevelDeclaration() endCompilationUnit(9, ) diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect index 0b8e44d5477a..5e20274aa26c 100644 --- a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect +++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect @@ -9,9 +9,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, , extension, null, null, null, null, DirectiveContext(DirectiveState.Unknown)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables({) - listener: beginExtensionTypeDeclaration(extension, ET1) + listener: beginExtensionTypeDeclaration(null, extension, ET1) reportRecoverableError(ET1, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, ET1, ET1) listener: handleNoPrimaryConstructor(ET1, null) @@ -21,7 +21,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -30,9 +30,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(implements) - listener: beginExtensionTypeDeclaration(extension, ET2) + listener: beginExtensionTypeDeclaration(null, extension, ET2) reportRecoverableError(ET2, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, ET2, ET2) listener: handleNoPrimaryConstructor(ET2, null) @@ -45,7 +45,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -54,9 +54,9 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: handleNoTypeVariables(implements) - listener: beginExtensionTypeDeclaration(extension, ET3) + listener: beginExtensionTypeDeclaration(null, extension, ET3) reportRecoverableError(ET3, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, ET3, ET3) listener: handleNoPrimaryConstructor(ET3, null) @@ -72,7 +72,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -81,7 +81,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -91,7 +91,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET4) + listener: beginExtensionTypeDeclaration(null, extension, ET4) reportRecoverableError(>, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, >, >) listener: handleNoPrimaryConstructor(>, null) @@ -101,7 +101,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -110,7 +110,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -120,7 +120,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET5) + listener: beginExtensionTypeDeclaration(null, extension, ET5) reportRecoverableError(>, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, >, >) listener: handleNoPrimaryConstructor(>, null) @@ -133,7 +133,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -142,7 +142,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -152,7 +152,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET6) + listener: beginExtensionTypeDeclaration(null, extension, ET6) reportRecoverableError(>, MissingPrimaryConstructor) listener: handleRecoverableError(MissingPrimaryConstructor, >, >) listener: handleNoPrimaryConstructor(>, null) @@ -168,7 +168,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -177,7 +177,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -187,7 +187,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET7) + listener: beginExtensionTypeDeclaration(null, extension, ET7) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -201,7 +201,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -210,7 +210,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -220,7 +220,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET8) + listener: beginExtensionTypeDeclaration(null, extension, ET8) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -237,7 +237,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration(extension) parseTopLevelDeclarationImpl(}, DirectiveContext(DirectiveState.Declarations)) parseMetadataStar(}) @@ -246,7 +246,7 @@ parseUnit(extension) parseTopLevelKeywordDeclaration(extension, }, extension, null, null, null, null, DirectiveContext(DirectiveState.Declarations)) parseExtension(extension, null, extension) listener: beginExtensionDeclarationPrelude(extension) - parseExtensionTypeDeclaration(extension, type, extension, type) + parseExtensionTypeDeclaration(extension, type, null, extension, type) listener: beginTypeVariables(<) listener: beginMetadataStar(T) listener: endMetadataStar(0) @@ -256,7 +256,7 @@ parseUnit(extension) listener: handleNoType(T) listener: endTypeVariable(>, 0, null, null) listener: endTypeVariables(<, >) - listener: beginExtensionTypeDeclaration(extension, ET9) + listener: beginExtensionTypeDeclaration(null, extension, ET9) listener: beginPrimaryConstructor(.) ensureIdentifier(., primaryConstructorDeclaration) listener: handleIdentifier(name, primaryConstructorDeclaration) @@ -276,7 +276,7 @@ parseUnit(extension) listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {) notEofOrValue(}, }) listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, }) - listener: endExtensionTypeDeclaration(extension, extension, type, }) + listener: endExtensionTypeDeclaration(extension, null, extension, type, }) listener: endTopLevelDeclaration() reportAllErrorTokens(extension) listener: endCompilationUnit(9, ) diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart index 05ecfaf73bc0..ed15f00888da 100644 --- a/pkg/front_end/test/parser_test_listener.dart +++ b/pkg/front_end/test/parser_test_listener.dart @@ -365,23 +365,30 @@ class ParserTestListener implements Listener { } @override - void beginExtensionTypeDeclaration(Token extensionKeyword, Token name) { + void beginExtensionTypeDeclaration( + Token? augmentKeyword, Token extensionKeyword, Token name) { + seen(augmentKeyword); seen(extensionKeyword); seen(name); - doPrint('beginExtensionTypeDeclaration(' '$extensionKeyword, ' '$name)'); + doPrint('beginExtensionTypeDeclaration(' + '$augmentKeyword, ' + '$extensionKeyword, ' + '$name)'); indent++; } @override - void endExtensionTypeDeclaration(Token beginToken, Token extensionKeyword, - Token typeKeyword, Token endToken) { + void endExtensionTypeDeclaration(Token beginToken, Token? augmentToken, + Token extensionKeyword, Token typeKeyword, Token endToken) { indent--; seen(beginToken); + seen(augmentToken); seen(extensionKeyword); seen(typeKeyword); seen(endToken); doPrint('endExtensionTypeDeclaration(' '$beginToken, ' + '$augmentToken, ' '$extensionKeyword, ' '$typeKeyword, ' '$endToken)'); diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart index 5cc99d850ad5..30dff24fe9b9 100644 --- a/pkg/front_end/test/parser_test_parser.dart +++ b/pkg/front_end/test/parser_test_parser.dart @@ -890,15 +890,16 @@ class TestParser extends Parser { @override Token parseExtensionTypeDeclaration(Token beginToken, Token token, - Token extensionKeyword, Token typeKeyword) { + Token? augmentToken, Token extensionKeyword, Token typeKeyword) { doPrint('parseExtensionTypeDeclaration(' '$beginToken, ' '$token, ' + '$augmentToken, ' '$extensionKeyword, ' '$typeKeyword)'); indent++; var result = super.parseExtensionTypeDeclaration( - beginToken, token, extensionKeyword, typeKeyword); + beginToken, token, augmentToken, extensionKeyword, typeKeyword); indent--; return result; } From 4ea4eec023396c44838b098faf2b9f100de1d83d Mon Sep 17 00:00:00 2001 From: eliasyishak Date: Tue, 2 Apr 2024 19:32:22 +0000 Subject: [PATCH 03/12] Update DEPS R=jacobr@google.com Change-Id: I70dbe194f519d50f6a0cb244b1f80bd6c1fa9186 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360540 Commit-Queue: Elias Yishak Reviewed-by: Jacob Richman Reviewed-by: Ben Konyi --- DEPS | 2 +- pkg/dartdev/test/utils.dart | 9 ++------- pkg/dds/pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/DEPS b/DEPS index 4510f1dab9ab..b3fbfd0c3bb4 100644 --- a/DEPS +++ b/DEPS @@ -186,7 +186,7 @@ vars = { "test_descriptor_rev": "b61cfb4479fafd78eb9d365cc2f7cdb43c2aed34", "test_process_rev": "94ee46d76f89ebb7d73cef3e23bab288b1e43b50", "test_reflective_loader_rev": "d7167a2375d8a0c02c12b960c059a115a777f238", - "tools_rev": "f611290b530123ee2f0a3fda7c440d85dd080a30", # https://github.com/dart-lang/tools/pull/247 + "tools_rev": "d86ea23c79d2e9dc622d3376aa80d94fbf30bf60", "typed_data_rev": "8c7393cbbbba7a5d38c6772371f92d6b38e433fc", "usage_rev": "67ecd7d1328347ec15cbf8d8a46918df75a66af8", "vector_math_rev": "7e705f734e94917e9a5347578e6e496f8db38ac6", diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart index 7c292a8469d0..711f101f9fae 100644 --- a/pkg/dartdev/test/utils.dart +++ b/pkg/dartdev/test/utils.dart @@ -13,7 +13,6 @@ import 'package:file/memory.dart'; import 'package:path/path.dart' as path; import 'package:pub_semver/pub_semver.dart'; import 'package:test/test.dart'; -import 'package:unified_analytics/src/enums.dart'; import 'package:unified_analytics/unified_analytics.dart'; /// A long [Timeout] is provided for tests that start a process on @@ -250,23 +249,19 @@ class TestProject { FakeAnalytics _createFakeAnalytics() { final fs = MemoryFileSystem.test(style: FileSystemStyle.posix); final homeDirectory = fs.directory('/'); - final FakeAnalytics initialAnalytics = FakeAnalytics( + final FakeAnalytics initialAnalytics = Analytics.fake( tool: DashTool.dartTool, homeDirectory: homeDirectory, dartVersion: 'dartVersion', - platform: DevicePlatform.linux, fs: fs, - surveyHandler: SurveyHandler(homeDirectory: homeDirectory, fs: fs), ); initialAnalytics.clientShowedMessage(); - return FakeAnalytics( + return Analytics.fake( tool: DashTool.dartTool, homeDirectory: homeDirectory, dartVersion: 'dartVersion', - platform: DevicePlatform.linux, fs: fs, - surveyHandler: SurveyHandler(homeDirectory: homeDirectory, fs: fs), ); } diff --git a/pkg/dds/pubspec.yaml b/pkg/dds/pubspec.yaml index 01afa25a7234..3404a1facf39 100644 --- a/pkg/dds/pubspec.yaml +++ b/pkg/dds/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: stream_channel: ^2.0.0 vm_service: ^14.0.0 web_socket_channel: ^2.0.0 - unified_analytics: ^5.8.2 + unified_analytics: ^6.0.0 # We use 'any' version constraints here as we get our package versions from # the dart-lang/sdk repo's DEPS file. Note that this is a special case; the From f54eb08177f002ede1d105f6401c5a05cedbc5a7 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Tue, 2 Apr 2024 19:46:11 +0000 Subject: [PATCH 04/12] [dart2js] Update Dart2jsStage definitions and CLI surface area. Today to invoke Dart2js with sequential actions there are 2 ways to specify the stage from the command line. By specifying a `write-=` or by using `stage=`. Internally we use the former via a similar (but separate) concept to Dart2jsStage. The goal here is to consolidate all these different entry points. The new CLI works as follows: - To run the compiler in full you can: - Pass no additional flags as before - Specify 'stage=all' - 'dump-info-all' runs the full compilation from scratch but includes dump info. - To run the compiler in sequential mode you specify a stage: - Each stage has its own name passed to the '--stage' flag. - All the intermediate data URIs can be passed to every stage and only the relevant ones are used for any given stage. If no URI is passed then a default URI is used. - 'dump-info' is now its own stage. Partial dump info data is always included in the emit-js and codegen-emit-js steps. - 'cfe-only' flag is maintained for compatibility with Flutter CLI. Change-Id: I67965d7708688a85c866d8abef3716bee23a083f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358740 Reviewed-by: Sigmund Cherem Commit-Queue: Nate Biggs --- pkg/compiler/lib/src/commandline_options.dart | 15 +- pkg/compiler/lib/src/compiler.dart | 57 +- pkg/compiler/lib/src/dart2js.dart | 79 ++- .../lib/src/deferred_load/deferred_load.dart | 7 +- pkg/compiler/lib/src/dump_info.dart | 11 +- pkg/compiler/lib/src/options.dart | 458 +++++----------- pkg/compiler/lib/src/phase/load_kernel.dart | 2 +- pkg/compiler/lib/src/serialization/task.dart | 25 +- .../dump_info_new_regression_test.dart | 6 +- .../test/dump_info/dump_info_new_test.dart | 6 +- .../test/dump_info/dump_info_test.dart | 4 +- .../test/end_to_end/command_line_test.dart | 496 ++---------------- .../test/end_to_end/dump_info2_test.dart | 2 +- .../test/end_to_end/dump_info_test.dart | 54 +- .../test/end_to_end/output_type_test.dart | 2 +- .../serialization/on_disk_split_test.dart | 15 +- .../serialization_diff_helper.dart | 71 +-- .../serialization_test_helper.dart | 17 +- pkg/compiler/tool/modular_dart2js.dart | 26 +- .../tool/modular_test_suite_helper.dart | 38 +- 20 files changed, 410 insertions(+), 981 deletions(-) diff --git a/pkg/compiler/lib/src/commandline_options.dart b/pkg/compiler/lib/src/commandline_options.dart index d3be692a4a8e..0c2fe1746830 100644 --- a/pkg/compiler/lib/src/commandline_options.dart +++ b/pkg/compiler/lib/src/commandline_options.dart @@ -24,8 +24,7 @@ class Flags { static const String disableTypeInference = '--disable-type-inference'; static const String disableRtiOptimization = '--disable-rti-optimization'; static const String dumpInfo = '--dump-info'; - static const String readDumpInfoData = '--read-dump-info-data'; - static const String writeDumpInfoData = '--write-dump-info-data'; + static const String dumpInfoDataUri = '--dump-info-data'; static const String dumpDeferredGraph = '--dump-deferred-graph'; static const String deferredLoadIdMapUri = '--deferred-load-ids'; static const String dumpSsa = '--dump-ssa'; @@ -119,16 +118,10 @@ class Flags { static const String dillDependencies = '--dill-dependencies'; static const String sources = '--sources'; - static const String readData = '--read-data'; - static const String writeData = '--write-data'; + static const String globalInferenceUri = '--global-inference-data'; static const String memoryMappedFiles = '--memory-map-files'; - static const String noClosedWorldInData = '--no-closed-world-in-data'; - static const String writeClosedWorld = '--write-closed-world'; - static const String readClosedWorld = '--read-closed-world'; - static const String readCodegen = '--read-codegen'; - static const String writeCodegen = '--write-codegen'; - static const String readModularAnalysis = '--read-modular-analysis'; - static const String writeModularAnalysis = '--write-modular-analysis'; + static const String closedWorldUri = '--closed-world-data'; + static const String codegenUri = '--codegen-data'; static const String codegenShard = '--codegen-shard'; static const String codegenShards = '--codegen-shards'; static const String cfeOnly = '--cfe-only'; diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart index f965e81bfb9a..5cb98f18df82 100644 --- a/pkg/compiler/lib/src/compiler.dart +++ b/pkg/compiler/lib/src/compiler.dart @@ -56,7 +56,7 @@ import 'kernel/front_end_adapter.dart' show CompilerFileSystem; import 'kernel/kernel_strategy.dart'; import 'kernel/kernel_world.dart'; import 'null_compiler_output.dart' show NullCompilerOutput; -import 'options.dart' show CompilerOptions, Dart2JSStage; +import 'options.dart' show CompilerOptions, CompilerStage; import 'phase/load_kernel.dart' as load_kernel; import 'resolution/enqueuer.dart'; import 'serialization/serialization.dart'; @@ -136,7 +136,7 @@ class Compiler { _ResolutionStatus? _resolutionStatus; - Dart2JSStage get stage => options.stage; + CompilerStage get stage => options.stage; bool compilationFailed = false; @@ -407,12 +407,12 @@ class Compiler { if (retainDataForTesting) { componentForTesting = component; } - if (options.features.newDumpInfo.isEnabled && options.dumpInfo) { + if (options.features.newDumpInfo.isEnabled && stage.emitsDumpInfo) { untrimmedComponentForDumpInfo = component; } if (stage.shouldOnlyComputeDill) { Set includedLibraries = output.libraries!.toSet(); - if (stage.shouldLoadFromDill) { + if (options.shouldLoadFromDill) { if (options.dumpUnusedLibraries) { dumpUnusedLibraries(component, includedLibraries); } @@ -531,7 +531,7 @@ class Compiler { Uri rootLibraryUri = output.rootLibraryUri!; List libraries = output.libraries!; closedWorld = computeClosedWorld(component, rootLibraryUri, libraries); - if (stage == Dart2JSStage.closedWorld && closedWorld != null) { + if (stage.shouldWriteClosedWorld && closedWorld != null) { serializationTask.serializeClosedWorld(closedWorld, indices); if (options.producesModifiedDill) { serializationTask.serializeComponent(component, @@ -553,8 +553,8 @@ class Compiler { bool shouldStopAfterClosedWorld(JClosedWorld? closedWorld) => closedWorld == null || - stage == Dart2JSStage.closedWorld || - stage == Dart2JSStage.deferredLoadIds || + stage.shouldWriteClosedWorld || + stage.emitsDeferredLoadIds || stopAfterClosedWorldForTesting; Future produceGlobalTypeInferenceResults( @@ -564,7 +564,7 @@ class Compiler { GlobalTypeInferenceResults globalTypeInferenceResults; if (!stage.shouldReadGlobalInference) { globalTypeInferenceResults = performGlobalTypeInference(closedWorld); - if (stage == Dart2JSStage.globalInference) { + if (stage.shouldWriteGlobalInference) { serializationTask.serializeGlobalTypeInference( globalTypeInferenceResults, indices); } else if (options.testMode) { @@ -585,7 +585,7 @@ class Compiler { } bool get shouldStopAfterGlobalTypeInference => - stage == Dart2JSStage.globalInference || + stage.shouldWriteGlobalInference || stopAfterGlobalTypeInferenceForTesting; CodegenInputs initializeCodegen( @@ -602,34 +602,34 @@ class Compiler { SerializationIndices indices) async { CodegenInputs codegenInputs = initializeCodegen(globalTypeInferenceResults); CodegenResults codegenResults; - if (!stage.shouldReadCodegenShards) { + if (stage.shouldReadCodegenShards && options.codegenShards != null) { + codegenResults = await serializationTask.deserializeCodegen( + backendStrategy, + globalTypeInferenceResults.closedWorld, + codegenInputs, + useDeferredSourceReads, + sourceLookup, + indices); + } else { codegenResults = OnDemandCodegenResults( codegenInputs, backendStrategy.functionCompiler); - if (stage == Dart2JSStage.codegenSharded) { + if (stage.shouldWriteCodegen) { serializationTask.serializeCodegen( backendStrategy, globalTypeInferenceResults.closedWorld.abstractValueDomain, codegenResults, indices); } - } else { - codegenResults = await serializationTask.deserializeCodegen( - backendStrategy, - globalTypeInferenceResults.closedWorld, - codegenInputs, - useDeferredSourceReads, - sourceLookup, - indices); } return codegenResults; } - bool get shouldStopAfterCodegen => stage == Dart2JSStage.codegenSharded; + bool get shouldStopAfterCodegen => stage.shouldWriteCodegen; // Only use deferred reads for the linker phase as most deferred entities will - // not be needed. In other stages we use most of this data so it's not worth + // not be needed. In other phases we use most of this data so it's not worth // deferring. - bool get useDeferredSourceReads => stage == Dart2JSStage.jsEmitter; + bool get useDeferredSourceReads => stage == CompilerStage.jsEmitter; Future runSequentialPhases() async { // Load kernel. @@ -656,13 +656,12 @@ class Compiler { AbstractValueDomain? abstractValueDomainForDumpInfo; OutputUnitData? outputUnitDataForDumpInfo; DataSinkWriter? sinkForDumpInfo; - if (options.dumpInfoReadUri != null || options.dumpInfo) { + if (stage.emitsDumpInfo) { globalTypeInferenceResultsForDumpInfo = globalTypeInferenceResults; abstractValueDomainForDumpInfo = closedWorld.abstractValueDomain; outputUnitDataForDumpInfo = closedWorld.outputUnitData; indicesForDumpInfo = indices; - } - if (options.dumpInfoWriteUri != null) { + } else if (stage.shouldWriteDumpInfoData) { sinkForDumpInfo = serializationTask.dataSinkWriterForDumpInfo( closedWorld.abstractValueDomain, indices); dumpInfoRegistry.registerDataSinkWriter(sinkForDumpInfo); @@ -675,7 +674,7 @@ class Compiler { if (shouldStopAfterCodegen) return; final inferredData = globalTypeInferenceResults.inferredData; - if (options.dumpInfoReadUri != null) { + if (stage.shouldReadDumpInfoData) { final dumpInfoData = await serializationTask.deserializeDumpInfoProgramData( backendStrategy, @@ -688,14 +687,14 @@ class Compiler { // Link. final programSize = runCodegenEnqueuer( codegenResults, inferredData, sourceLookup, closedWorld); - if (options.dumpInfo || options.dumpInfoWriteUri != null) { + if (stage.emitsDumpInfo || stage.shouldWriteDumpInfoData) { final dumpInfoData = DumpInfoProgramData.fromEmitterResults( backendStrategy.emitterTask, dumpInfoRegistry, codegenResults, programSize); dumpInfoRegistry.close(); - if (options.dumpInfoWriteUri != null) { + if (stage.shouldWriteDumpInfoData) { serializationTask.serializeDumpInfoProgramData(sinkForDumpInfo!, backendStrategy, dumpInfoData, dumpInfoRegistry); } else { @@ -738,7 +737,7 @@ class Compiler { KClosedWorld kClosedWorld = resolutionWorldBuilder.closeWorld(reporter); OutputUnitData result = deferredLoadTask.run(mainFunction, kClosedWorld); - if (options.stage == Dart2JSStage.deferredLoadIds) return null; + if (stage.emitsDeferredLoadIds) return null; // Impact data is no longer needed. if (!retainDataForTesting) { diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart index 9ecb184ca24f..6c254c23a503 100644 --- a/pkg/compiler/lib/src/dart2js.dart +++ b/pkg/compiler/lib/src/dart2js.dart @@ -16,7 +16,7 @@ import 'commandline_options.dart'; import 'common/ram_usage.dart'; import 'compiler.dart' as defaultCompiler show Compiler; import 'io/mapped_file.dart'; -import 'options.dart' show CompilerOptions, Dart2JSStage, FeatureOptions; +import 'options.dart' show CompilerOptions, CompilerStage, FeatureOptions; import 'source_file_provider.dart'; import 'util/command_line.dart'; import 'util/util.dart' show stackTraceFilePrefix; @@ -417,21 +417,14 @@ Future compile(List argv, _OneOption('--libraries-spec=.+', setLibrarySpecificationUri), _OneOption('${Flags.dillDependencies}=.+', setDillDependencies), _OneOption('${Flags.sources}=.+', ignoreOption), - _OneOption('${Flags.readModularAnalysis}=.+', ignoreOption), - _OneOption('${Flags.writeModularAnalysis}=.+', ignoreOption), - _OneOption('${Flags.readData}=.+', setDataUri(Flags.readData)), - _OneOption('${Flags.writeData}=.+', setDataUri(Flags.writeData)), _OneOption( - '${Flags.readClosedWorld}=.+', setDataUri(Flags.readClosedWorld)), - _OneOption( - '${Flags.writeClosedWorld}=.+', setDataUri(Flags.writeClosedWorld)), - _OneOption('${Flags.readCodegen}=.+', setDataUri(Flags.readCodegen)), - _OneOption('${Flags.writeCodegen}=.+', setDataUri(Flags.writeCodegen)), + '${Flags.globalInferenceUri}=.+', setDataUri(Flags.globalInferenceUri)), + _OneOption('${Flags.closedWorldUri}=.+', setDataUri(Flags.closedWorldUri)), + _OneOption('${Flags.codegenUri}=.+', setDataUri(Flags.codegenUri)), _OneOption('${Flags.codegenShard}=.+', passThrough), _OneOption('${Flags.codegenShards}=.+', passThrough), _OneOption(Flags.cfeOnly, passThrough), _OneOption(Flags.memoryMappedFiles, passThrough), - _OneOption(Flags.noClosedWorldInData, ignoreOption), _OneOption('${Flags.stage}=.+', passThrough), _OneOption(Flags.debugGlobalInference, passThrough), _ManyOptions('--output(?:=.+)?|--out(?:=.+)?|-o.*', setOutput), @@ -489,9 +482,7 @@ Future compile(List argv, _OneOption('${Flags.readProgramSplit}=.+', passThrough), _OneOption('${Flags.dumpInfo}|${Flags.dumpInfo}=.+', setDumpInfo), _OneOption( - '${Flags.readDumpInfoData}=.+', setDataUri(Flags.readDumpInfoData)), - _OneOption( - '${Flags.writeDumpInfoData}=.+', setDataUri(Flags.writeDumpInfoData)), + '${Flags.dumpInfoDataUri}=.+', setDataUri(Flags.dumpInfoDataUri)), _OneOption('--disallow-unsafe-eval', ignoreOption), _OneOption(Option.showPackageWarnings, passThrough), _OneOption(Option.enableLanguageExperiments, passThrough), @@ -748,59 +739,59 @@ Future compile(List argv, String? summary; switch (compilerOptions.stage) { - case Dart2JSStage.all: - case Dart2JSStage.cfe: - case Dart2JSStage.allFromDill: - case Dart2JSStage.cfeFromDill: + case CompilerStage.all: + case CompilerStage.cfe: + case CompilerStage.dumpInfoAll: final sourceCharCount = _formatCharacterCount(inputProvider.sourceBytesFromDill); inputName = 'input bytes ($sourceCharCount characters source)'; inputSize = inputProvider.bytesRead; summary = 'Dart file $input '; break; - case Dart2JSStage.closedWorld: - case Dart2JSStage.deferredLoadIds: + case CompilerStage.closedWorld: + case CompilerStage.deferredLoadIds: inputName = 'input bytes'; inputSize = inputProvider.bytesRead; summary = 'Dart file $input '; break; - case Dart2JSStage.globalInference: + case CompilerStage.globalInference: inputName = 'bytes data'; inputSize = inputProvider.bytesRead; String dataInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.closedWorld), + compilerOptions.dataUriForStage(CompilerStage.closedWorld), Platform.isWindows); summary = 'Data files $input and $dataInput '; break; - case Dart2JSStage.codegenSharded: - case Dart2JSStage.codegenAndJsEmitter: + case CompilerStage.codegenSharded: + case CompilerStage.codegenAndJsEmitter: + case CompilerStage.dumpInfo: inputName = 'bytes data'; inputSize = inputProvider.bytesRead; String worldInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.closedWorld), + compilerOptions.dataUriForStage(CompilerStage.closedWorld), Platform.isWindows); String dataInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.globalInference), + compilerOptions.dataUriForStage(CompilerStage.globalInference), Platform.isWindows); summary = 'Data files $input, $worldInput, and $dataInput '; break; - case Dart2JSStage.jsEmitter: + case CompilerStage.jsEmitter: inputName = 'bytes data'; inputSize = inputProvider.bytesRead; String worldInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.closedWorld), + compilerOptions.dataUriForStage(CompilerStage.closedWorld), Platform.isWindows); String dataInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.globalInference), + compilerOptions.dataUriForStage(CompilerStage.globalInference), Platform.isWindows); String codeInput = fe.relativizeUri( Uri.base, - compilerOptions.dataInputUriForStage(Dart2JSStage.codegenSharded), + compilerOptions.dataUriForStage(CompilerStage.codegenSharded), Platform.isWindows); summary = 'Data files $input, $worldInput, $dataInput and ' '${codeInput}[0-${compilerOptions.codegenShards! - 1}] '; @@ -808,10 +799,11 @@ Future compile(List argv, } switch (compilerOptions.stage) { - case Dart2JSStage.all: - case Dart2JSStage.allFromDill: - case Dart2JSStage.jsEmitter: - case Dart2JSStage.codegenAndJsEmitter: + case CompilerStage.all: + case CompilerStage.dumpInfoAll: + case CompilerStage.jsEmitter: + case CompilerStage.codegenAndJsEmitter: + case CompilerStage.dumpInfo: processName = 'Compiled'; outputName = 'characters JavaScript'; outputSize = outputProvider.totalCharactersWrittenJavaScript; @@ -820,22 +812,21 @@ Future compile(List argv, Uri.base, out ?? Uri.parse('out.js'), Platform.isWindows); summary += 'compiled to JavaScript: ${output}'; break; - case Dart2JSStage.cfe: - case Dart2JSStage.cfeFromDill: + case CompilerStage.cfe: processName = 'Compiled'; outputName = 'kernel bytes'; outputSize = outputProvider.totalDataWritten; String output = fe.relativizeUri(Uri.base, out!, Platform.isWindows); summary += 'compiled to dill: ${output}.'; break; - case Dart2JSStage.closedWorld: + case CompilerStage.closedWorld: processName = 'Serialized'; outputName = 'bytes data'; outputSize = outputProvider.totalDataWritten; final producesDill = compilerOptions.producesModifiedDill; String dataOutput = fe.relativizeUri( Uri.base, - compilerOptions.dataOutputUriForStage(compilerOptions.stage), + compilerOptions.dataUriForStage(compilerOptions.stage), Platform.isWindows); String summaryLine = dataOutput; if (producesDill) { @@ -844,33 +835,33 @@ Future compile(List argv, } summary += 'serialized to data: $summaryLine.'; break; - case Dart2JSStage.deferredLoadIds: + case CompilerStage.deferredLoadIds: processName = 'Serialized'; outputName = 'character map'; outputSize = outputProvider.totalCharactersWritten; String dataOutput = fe.relativizeUri( Uri.base, - compilerOptions.dataOutputUriForStage(compilerOptions.stage), + compilerOptions.dataUriForStage(compilerOptions.stage), Platform.isWindows); summary += 'mapped to: ${dataOutput}.'; break; - case Dart2JSStage.globalInference: + case CompilerStage.globalInference: processName = 'Serialized'; outputName = 'bytes data'; outputSize = outputProvider.totalDataWritten; String dataOutput = fe.relativizeUri( Uri.base, - compilerOptions.dataOutputUriForStage(compilerOptions.stage), + compilerOptions.dataUriForStage(compilerOptions.stage), Platform.isWindows); summary += 'serialized to data: ${dataOutput}.'; break; - case Dart2JSStage.codegenSharded: + case CompilerStage.codegenSharded: processName = 'Serialized'; outputName = 'bytes data'; outputSize = outputProvider.totalDataWritten; String codeOutput = fe.relativizeUri( Uri.base, - compilerOptions.dataOutputUriForStage(compilerOptions.stage), + compilerOptions.dataUriForStage(compilerOptions.stage), Platform.isWindows); summary += 'serialized to codegen data: ' '${codeOutput}${compilerOptions.codegenShard}.'; diff --git a/pkg/compiler/lib/src/deferred_load/deferred_load.dart b/pkg/compiler/lib/src/deferred_load/deferred_load.dart index 397087930a92..d6257a45558c 100644 --- a/pkg/compiler/lib/src/deferred_load/deferred_load.dart +++ b/pkg/compiler/lib/src/deferred_load/deferred_load.dart @@ -431,8 +431,7 @@ class DeferredLoadTask extends CompilerTask { return ''; } - bool get generateDeferredLoadIdMap => - compiler.options.stage == Dart2JSStage.deferredLoadIds; + bool get generateDeferredLoadIdMap => compiler.stage.emitsDeferredLoadIds; /// Performs the deferred loading algorithm. /// @@ -670,9 +669,7 @@ class DeferredLoadTask extends CompilerTask { (mapping['${import.uri}'] ??= {})[import.name!] = deferredName; }); compiler.outputProvider.createOutputSink( - compiler.options - .dataOutputUriForStage(Dart2JSStage.deferredLoadIds) - .path, + compiler.options.dataUriForStage(CompilerStage.deferredLoadIds).path, '', api.OutputType.deferredLoadIds) ..add(const JsonEncoder.withIndent(" ").convert(topLevel)) diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart index 05ba25c13e2e..d590d78ba4d4 100644 --- a/pkg/compiler/lib/src/dump_info.dart +++ b/pkg/compiler/lib/src/dump_info.dart @@ -71,7 +71,8 @@ class DumpInfoJsAstRegistry { int _impactCount = 0; DumpInfoJsAstRegistry(this.options) - : _disabled = !options.dumpInfo && options.dumpInfoWriteUri == null; + : _disabled = !options.stage.emitsDumpInfo && + !options.stage.shouldWriteDumpInfoData; bool get useBinaryFormat => options.useDumpInfoBinaryFormat; @@ -96,8 +97,8 @@ class DumpInfoJsAstRegistry { void registerImpact(MemberEntity member, CodegenImpact impact, {required bool isGenerated}) { if (_disabled) return; - if (isGenerated || options.dumpInfo) { - if (options.dumpInfoWriteUri != null) { + if (isGenerated || options.stage.emitsDumpInfo) { + if (options.stage.shouldWriteDumpInfoData) { // Serialize immediately so that we don't have to hold a reference to // every impact until the end of the phase. _dataSinkWriter!.writeMember(member); @@ -1472,10 +1473,6 @@ class DumpInfoTask extends CompilerTask implements InfoReporter { @override String get name => "Dump Info"; - /// Whether or not this dump info task is running using serialized dump info - /// data from an earlier dart2js invocation. - bool get useSerializedData => options.dumpInfoReadUri != null; - /// The size of the generated output. late DumpInfoProgramData _dumpInfoData; diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart index 220ea67e2843..ab6d3d8fb13a 100644 --- a/pkg/compiler/lib/src/options.dart +++ b/pkg/compiler/lib/src/options.dart @@ -20,108 +20,103 @@ enum FeatureStatus { canary, } -// TODO(fishythefish): Add an API to associate numbered phases with stages. -enum Dart2JSStage { - all(null, - fromDillFlag: Dart2JSStage.allFromDill, - emitsKernel: false, - emitsJs: true), - cfe('cfe', - fromDillFlag: Dart2JSStage.cfeFromDill, - emitsKernel: true, - emitsJs: false), - allFromDill(null, emitsKernel: false, emitsJs: true), - cfeFromDill('cfe', emitsKernel: true, emitsJs: false), +enum CompilerPhase { + cfe, + closedWorld, + globalInference, + codegen, + emitJs, + dumpInfo, +} + +enum CompilerStage { + all('all', phases: { + CompilerPhase.cfe, + CompilerPhase.closedWorld, + CompilerPhase.globalInference, + CompilerPhase.codegen, + CompilerPhase.emitJs + }), + dumpInfoAll('dump-info-all', phases: { + CompilerPhase.cfe, + CompilerPhase.closedWorld, + CompilerPhase.globalInference, + CompilerPhase.codegen, + CompilerPhase.emitJs, + CompilerPhase.dumpInfo, + }), + cfe('cfe', phases: {CompilerPhase.cfe}), deferredLoadIds('deferred-load-ids', dataOutputName: 'deferred_load_ids.data', - emitsKernel: false, - emitsJs: false), + phases: {CompilerPhase.closedWorld}), closedWorld('closed-world', - dataOutputName: 'world.data', emitsKernel: true, emitsJs: false), + dataOutputName: 'world.data', phases: {CompilerPhase.closedWorld}), globalInference('global-inference', - dataOutputName: 'global.data', emitsKernel: false, emitsJs: false), - codegenAndJsEmitter('codegen-emit-js', emitsKernel: false, emitsJs: true), - codegenSharded('codegen', - dataOutputName: 'codegen', emitsKernel: false, emitsJs: false), - jsEmitter('emit-js', emitsKernel: false, emitsJs: true); - - const Dart2JSStage(this._stageFlag, - {this.dataOutputName, - this.fromDillFlag, - required this.emitsKernel, - required this.emitsJs}); - - final Dart2JSStage? fromDillFlag; - final String? _stageFlag; + dataOutputName: 'global.data', phases: {CompilerPhase.globalInference}), + codegenAndJsEmitter('codegen-emit-js', phases: { + CompilerPhase.codegen, + CompilerPhase.emitJs, + }), + codegenSharded('codegen', dataOutputName: 'codegen', phases: { + CompilerPhase.codegen, + }), + jsEmitter('emit-js', phases: { + CompilerPhase.emitJs, + }), + dumpInfo('dump-info', dataOutputName: 'dump.data', phases: { + CompilerPhase.dumpInfo, + }); + + const CompilerStage(this._stageFlag, + {this.dataOutputName, required this.phases}); + + final Set phases; + final String _stageFlag; final String? dataOutputName; - final bool emitsKernel; - final bool emitsJs; - - bool get shouldOnlyComputeDill => - this == Dart2JSStage.cfe || this == Dart2JSStage.cfeFromDill; - bool get shouldReadPlatformBinaries => - this == Dart2JSStage.cfe || - this == Dart2JSStage.cfeFromDill || - this == Dart2JSStage.all || - this == Dart2JSStage.allFromDill; - bool get shouldLoadFromDill => this.index >= Dart2JSStage.allFromDill.index; + + bool get emitsJs => phases.contains(CompilerPhase.emitJs); + bool get shouldOnlyComputeDill => this == CompilerStage.cfe; + bool get canEmitDill => + this == CompilerStage.cfe || this == CompilerStage.closedWorld; + bool get shouldReadPlatformBinaries => phases.contains(CompilerPhase.cfe); + bool get emitsDumpInfo => phases.contains(CompilerPhase.dumpInfo); + bool get emitsDeferredLoadIds => this == CompilerStage.deferredLoadIds; /// Global kernel transformations should be run in phase 0b, i.e. after /// concatenating dills, but before serializing the output of phase 0. // TODO(fishythefish): Add AST metadata to ensure transformations aren't rerun // unnecessarily. - bool get shouldRunGlobalTransforms => - this.index <= Dart2JSStage.cfeFromDill.index; + bool get shouldRunGlobalTransforms => phases.contains(CompilerPhase.cfe); - bool get shouldReadClosedWorld => this.index > Dart2JSStage.closedWorld.index; + bool get shouldReadClosedWorld => index > CompilerStage.closedWorld.index; bool get shouldReadGlobalInference => - this.index > Dart2JSStage.globalInference.index; + index > CompilerStage.globalInference.index; bool get shouldReadCodegenShards => - this.index > Dart2JSStage.codegenSharded.index; + index > CompilerStage.codegenSharded.index; + bool get shouldReadDumpInfoData => this == CompilerStage.dumpInfo; + bool get shouldWriteDumpInfoData => + this == CompilerStage.jsEmitter || + this == CompilerStage.codegenAndJsEmitter; + bool get shouldWriteClosedWorld => this == CompilerStage.closedWorld; + bool get shouldWriteGlobalInference => this == CompilerStage.globalInference; + bool get shouldWriteCodegen => this == CompilerStage.codegenSharded; + + String get toFlag => _stageFlag; static String get validFlagValuesString { - return Dart2JSStage.values - .where((p) => p._stageFlag != null) - .map((p) => '`${p._stageFlag}`') - .join(', '); + return CompilerStage.values.map((p) => '`${p._stageFlag}`').join(', '); } - static Dart2JSStage fromFlag(CompilerOptions options) { - for (final stage in Dart2JSStage.values) { - if (options._stageFlag == stage._stageFlag) { - if (stage.fromDillFlag != null && options._fromDill) { - return stage.fromDillFlag!; - } + static CompilerStage fromFlag(String? stageFlag) { + if (stageFlag == null) return CompilerStage.all; + for (final stage in CompilerStage.values) { + if (stageFlag == stage._stageFlag) { return stage; } } - throw ArgumentError('Invalid stage: ${options._stageFlag}. ' + throw ArgumentError('Invalid stage: ${stageFlag}. ' 'Supported values are: $validFlagValuesString'); } - - static Dart2JSStage fromLegacyFlags(CompilerOptions options) { - if (options._cfeOnly) { - return options._fromDill ? Dart2JSStage.cfeFromDill : Dart2JSStage.cfe; - } - if (options._deferredLoadIdMapUri != null) { - return Dart2JSStage.deferredLoadIds; - } - if (options._writeClosedWorldUri != null) { - return Dart2JSStage.closedWorld; - } - if (options._writeDataUri != null) { - return Dart2JSStage.globalInference; - } - if (options._writeCodegenUri != null) { - return Dart2JSStage.codegenSharded; - } - if (options._readCodegenUri != null) { - return Dart2JSStage.jsEmitter; - } else if (options._readDataUri != null) { - return Dart2JSStage.codegenAndJsEmitter; - } - return options._fromDill ? Dart2JSStage.allFromDill : Dart2JSStage.all; - } } /// A [FeatureOption] is both a set of flags and an option. By default, creating @@ -285,7 +280,7 @@ class CompilerOptions implements DiagnosticOptions { Uri get _defaultInputDillUri => _outputDir.resolve('${_outputPrefix}out.dill'); - Uri? get inputDillUri { + Uri get inputDillUri { return _inputDillUri != null ? fe.nativeToUri(_inputDillUri.toString()) : _defaultInputDillUri; @@ -295,8 +290,8 @@ class CompilerOptions implements DiagnosticOptions { Uri get compilationTarget => _inputDillUri ?? entryUri ?? _defaultInputDillUri; - bool get _fromDill { - var targetPath = (_inputDillUri ?? entryUri)?.path; + bool get shouldLoadFromDill { + final targetPath = (_inputDillUri ?? entryUri)?.path; return targetPath == null || targetPath.endsWith('.dill'); } @@ -312,48 +307,21 @@ class CompilerOptions implements DiagnosticOptions { /// Uses a memory mapped view of files for I/O. bool memoryMappedFiles = false; - /// Location from which serialized inference data is read. - /// - /// If this is set, the [entryUri] is expected to be a .dill file and the - /// frontend work is skipped. - Uri? _readDataUri; - - /// Location to which inference data is serialized. - /// - /// If this is set, the compilation stops after type inference. - Uri? _writeDataUri; + /// Location from which serialized inference data is read/written. + Uri? _globalInferenceUri; - /// Serialize data without the closed world. - /// TODO(joshualitt) make this the default right after landing in Google3 and - /// clean up. - bool noClosedWorldInData = false; + /// Location from which the serialized closed world is read/written. + Uri? _closedWorldUri; - /// Location from which the serialized closed world is read. - /// - /// If this is set, the [entryUri] is expected to be a .dill file and the - /// frontend work is skipped. - Uri? _readClosedWorldUri; - - /// Location to which inference data is serialized. - /// - /// If this is set, the compilation stops after computing the closed world. - Uri? _writeClosedWorldUri; - - /// Location from which codegen data is read. - /// - /// If this is set, the compilation starts at codegen enqueueing. - Uri? _readCodegenUri; - - /// Location to which codegen data is serialized. - /// - /// If this is set, the compilation stops after code generation. - Uri? _writeCodegenUri; + /// Location from which codegen data is read/written. + Uri? _codegenUri; + // TODO(natebiggs): Delete this once Flutter is using the stage flag. /// Whether to run only the CFE and emit the generated kernel file in - /// [outputUri]. + /// [outputUri]. Equivalent to `--stage=cfe`. bool _cfeOnly = false; - /// Which stage of the compiler to run. Maps to a stage from [Dart2JSStage]. + /// Which stage of the compiler to run. Maps to a stage from [CompilerStage]. String? _stageFlag; /// Flag only meant for dart2js developers to iterate on global inference @@ -361,7 +329,7 @@ class CompilerOptions implements DiagnosticOptions { /// /// When working on large apps this flag allows to load serialized data for /// the app (via --read-data), reuse its closed world, and rerun the global - /// inference phase (even though the serialized data already contains a global + /// inference stage (even though the serialized data already contains a global /// inference result). bool debugGlobalInference = false; @@ -471,22 +439,12 @@ class CompilerOptions implements DiagnosticOptions { /// Whether to disable optimization for need runtime type information. bool disableRtiOptimization = false; - /// Whether to emit a summary of the information used by the compiler during - /// optimization. This includes resolution details, dependencies between - /// elements, results of type inference, and data about generated code. - bool dumpInfo = false; - - /// Whether to read dump info requisite data and run dump info task. Loads all - /// data necessary for the dump info task without having to re-generate output - /// JS. Passing this flag alone will run the dump info task in JSON mode. Pass - /// `--dump-info=binary` as well to emit the binary version of the info dump. - Uri? dumpInfoReadUri; - - /// Whether to write dump info requisite data after emitting JS. This contains - /// data captured from the JS printer and processed for the dump info task. - /// The file emitted to the URI can then be read in using [dumpInfoReadUri] - /// to run dump info as a standalone task (without re-emitting JS). - Uri? dumpInfoWriteUri; + /// Uri to read/write dump info requisite data after emitting JS. This + /// contains data captured from the JS printer and processed for the dump info + /// task. + /// The file emitted to the URI can then be read in using to run dump info as + /// a standalone task (without re-emitting JS). + Uri? _dumpInfoDataUri; /// Whether to use the new dump-info binary format. This will be the default /// after a transitional period. @@ -720,13 +678,12 @@ class CompilerOptions implements DiagnosticOptions { bool enableProtoShaking = false; bool get producesModifiedDill => - stage == Dart2JSStage.closedWorld && enableProtoShaking; + stage == CompilerStage.closedWorld && enableProtoShaking; - late final Dart2JSStage stage = _calculateStage(); + late final CompilerStage stage = _calculateStage(); - Dart2JSStage _calculateStage() => _stageFlag != null - ? Dart2JSStage.fromFlag(this) - : Dart2JSStage.fromLegacyFlags(this); + CompilerStage _calculateStage() => + _cfeOnly ? CompilerStage.cfe : CompilerStage.fromFlag(_stageFlag); Uri? _outputUri; Uri? outputUri; @@ -735,19 +692,19 @@ class CompilerOptions implements DiagnosticOptions { String? get _outputExtension { switch (stage) { - case Dart2JSStage.all: - case Dart2JSStage.allFromDill: - case Dart2JSStage.jsEmitter: - case Dart2JSStage.codegenAndJsEmitter: + case CompilerStage.all: + case CompilerStage.dumpInfoAll: + case CompilerStage.jsEmitter: + case CompilerStage.codegenAndJsEmitter: + case CompilerStage.dumpInfo: return '.js'; - case Dart2JSStage.cfe: - case Dart2JSStage.cfeFromDill: + case CompilerStage.cfe: return '.dill'; - case Dart2JSStage.closedWorld: + case CompilerStage.closedWorld: if (producesModifiedDill) return '.dill'; - case Dart2JSStage.deferredLoadIds: - case Dart2JSStage.globalInference: - case Dart2JSStage.codegenSharded: + case CompilerStage.deferredLoadIds: + case CompilerStage.globalInference: + case CompilerStage.codegenSharded: } return null; } @@ -797,65 +754,36 @@ class CompilerOptions implements DiagnosticOptions { outputUri = _outputUri; } - Uri? _getSpecifiedReadDataPath(Dart2JSStage dart2jsStage) { - switch (dart2jsStage) { - case Dart2JSStage.all: - case Dart2JSStage.cfe: - case Dart2JSStage.allFromDill: - case Dart2JSStage.cfeFromDill: - case Dart2JSStage.jsEmitter: - case Dart2JSStage.codegenAndJsEmitter: - case Dart2JSStage.deferredLoadIds: - return null; - case Dart2JSStage.closedWorld: - return _readClosedWorldUri; - case Dart2JSStage.globalInference: - return _readDataUri; - case Dart2JSStage.codegenSharded: - return _readCodegenUri; - } - } - - Uri dataInputUriForStage(Dart2JSStage dart2jsStage) { - final dataUri = _getSpecifiedReadDataPath(dart2jsStage); - if (dataUri != null) return dataUri; - - if (dart2jsStage.dataOutputName != null) { - final filename = '$_outputPrefix${dart2jsStage.dataOutputName}'; - return _outputDir.resolve(filename); - } - throw ArgumentError('No data input generated for stage: $dart2jsStage'); - } - - Uri? _getSpecifiedWriteDataPath(Dart2JSStage dart2jsStage) { - switch (dart2jsStage) { - case Dart2JSStage.all: - case Dart2JSStage.allFromDill: - case Dart2JSStage.jsEmitter: - case Dart2JSStage.codegenAndJsEmitter: + Uri? _getSpecifiedDataPath(CompilerStage stage) { + switch (stage) { + case CompilerStage.all: + case CompilerStage.dumpInfoAll: + case CompilerStage.cfe: + case CompilerStage.jsEmitter: + case CompilerStage.codegenAndJsEmitter: return null; - case Dart2JSStage.deferredLoadIds: + case CompilerStage.deferredLoadIds: return _deferredLoadIdMapUri; - case Dart2JSStage.cfe: - case Dart2JSStage.cfeFromDill: - case Dart2JSStage.closedWorld: - return _writeClosedWorldUri; - case Dart2JSStage.globalInference: - return _writeDataUri; - case Dart2JSStage.codegenSharded: - return _writeCodegenUri; + case CompilerStage.closedWorld: + return _closedWorldUri; + case CompilerStage.globalInference: + return _globalInferenceUri; + case CompilerStage.codegenSharded: + return _codegenUri; + case CompilerStage.dumpInfo: + return _dumpInfoDataUri; } } - Uri dataOutputUriForStage(Dart2JSStage dart2jsStage) { - final dataUri = _getSpecifiedWriteDataPath(dart2jsStage); + Uri dataUriForStage(CompilerStage stage) { + final dataUri = _getSpecifiedDataPath(stage); if (dataUri != null) return dataUri; - if (dart2jsStage.dataOutputName != null) { - final filename = '$_outputPrefix${dart2jsStage.dataOutputName}'; + if (stage.dataOutputName != null) { + final filename = '$_outputPrefix${stage.dataOutputName}'; return _outputDir.resolve(filename); } - throw ArgumentError('No data output generated for stage: $dart2jsStage'); + throw ArgumentError('No data input generated for stage: $stage'); } late FeatureOptions features; @@ -914,11 +842,8 @@ class CompilerOptions implements DiagnosticOptions { ..experimentalPowersets = _hasOption(options, Flags.experimentalPowersets) ..disableRtiOptimization = _hasOption(options, Flags.disableRtiOptimization) - ..dumpInfo = _hasOption(options, Flags.dumpInfo) - ..dumpInfoReadUri = - _extractUriOption(options, '${Flags.readDumpInfoData}=') - ..dumpInfoWriteUri = - _extractUriOption(options, '${Flags.writeDumpInfoData}=') + .._dumpInfoDataUri = + _extractUriOption(options, '${Flags.dumpInfoDataUri}=') ..useDumpInfoBinaryFormat = _hasOption(options, "${Flags.dumpInfo}=binary") ..dumpSsaPattern = @@ -973,16 +898,11 @@ class CompilerOptions implements DiagnosticOptions { _extractUriListOption(options, '${Flags.dillDependencies}') ..readProgramSplit = _extractUriOption(options, '${Flags.readProgramSplit}=') - .._readDataUri = _extractUriOption(options, '${Flags.readData}=') - .._writeDataUri = _extractUriOption(options, '${Flags.writeData}=') + .._globalInferenceUri = + _extractUriOption(options, '${Flags.globalInferenceUri}=') ..memoryMappedFiles = _hasOption(options, Flags.memoryMappedFiles) - ..noClosedWorldInData = _hasOption(options, Flags.noClosedWorldInData) - .._readClosedWorldUri = - _extractUriOption(options, '${Flags.readClosedWorld}=') - .._writeClosedWorldUri = - _extractUriOption(options, '${Flags.writeClosedWorld}=') - .._readCodegenUri = _extractUriOption(options, '${Flags.readCodegen}=') - .._writeCodegenUri = _extractUriOption(options, '${Flags.writeCodegen}=') + .._closedWorldUri = _extractUriOption(options, '${Flags.closedWorldUri}=') + .._codegenUri = _extractUriOption(options, '${Flags.codegenUri}=') ..codegenShard = _extractIntOption(options, '${Flags.codegenShard}=') ..codegenShards = _extractIntOption(options, '${Flags.codegenShards}=') .._cfeOnly = _hasOption(options, Flags.cfeOnly) @@ -1006,114 +926,30 @@ class CompilerOptions implements DiagnosticOptions { } String? validateStage() { - bool expectSourcesIn = false; - bool expectKernelIn = false; - bool expectKernelOut = false; - bool expectDeferredLoadIdsOut = false; - bool expectClosedWorldIn = false; - bool expectClosedWorldOut = false; - bool expectGlobalIn = false; - bool expectGlobalOut = false; bool expectCodegenIn = false; bool expectCodegenOut = false; switch (stage) { - case Dart2JSStage.all: - expectSourcesIn = true; - break; - case Dart2JSStage.allFromDill: - expectKernelIn = true; - break; - case Dart2JSStage.cfe: - expectSourcesIn = true; - expectKernelOut = true; - break; - case Dart2JSStage.cfeFromDill: - expectKernelIn = true; - expectKernelOut = true; - break; - case Dart2JSStage.deferredLoadIds: - expectKernelIn = true; - expectDeferredLoadIdsOut = true; + case CompilerStage.all: + case CompilerStage.dumpInfoAll: + case CompilerStage.cfe: + case CompilerStage.deferredLoadIds: + case CompilerStage.closedWorld: + case CompilerStage.globalInference: + case CompilerStage.codegenAndJsEmitter: + case CompilerStage.dumpInfo: break; - case Dart2JSStage.closedWorld: - expectClosedWorldOut = true; - expectKernelIn = true; - break; - case Dart2JSStage.globalInference: - expectGlobalOut = true; - expectKernelIn = true; - expectClosedWorldIn = true; - break; - case Dart2JSStage.codegenSharded: + case CompilerStage.codegenSharded: expectCodegenOut = true; - expectKernelIn = true; - expectClosedWorldIn = true; - expectGlobalIn = true; break; - case Dart2JSStage.codegenAndJsEmitter: - expectKernelIn = true; - expectClosedWorldIn = true; - expectGlobalIn = true; - break; - case Dart2JSStage.jsEmitter: - expectKernelIn = true; - expectClosedWorldIn = true; - expectGlobalIn = true; + case CompilerStage.jsEmitter: expectCodegenIn = true; break; } - if (expectKernelIn && (!compilationTarget.path.endsWith('.dill'))) { - return 'Must provide `.dill` input.'; - } - - if (expectSourcesIn && (!compilationTarget.path.endsWith('.dart'))) { - return 'Must provide `.dart` input. ($compilationTarget) ($entryUri)'; - } - - // Check CFE only flags. - if (_cfeOnly && !expectKernelOut) { - return 'Cannot write serialized data during ${stage.name} stage.'; - } - - if (_deferredLoadIdMapUri != null && !expectDeferredLoadIdsOut) { - return 'Cannot write deferred load ID map during ${stage.name} stage.'; - } - - // Check closed world flags. - if (_writeClosedWorldUri != null && !expectClosedWorldOut) { - return 'Cannot write closed world during ${stage.name} stage.'; - } - if (_readClosedWorldUri != null && !expectClosedWorldIn) { - return 'Cannot read closed world in stage ${stage.name}.'; - } - - // Check global inference flags. - if (_writeDataUri != null && !expectGlobalOut) { - return 'Cannot write global inference data ' - 'during ${stage.name} stage.'; - } - if (_readDataUri != null && !expectGlobalIn) { - return 'Cannot read global inference data in ' - 'stage ${stage.name}.'; - } - - // Check codegen flags. - if (_writeCodegenUri != null && !expectCodegenOut) { - return 'Cannot write codegen data during ${stage.name} stage.'; - } - if (_readCodegenUri != null && !expectCodegenIn) { - return 'Cannot read codegen shards in stage ${stage.name}.'; - } - if (codegenShard == null && expectCodegenOut) { return 'Must specify value for ${Flags.codegenShard} ' 'in stage ${stage.name}.'; } - if (codegenShard != null && !expectCodegenOut) { - return 'Cannot specify ${Flags.codegenShard} during ' - '${stage.name} stage.'; - } if (codegenShards == null && expectCodegenOut) { return 'Must specify value for ${Flags.codegenShards} ' @@ -1123,10 +959,6 @@ class CompilerOptions implements DiagnosticOptions { return 'Must specify value for ${Flags.codegenShards} ' 'in stage ${stage.name}.'; } - if (codegenShards != null && !(expectCodegenIn || expectCodegenOut)) { - return 'Cannot specify ${Flags.codegenShards} during ' - '${stage.name} stage.'; - } return null; } diff --git a/pkg/compiler/lib/src/phase/load_kernel.dart b/pkg/compiler/lib/src/phase/load_kernel.dart index 37af5d80a186..e362de92355d 100644 --- a/pkg/compiler/lib/src/phase/load_kernel.dart +++ b/pkg/compiler/lib/src/phase/load_kernel.dart @@ -402,7 +402,7 @@ Future run(Input input) async { ir.Component? component; fe.InitializedCompilerState? initializedCompilerState = input.initializedCompilerState; - if (options.stage.shouldLoadFromDill) { + if (options.shouldLoadFromDill) { _LoadFromKernelResult result = await _loadFromKernel(options, compilerInput, targetName, reporter); component = result.component; diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart index a09f51781a3d..7972516c7543 100644 --- a/pkg/compiler/lib/src/serialization/task.dart +++ b/pkg/compiler/lib/src/serialization/task.dart @@ -3,9 +3,11 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; + import 'package:kernel/ast.dart' as ir; import 'package:kernel/binary/ast_from_binary.dart' as ir; import 'package:kernel/binary/ast_to_binary.dart' as ir; + import '../../compiler_api.dart' as api; import '../commandline_options.dart' show Flags; import '../common/codegen.dart'; @@ -21,8 +23,8 @@ import '../inferrer/types.dart'; import '../io/source_information.dart'; import '../js_backend/codegen_inputs.dart'; import '../js_backend/inferred_data.dart'; -import '../js_model/js_world.dart'; import '../js_model/js_strategy.dart'; +import '../js_model/js_world.dart'; import '../js_model/locals.dart'; import '../options.dart'; import 'deferrable.dart'; @@ -70,7 +72,7 @@ class SerializationTask extends CompilerTask { Future deserializeComponent() async { return measureIoSubtask('deserialize dill', () async { _reporter.log('Reading dill from ${_options.inputDillUri}'); - final dillInput = await _provider.readFromUri(_options.inputDillUri!, + final dillInput = await _provider.readFromUri(_options.inputDillUri, inputKind: api.InputKind.binary); ir.Component component = ir.Component(); // Not using growable lists saves memory. @@ -110,8 +112,7 @@ class SerializationTask extends CompilerTask { void serializeClosedWorld( JClosedWorld closedWorld, SerializationIndices indices) { measureSubtask('serialize closed world', () { - final outputUri = - _options.dataOutputUriForStage(Dart2JSStage.closedWorld); + final outputUri = _options.dataUriForStage(CompilerStage.closedWorld); _reporter.log('Writing closed world to $outputUri'); api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(outputUri); @@ -127,7 +128,7 @@ class SerializationTask extends CompilerTask { bool useDeferredSourceReads, SerializationIndices indices) async { return await measureIoSubtask('deserialize closed world', () async { - final uri = _options.dataInputUriForStage(Dart2JSStage.closedWorld); + final uri = _options.dataUriForStage(CompilerStage.closedWorld); _reporter.log('Reading data from $uri'); api.Input> dataInput = await _provider.readFromUri(uri, inputKind: api.InputKind.binary); @@ -146,8 +147,7 @@ class SerializationTask extends CompilerTask { void serializeGlobalTypeInference( GlobalTypeInferenceResults results, SerializationIndices indices) { measureSubtask('serialize data', () { - final outputUri = - _options.dataOutputUriForStage(Dart2JSStage.globalInference); + final outputUri = _options.dataUriForStage(CompilerStage.globalInference); _reporter.log('Writing data to $outputUri'); api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(outputUri); @@ -165,7 +165,7 @@ class SerializationTask extends CompilerTask { bool useDeferredSourceReads, SerializationIndices indices) async { return await measureIoSubtask('deserialize data', () async { - final uri = _options.dataInputUriForStage(Dart2JSStage.globalInference); + final uri = _options.dataUriForStage(CompilerStage.globalInference); _reporter.log('Reading data from $uri'); api.Input> dataInput = await _provider.readFromUri(uri, inputKind: api.InputKind.binary); @@ -205,8 +205,7 @@ class SerializationTask extends CompilerTask { index++; }); measureSubtask('serialize codegen', () { - final outputUri = - _options.dataOutputUriForStage(Dart2JSStage.codegenSharded); + final outputUri = _options.dataUriForStage(CompilerStage.codegenSharded); Uri uri = Uri.parse('$outputUri$shard'); api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(uri); DataSinkWriter sink = @@ -232,7 +231,7 @@ class SerializationTask extends CompilerTask { Map> results = {}; for (int shard = 0; shard < shards; shard++) { Uri uri = Uri.parse( - '${_options.dataInputUriForStage(Dart2JSStage.codegenSharded)}$shard'); + '${_options.dataUriForStage(CompilerStage.codegenSharded)}$shard'); await measureIoSubtask('deserialize codegen', () async { _reporter.log('Reading data from ${uri}'); api.Input> dataInput = @@ -279,7 +278,7 @@ class SerializationTask extends CompilerTask { DataSinkWriter dataSinkWriterForDumpInfo( AbstractValueDomain abstractValueDomain, SerializationIndices indices) { - final outputUri = _options.dumpInfoWriteUri!; + final outputUri = _options.dataUriForStage(CompilerStage.dumpInfo); api.BinaryOutputSink dataOutput = _outputProvider.createBinarySink(outputUri); final sink = DataSinkWriter(BinaryDataSink(dataOutput), _options, indices); @@ -301,7 +300,7 @@ class SerializationTask extends CompilerTask { AbstractValueDomain abstractValueDomain, OutputUnitData outputUnitData, SerializationIndices indices) async { - final inputUri = _options.dumpInfoReadUri!; + final inputUri = _options.dataUriForStage(CompilerStage.dumpInfo); final dataInput = await _provider.readFromUri(inputUri, inputKind: api.InputKind.binary); final source = DataSourceReader( diff --git a/pkg/compiler/test/dump_info/dump_info_new_regression_test.dart b/pkg/compiler/test/dump_info/dump_info_new_regression_test.dart index cc0aaefee6eb..e1ab714d7240 100644 --- a/pkg/compiler/test/dump_info/dump_info_new_regression_test.dart +++ b/pkg/compiler/test/dump_info/dump_info_new_regression_test.dart @@ -92,7 +92,11 @@ void main(List args) { await checkTests(dataDir, const DumpInfoDataComputer(), args: filteredArgs, testedConfigs: allSpecConfigs, - options: ['--dump-info', '--new-dump-info', '--enable-asserts']); + options: [ + '--stage=dump-info-all', + '--new-dump-info', + '--enable-asserts' + ]); }); } diff --git a/pkg/compiler/test/dump_info/dump_info_new_test.dart b/pkg/compiler/test/dump_info/dump_info_new_test.dart index d2cf83a6c3df..e491c4474996 100644 --- a/pkg/compiler/test/dump_info/dump_info_new_test.dart +++ b/pkg/compiler/test/dump_info/dump_info_new_test.dart @@ -45,7 +45,11 @@ main(List args) { await checkTests(dataDir, const DumpInfoDataComputer(), args: args, testedConfigs: allSpecConfigs, - options: ['--dump-info', '--new-dump-info', '--enable-asserts']); + options: [ + '--stage=dump-info-all', + '--new-dump-info', + '--enable-asserts' + ]); }); } diff --git a/pkg/compiler/test/dump_info/dump_info_test.dart b/pkg/compiler/test/dump_info/dump_info_test.dart index a3d5d7a3dc2a..262babe44586 100644 --- a/pkg/compiler/test/dump_info/dump_info_test.dart +++ b/pkg/compiler/test/dump_info/dump_info_test.dart @@ -43,7 +43,9 @@ main(List args) { print('Testing output of dump-info'); print('=================================================================='); await checkTests(dataDir, const DumpInfoDataComputer(), - args: args, testedConfigs: allSpecConfigs, options: ['--dump-info']); + args: args, + testedConfigs: allSpecConfigs, + options: ['--stage=dump-info-all']); }); } diff --git a/pkg/compiler/test/end_to_end/command_line_test.dart b/pkg/compiler/test/end_to_end/command_line_test.dart index e9c832bc5202..b9c2ddf5f9f6 100644 --- a/pkg/compiler/test/end_to_end/command_line_test.dart +++ b/pkg/compiler/test/end_to_end/command_line_test.dart @@ -12,7 +12,7 @@ import 'package:expect/expect.dart'; import 'package:compiler/compiler_api.dart' as api; import 'package:compiler/src/commandline_options.dart'; import 'package:compiler/src/dart2js.dart' as entry; -import 'package:compiler/src/options.dart' show CompilerOptions, Dart2JSStage; +import 'package:compiler/src/options.dart' show CompilerOptions, CompilerStage; main() { entry.enableWriteString = false; @@ -92,8 +92,6 @@ main() { '${Flags.stage}=deferred-load-ids', 'foo.dill', ], writeDeferredLoadIds: 'deferred_load_ids.data'); - await test(['foo.dill', '${Flags.deferredLoadIdMapUri}=load_ids.data'], - writeDeferredLoadIds: 'load_ids.data'); // Run closed world only await test(['${Flags.stage}=closed-world', 'foo.dill'], @@ -104,23 +102,9 @@ main() { writeClosedWorld: 'world.data'); await test([ '${Flags.stage}=closed-world', - '${Flags.writeClosedWorld}=world1.data', + '${Flags.closedWorldUri}=world1.data', 'foo.dill' ], writeClosedWorld: 'world1.data'); - await test([ - '${Flags.writeClosedWorld}=world1.data', - 'foo.dill', - ], writeClosedWorld: 'world1.data'); - await test(['${Flags.writeClosedWorld}=world1.data', 'foo.dill'], - writeClosedWorld: 'world1.data'); - await test( - ['${Flags.writeClosedWorld}=world1.data', 'foo.dill', '--out=prefix-'], - writeClosedWorld: 'world1.data'); - await test([ - '${Flags.writeClosedWorld}=world1.data', - 'foo.dill', - '--out=/some/path/prefix-' - ], writeClosedWorld: 'world1.data'); await test(['foo.dill', '${Flags.stage}=closed-world', '--out=/some/path/'], writeClosedWorld: '/some/path/world.data'); await test(['foo.dill', '${Flags.stage}=closed-world', '--out=prefix-'], @@ -137,31 +121,14 @@ main() { readClosedWorld: 'world.data', writeData: 'global.data'); await test([ '${Flags.stage}=global-inference', - '${Flags.readClosedWorld}=world1.data', + '${Flags.closedWorldUri}=world1.data', 'foo.dill' ], readClosedWorld: 'world1.data', writeData: 'global.data'); await test([ '${Flags.stage}=global-inference', - '${Flags.writeData}=global1.data', + '${Flags.globalInferenceUri}=global1.data', 'foo.dill' ], readClosedWorld: 'world.data', writeData: 'global1.data'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.writeData}=global1.data', - 'foo.dill' - ], readClosedWorld: 'world1.data', writeData: 'global1.data'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.writeData}=global1.data', - 'foo.dill', - '--out=prefix-' - ], readClosedWorld: 'world1.data', writeData: 'global1.data'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.writeData}=global1.data', - 'foo.dill', - '--out=/some/path/prefix-' - ], readClosedWorld: 'world1.data', writeData: 'global1.data'); await test( ['foo.dill', '${Flags.stage}=global-inference', '--out=/some/path/'], readClosedWorld: '/some/path/world.data', @@ -182,10 +149,6 @@ main() { ], readClosedWorld: '/some/path/foo.dataworld.data', writeData: '/some/path/foo.dataglobal.data'); - await test( - ['foo.dill', '${Flags.stage}=global-inference', '--out=foo.data'], - readClosedWorld: 'foo.dataworld.data', - writeData: 'foo.dataglobal.data'); // Run codegen only await test([ @@ -212,8 +175,8 @@ main() { codegenShards: 11); await test([ '${Flags.stage}=codegen', - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', + '${Flags.closedWorldUri}=world1.data', + '${Flags.globalInferenceUri}=global1.data', '${Flags.codegenShard}=10', '${Flags.codegenShards}=11', 'foo.dill' @@ -225,7 +188,7 @@ main() { codegenShards: 11); await test([ '${Flags.stage}=codegen', - '${Flags.writeCodegen}=codegen1', + '${Flags.codegenUri}=codegen1', '${Flags.codegenShard}=10', '${Flags.codegenShards}=11', 'foo.dill' @@ -235,58 +198,6 @@ main() { writeCodegen: 'codegen1', codegenShard: 10, codegenShards: 11); - await test([ - '${Flags.writeCodegen}=codegen1', - '${Flags.codegenShard}=10', - '${Flags.codegenShards}=11', - 'foo.dill' - ], - readClosedWorld: 'world.data', - readData: 'global.data', - writeCodegen: 'codegen1', - codegenShard: 10, - codegenShards: 11); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.writeCodegen}=codegen1', - '${Flags.codegenShard}=10', - '${Flags.codegenShards}=11', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - writeCodegen: 'codegen1', - codegenShard: 10, - codegenShards: 11); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.writeCodegen}=codegen1', - '${Flags.codegenShard}=10', - '${Flags.codegenShards}=11', - 'foo.dill', - '--out=prefix-' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - writeCodegen: 'codegen1', - codegenShard: 10, - codegenShards: 11); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.writeCodegen}=codegen1', - '${Flags.codegenShard}=10', - '${Flags.codegenShards}=11', - 'foo.dill', - '--out=/some/path/prefix-' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - writeCodegen: 'codegen1', - codegenShard: 10, - codegenShards: 11); await test([ 'foo.dill', '${Flags.stage}=codegen', @@ -368,9 +279,9 @@ main() { out: 'out.js'); await test([ '${Flags.stage}=emit-js', - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.readCodegen}=codegen1', + '${Flags.closedWorldUri}=world1.data', + '${Flags.globalInferenceUri}=global1.data', + '${Flags.codegenUri}=codegen1', '${Flags.codegenShards}=11', 'foo.dill' ], @@ -390,44 +301,6 @@ main() { readCodegen: 'codegen', codegenShards: 11, out: 'out.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.readCodegen}=codegen1', - '${Flags.codegenShards}=11', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - readCodegen: 'codegen1', - codegenShards: 11, - out: 'out.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.readCodegen}=codegen1', - '${Flags.codegenShards}=11', - '--out=out1.js', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - readCodegen: 'codegen1', - codegenShards: 11, - out: 'out1.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '${Flags.readCodegen}=codegen1', - '${Flags.codegenShards}=11', - '-oout1.js', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - readCodegen: 'codegen1', - codegenShards: 11, - out: 'out1.js'); await test([ 'foo.dill', '${Flags.stage}=emit-js', @@ -470,35 +343,12 @@ main() { readClosedWorld: 'world.data', readData: 'global.data', out: 'out.js'); await test([ '${Flags.stage}=codegen-emit-js', - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', + '${Flags.closedWorldUri}=world1.data', + '${Flags.globalInferenceUri}=global1.data', 'foo.dill' ], readClosedWorld: 'world1.data', readData: 'global1.data', out: 'out.js'); await test(['${Flags.stage}=codegen-emit-js', '--out=out.js', 'foo.dill'], readClosedWorld: 'world.data', readData: 'global.data', out: 'out.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - 'foo.dill' - ], readClosedWorld: 'world1.data', readData: 'global1.data', out: 'out.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '--out=out1.js', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - out: 'out1.js'); - await test([ - '${Flags.readClosedWorld}=world1.data', - '${Flags.readData}=global1.data', - '-oout1.js', - 'foo.dill' - ], - readClosedWorld: 'world1.data', - readData: 'global1.data', - out: 'out1.js'); await test( ['foo.dill', '${Flags.stage}=codegen-emit-js', '--out=/some/path/'], readClosedWorld: '/some/path/world.data', @@ -518,295 +368,22 @@ main() { out: '/some/path/prefix-out.js'); // Invalid states with stage flag - // CFE stage - await test([ - '${Flags.stage}=cfe', - '${Flags.readClosedWorld}=world1.data', - 'foo.dart' - ], readClosedWorld: 'world.data', out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=cfe', '${Flags.readData}=global1.data', 'foo.dart'], - readData: 'global1.data', out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=cfe', '${Flags.readCodegen}=codegen', 'foo.dart'], - readCodegen: 'codegen', out: 'out.js', exitCode: 1); - await test(['${Flags.stage}=cfe', '${Flags.codegenShard}=1', 'foo.dart'], - codegenShard: 1, exitCode: 1); - await test(['${Flags.stage}=cfe', '${Flags.codegenShards}=2', 'foo.dart'], - codegenShards: 2, exitCode: 1); - await test([ - '${Flags.stage}=cfe', - '${Flags.writeClosedWorld}=world1.data', - 'foo.dart' - ], writeClosedWorld: 'world.data', out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=cfe', '${Flags.writeData}=global1.data', 'foo.dart'], - writeData: 'global1.data', out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=cfe', '${Flags.writeCodegen}=codegen', 'foo.dart'], - writeCodegen: 'codegen', out: 'out.js', exitCode: 1); - - // Closed world stage - await test(['${Flags.stage}=closed-world', 'foo.dart'], - out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=closed-world', - '${Flags.readClosedWorld}=world1.data', - 'foo.dill' - ], readClosedWorld: 'world.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=closed-world', - '${Flags.readData}=global1.data', - 'foo.dill' - ], readData: 'global1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=closed-world', - '${Flags.readCodegen}=codegen', - 'foo.dill' - ], readCodegen: 'codegen', out: 'out.js', exitCode: 1); - await test(['${Flags.stage}=cfe', '${Flags.codegenShard}=1', 'foo.dill'], - codegenShard: 1, exitCode: 1); - await test( - ['${Flags.stage}=closed-world', '${Flags.codegenShards}=2', 'foo.dill'], - codegenShards: 2, exitCode: 1); - await test([ - '${Flags.stage}=closed-world', - '${Flags.writeData}=global1.data', - 'foo.dill' - ], writeData: 'global1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=closed-world', - '${Flags.writeCodegen}=codegen', - 'foo.dill' - ], writeCodegen: 'codegen', out: 'out.js', exitCode: 1); - - // Global inference stage - await test(['${Flags.stage}=global-inference', 'foo.dart'], - out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=global-inference', - '${Flags.readData}=global1.data', - 'foo.dill' - ], readData: 'global1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=global-inference', - '${Flags.readCodegen}=codegen', - 'foo.dill' - ], readCodegen: 'codegen', out: 'out.js', exitCode: 1); - await test(['${Flags.stage}=cfe', '${Flags.codegenShard}=1', 'foo.dill'], - codegenShard: 1, exitCode: 1); - await test([ - '${Flags.stage}=global-inference', - '${Flags.codegenShards}=2', - 'foo.dill' - ], codegenShards: 2, exitCode: 1); - await test([ - '${Flags.stage}=global-inference', - '${Flags.writeClosedWorld}=world1.data', - 'foo.dill' - ], writeClosedWorld: 'world1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=global-inference', - '${Flags.writeCodegen}=codegen', - 'foo.dill' - ], writeCodegen: 'codegen', out: 'out.js', exitCode: 1); - // Codegen stage await test([ '${Flags.stage}=codegen', - '${Flags.codegenShard}=0', + '${Flags.codegenUri}=codegen', '${Flags.codegenShards}=1', - 'foo.dart' - ], out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=codegen', '${Flags.readCodegen}=codegen', 'foo.dill'], - readCodegen: 'codegen', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=codegen', - '${Flags.writeClosedWorld}=world1.data', 'foo.dill' - ], writeClosedWorld: 'world1.data', out: 'out.js', exitCode: 1); + ], readCodegen: 'codegen', out: 'out.js', exitCode: 1); await test([ '${Flags.stage}=codegen', - '${Flags.writeData}=global1.data', + '${Flags.codegenUri}=codegen', + '${Flags.codegenShard}=0', 'foo.dill' - ], writeData: 'global1.data', out: 'out.js', exitCode: 1); + ], readCodegen: 'codegen', out: 'out.js', exitCode: 1); // JS Emitter stage - await test( - ['${Flags.stage}=emit-js', '${Flags.codegenShards}=1', 'foo.dart'], - codegenShards: 1, exitCode: 1); - await test( - ['${Flags.stage}=emit-js', '${Flags.codegenShard}=1', 'foo.dill'], - codegenShard: 1, exitCode: 1); - await test([ - '${Flags.stage}=emit-js', - '${Flags.writeClosedWorld}=world1.data', - 'foo.dill' - ], writeClosedWorld: 'world1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=emit-js', - '${Flags.writeData}=global1.data', - 'foo.dill' - ], writeData: 'global1.data', out: 'out.js', exitCode: 1); - await test( - ['${Flags.stage}=emit-js', '${Flags.writeCodegen}=codegen', 'foo.dill'], - writeData: 'codegen', out: 'out.js', exitCode: 1); - - // Codegen and JS Emitter stage - await test(['${Flags.stage}=codegen-emit-js', 'foo.dart'], - out: 'out1.js', exitCode: 1); - await test([ - '${Flags.stage}=codegen-emit-js', - '${Flags.readCodegen}=codegen', - 'foo.dill' - ], readCodegen: 'codegen', out: 'out1.js', exitCode: 1); - await test([ - '${Flags.stage}=codegen-emit-js', - '${Flags.writeClosedWorld}=world1.data', - 'foo.dill' - ], writeClosedWorld: 'world1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=codegen-emit-js', - '${Flags.writeData}=global1.data', - 'foo.dill' - ], writeData: 'global1.data', out: 'out.js', exitCode: 1); - await test([ - '${Flags.stage}=codegen-emit-js', - '${Flags.writeCodegen}=global1.data', - 'foo.dill' - ], writeCodegen: 'codegen', out: 'out.js', exitCode: 1); - - // Invalid states with write/read flags - await test([], exitCode: 1); - await test([Flags.cfeOnly], exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.readClosedWorld], exitCode: 1); - await test(['foo.dart', Flags.readClosedWorld, Flags.cfeOnly], exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.readData], exitCode: 1); - await test(['foo.dart', Flags.readData, Flags.cfeOnly], exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.readCodegen], exitCode: 1); - await test(['foo.dart', Flags.readCodegen, Flags.cfeOnly], exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.writeClosedWorld], - exitCode: 1); - await test(['foo.dart', Flags.writeClosedWorld, Flags.cfeOnly], - exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.writeData], exitCode: 1); - await test(['foo.dart', Flags.writeData, Flags.cfeOnly], exitCode: 1); - await test([Flags.cfeOnly, 'foo.dart', Flags.writeCodegen], exitCode: 1); - await test(['foo.dart', Flags.writeCodegen, Flags.cfeOnly], exitCode: 1); - - await test([Flags.writeData, 'foo.dart'], - writeData: 'global.data', exitCode: 1); - await test([Flags.readClosedWorld, Flags.writeClosedWorld, 'foo.dart'], - exitCode: 1); - await test([Flags.writeClosedWorld, Flags.readClosedWorld, 'foo.dart'], - exitCode: 1); - await test([Flags.readData, Flags.writeData, 'foo.dart'], exitCode: 1); - await test([Flags.writeData, Flags.readData, 'foo.dart'], exitCode: 1); - await test([Flags.readCodegen, Flags.writeClosedWorld, 'foo.dart'], - exitCode: 1); - await test([Flags.readCodegen, Flags.writeData, 'foo.dart'], exitCode: 1); - await test([Flags.writeClosedWorld, Flags.readData, 'foo.dart'], - exitCode: 1); - await test([Flags.writeClosedWorld, Flags.readCodegen, 'foo.dart'], - exitCode: 1); - await test([Flags.writeData, Flags.readCodegen, 'foo.dart'], exitCode: 1); - - await test([ - Flags.writeClosedWorld, - 'foo.dart', - ], out: 'out.dill', writeClosedWorld: 'out.dill.world', exitCode: 1); - - await test([Flags.readClosedWorld, 'foo.dill'], - out: 'out.js', readClosedWorld: 'foo.dill.world', exitCode: 1); - await test([Flags.readClosedWorld, 'foo.dill', '--out=foo.js'], - out: 'foo.js', readClosedWorld: 'foo.dill.world', exitCode: 1); - await test(['${Flags.readClosedWorld}=out.world', 'foo.dill'], - out: 'out.js', readClosedWorld: 'out.world', exitCode: 1); - await test( - ['${Flags.readClosedWorld}=out.world', 'foo.dill', '--out=foo.js'], - out: 'foo.js', readClosedWorld: 'out.world', exitCode: 1); - - await test([Flags.readData, 'foo.dill'], exitCode: 1); - await test([Flags.readClosedWorld, Flags.readData, 'foo.dill'], - out: 'out.js', - readClosedWorld: 'foo.dill.world', - readData: 'foo.dill.data', - exitCode: 1); - await test( - [Flags.readClosedWorld, Flags.readData, 'foo.dill', '--out=foo.js'], - out: 'foo.js', - readClosedWorld: 'foo.dill.world', - readData: 'foo.dill.data', - exitCode: 1); - - await test([ - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShard}=0', - '${Flags.codegenShards}=2' - ], exitCode: 1); - await test([ - Flags.readClosedWorld, - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShard}=0', - '${Flags.codegenShards}=2' - ], - readClosedWorld: 'foo.dill.world', - readData: 'foo.dill.data', - writeCodegen: 'codegen.code', - codegenShard: 0, - codegenShards: 2, - exitCode: 1); - await test([Flags.writeCodegen, 'foo.dill', Flags.readCodegen], - exitCode: 1); - await test([Flags.readCodegen, Flags.writeCodegen, 'foo.dill'], - exitCode: 1); - await test( - [Flags.readData, Flags.writeCodegen, 'foo.dill', Flags.readCodegen], - exitCode: 1); - await test( - [Flags.readCodegen, Flags.readData, Flags.writeCodegen, 'foo.dill'], - exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - ], exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShard}=0' - ], exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShards}=2' - ], exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShards}=0' - ], exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShard}=-1', - '${Flags.codegenShards}=2' - ], exitCode: 1); - await test([ - Flags.readData, - Flags.writeCodegen, - 'foo.dill', - '${Flags.codegenShard}=2', - '${Flags.codegenShards}=2' - ], exitCode: 1); + await test(['${Flags.stage}=emit-js', 'foo.dart'], exitCode: 1); }); } @@ -849,19 +426,16 @@ Future test(List arguments, Expect.equals(exitCode, actualExitCode, "Unexpected exit code"); if (actualExitCode == null) { Expect.equals(toUri(out), options.outputUri, "Unexpected output uri."); - if (allFromDill) { - Expect.equals(Dart2JSStage.allFromDill, options.stage); - } - if (cfeFromDill) { - Expect.equals(Dart2JSStage.cfeFromDill, options.stage); + if (allFromDill || cfeFromDill) { + Expect.isNotNull(options.compilationTarget.path.endsWith('.dill')); } if (writeDeferredLoadIds == null) { - Expect.notEquals(options.stage, Dart2JSStage.deferredLoadIds); + Expect.notEquals(options.stage, CompilerStage.deferredLoadIds); } else { - Expect.equals(options.stage, Dart2JSStage.deferredLoadIds); + Expect.equals(options.stage, CompilerStage.deferredLoadIds); Expect.equals( toUri(writeDeferredLoadIds), - options.dataOutputUriForStage(Dart2JSStage.deferredLoadIds), + options.dataUriForStage(CompilerStage.deferredLoadIds), "Unexpected writeDeferredLoadIds uri"); } if (readClosedWorld == null) { @@ -870,16 +444,16 @@ Future test(List arguments, Expect.isTrue(options.stage.shouldReadClosedWorld); Expect.equals( toUri(readClosedWorld), - options.dataInputUriForStage(Dart2JSStage.closedWorld), + options.dataUriForStage(CompilerStage.closedWorld), "Unexpected readClosedWorld uri"); } if (writeClosedWorld == null) { - Expect.notEquals(options.stage, Dart2JSStage.closedWorld); + Expect.notEquals(options.stage, CompilerStage.closedWorld); } else { - Expect.equals(options.stage, Dart2JSStage.closedWorld); + Expect.equals(options.stage, CompilerStage.closedWorld); Expect.equals( toUri(writeClosedWorld), - options.dataOutputUriForStage(Dart2JSStage.closedWorld), + options.dataUriForStage(CompilerStage.closedWorld), "Unexpected writeClosedWorld uri"); } if (readData == null) { @@ -888,16 +462,16 @@ Future test(List arguments, Expect.isTrue(options.stage.shouldReadGlobalInference); Expect.equals( toUri(readData), - options.dataInputUriForStage(Dart2JSStage.globalInference), + options.dataUriForStage(CompilerStage.globalInference), "Unexpected readData uri"); } if (writeData == null) { - Expect.notEquals(options.stage, Dart2JSStage.globalInference); + Expect.notEquals(options.stage, CompilerStage.globalInference); } else { - Expect.equals(options.stage, Dart2JSStage.globalInference); + Expect.equals(options.stage, CompilerStage.globalInference); Expect.equals( toUri(writeData), - options.dataOutputUriForStage(Dart2JSStage.globalInference), + options.dataUriForStage(CompilerStage.globalInference), "Unexpected writeData uri"); } if (readCodegen == null) { @@ -906,16 +480,16 @@ Future test(List arguments, Expect.isTrue(options.stage.shouldReadCodegenShards); Expect.equals( toUri(readCodegen), - options.dataInputUriForStage(Dart2JSStage.codegenSharded), + options.dataUriForStage(CompilerStage.codegenSharded), "Unexpected readCodegen uri"); } if (writeCodegen == null) { - Expect.notEquals(options.stage, Dart2JSStage.codegenSharded); + Expect.notEquals(options.stage, CompilerStage.codegenSharded); } else { - Expect.equals(options.stage, Dart2JSStage.codegenSharded); + Expect.equals(options.stage, CompilerStage.codegenSharded); Expect.equals( toUri(writeCodegen), - options.dataOutputUriForStage(Dart2JSStage.codegenSharded), + options.dataUriForStage(CompilerStage.codegenSharded), "Unexpected writeCodegen uri"); } Expect.equals( diff --git a/pkg/compiler/test/end_to_end/dump_info2_test.dart b/pkg/compiler/test/end_to_end/dump_info2_test.dart index 960b9458acb9..116eac73fa7b 100644 --- a/pkg/compiler/test/end_to_end/dump_info2_test.dart +++ b/pkg/compiler/test/end_to_end/dump_info2_test.dart @@ -102,7 +102,7 @@ const String TEST_INLINED_2 = r""" typedef InfoCheck = void Function(AllInfo); infoTest(String program, bool useBinary, InfoCheck check) async { - var options = ['--out=out.js', Flags.dumpInfo]; + var options = ['--out=out.js', '--stage=dump-info-all']; // Note: we always pass '--dump-info' because the memory-compiler does not // have the logic in dart2js.dart to imply dump-info when --dump-info=binary // is provided. diff --git a/pkg/compiler/test/end_to_end/dump_info_test.dart b/pkg/compiler/test/end_to_end/dump_info_test.dart index 8cc2069c2625..721391aa670e 100644 --- a/pkg/compiler/test/end_to_end/dump_info_test.dart +++ b/pkg/compiler/test/end_to_end/dump_info_test.dart @@ -53,8 +53,8 @@ void main() { String output1 = File.fromUri(tmpDir.uri.resolve('without/out.js')).readAsStringSync(); - command = - dart2JsCommand(['--out=json/out.js', 'swarm.dart', '--dump-info']); + command = dart2JsCommand( + ['--out=json/out.js', 'swarm.dart', '--stage=dump-info-all']); print('Run $command'); result = Process.runSync(Platform.resolvedExecutable, command, workingDirectory: tmpDir.path); @@ -73,8 +73,12 @@ void main() { print('Compare outputs...'); Expect.equals(output1, output2); - command = dart2JsCommand( - ['--out=binary/out.js', 'swarm.dart', '--dump-info=binary']); + command = dart2JsCommand([ + '--out=binary/out.js', + 'swarm.dart', + '--dump-info=binary', + '--stage=dump-info-all' + ]); print('Run $command'); result = Process.runSync(Platform.resolvedExecutable, command, workingDirectory: tmpDir.path); @@ -108,8 +112,9 @@ void main() { print(result.stderr); command = dart2JsCommand([ '--input-dill=json/cfe.dill', - '--write-closed-world=json/world.data', + '--closed-world-data=json/world.data', '--out=json/world.dill', + '--stage=closed-world', 'swarm.dart', ]); print('Run $command'); @@ -122,8 +127,9 @@ void main() { print(result.stderr); command = dart2JsCommand([ '--input-dill=json/world.dill', - '--read-closed-world=json/world.data', - '--write-data=json/global.data', + '--closed-world-data=json/world.data', + '--global-inference-data=json/global.data', + '--stage=global-inference', 'swarm.dart', ]); print('Run $command'); @@ -136,11 +142,12 @@ void main() { print(result.stderr); command = dart2JsCommand([ '--input-dill=json/world.dill', - '--read-closed-world=json/world.data', - '--read-data=json/global.data', - '--write-codegen=codegen', + '--closed-world-data=json/world.data', + '--global-inference-data=json/global.data', + '--codegen-data=codegen', '--codegen-shards=1', '--codegen-shard=0', + '--stage=codegen', 'swarm.dart', ]); print('Run $command'); @@ -153,12 +160,13 @@ void main() { print(result.stderr); command = dart2JsCommand([ '--input-dill=json/world.dill', - '--read-closed-world=json/world.data', - '--read-data=json/global.data', - '--read-codegen=codegen', + '--closed-world-data=json/world.data', + '--global-inference-data=json/global.data', + '--codegen-data=codegen', '--codegen-shards=1', '--out=out.js', - '--write-dump-info-data=json/dump.data', + '--dump-info-data=json/dump.data', + '--stage=emit-js', 'swarm.dart', ]); print('Run $command'); @@ -171,11 +179,12 @@ void main() { print(result.stderr); command = dart2JsCommand([ '--input-dill=json/world.dill', - '--read-closed-world=json/world.data', - '--read-data=json/global.data', - '--read-codegen=codegen', + '--closed-world-data=json/world.data', + '--global-inference-data=json/global.data', + '--codegen-data=codegen', '--codegen-shards=1', - '--read-dump-info-data=json/dump.data', + '--dump-info-data=json/dump.data', + '--stage=dump-info', 'swarm.dart', ]); print('Run $command'); @@ -195,12 +204,13 @@ void main() { command = dart2JsCommand([ '--input-dill=json/world.dill', - '--read-closed-world=json/world.data', - '--read-data=json/global.data', - '--read-codegen=codegen', + '--closed-world-data=json/world.data', + '--global-inference-data=json/global.data', + '--codegen-data=codegen', '--codegen-shards=1', - '--read-dump-info-data=json/dump.data', + '--dump-info-data=json/dump.data', '--dump-info=binary', + '--stage=dump-info', 'swarm.dart', ]); print('Run $command'); diff --git a/pkg/compiler/test/end_to_end/output_type_test.dart b/pkg/compiler/test/end_to_end/output_type_test.dart index 587f5a5f8419..7362d33a990b 100644 --- a/pkg/compiler/test/end_to_end/output_type_test.dart +++ b/pkg/compiler/test/end_to_end/output_type_test.dart @@ -90,7 +90,7 @@ main() { '--deferred-map=def/deferred.json', '--no-sound-null-safety', '--no-csp', - Flags.dumpInfo, + '--stage=dump-info-all', ], [ 'custom.js', 'custom.js.map', 'custom.js_1.part.js', 'custom.js_1.part.js.map', diff --git a/pkg/compiler/test/serialization/on_disk_split_test.dart b/pkg/compiler/test/serialization/on_disk_split_test.dart index d8031620cccc..060da121e093 100644 --- a/pkg/compiler/test/serialization/on_disk_split_test.dart +++ b/pkg/compiler/test/serialization/on_disk_split_test.dart @@ -26,23 +26,30 @@ main(List args) { // Unsound platform dill files are no longer packaged in the SDK and must // be read from the build directory during tests. '--platform-binaries=$buildRoot', + '${Flags.closedWorldUri}=$closedWorldUri', + '${Flags.globalInferenceUri}=$globalInferenceUri', ]; await internalMain([ 'pkg/compiler/test/codesize/swarm/swarm.dart', - Flags.cfeOnly, + '${Flags.stage}=cfe', '--out=${dillUri}', ] + commonArgs); await internalMain([ 'pkg/compiler/test/codesize/swarm/swarm.dart', '${Flags.inputDill}=$dillUri', - '${Flags.writeClosedWorld}=$closedWorldUri', + '${Flags.stage}=closed-world', ] + commonArgs); await internalMain([ '$dillUri', - '${Flags.readClosedWorld}=$closedWorldUri', - '${Flags.writeData}=$globalInferenceUri', + '${Flags.stage}=global-inference', + '--out=${outUri}', + ] + + commonArgs); + await internalMain([ + '$dillUri', + '${Flags.stage}=codegen-emit-js', '--out=${outUri}', ] + commonArgs); diff --git a/pkg/compiler/test/serialization/serialization_diff_helper.dart b/pkg/compiler/test/serialization/serialization_diff_helper.dart index 9174b34f081e..581c22860c00 100644 --- a/pkg/compiler/test/serialization/serialization_diff_helper.dart +++ b/pkg/compiler/test/serialization/serialization_diff_helper.dart @@ -41,45 +41,48 @@ Future compileWithSerialization( return outputProvider.clear(); } - await compile([...options, '--out=$cfeDillUri', Flags.cfeOnly]); + final commonFlags = [ + '${Flags.closedWorldUri}=$closedWorldUri', + '${Flags.globalInferenceUri}=$globalDataUri', + '${Flags.codegenUri}=$codegenUri', + '${Flags.codegenShards}=2', + ]; + + await compile( + [...options, '--out=$cfeDillUri', '${Flags.stage}=cfe'] + commonFlags); await compile([ - ...options, - '${Flags.inputDill}=$cfeDillUri', - '${Flags.writeClosedWorld}=$closedWorldUri' - ]); + ...options, + '${Flags.inputDill}=$cfeDillUri', + '${Flags.stage}=closed-world', + ] + + commonFlags); await compile([ - ...options, - '${Flags.inputDill}=$cfeDillUri', - '${Flags.readClosedWorld}=$closedWorldUri', - '${Flags.writeData}=$globalDataUri' - ]); + ...options, + '${Flags.inputDill}=$cfeDillUri', + '${Flags.stage}=global-inference' + ] + + commonFlags); await compile([ - ...options, - '${Flags.inputDill}=$cfeDillUri', - '${Flags.readClosedWorld}=$closedWorldUri', - '${Flags.readData}=$globalDataUri', - '${Flags.writeCodegen}=$codegenUri', - '${Flags.codegenShards}=2', - '${Flags.codegenShard}=0', - ]); + ...options, + '${Flags.inputDill}=$cfeDillUri', + '${Flags.stage}=codegen', + '${Flags.codegenShard}=0', + ] + + commonFlags); await compile([ - ...options, - '${Flags.inputDill}=$cfeDillUri', - '${Flags.readClosedWorld}=$closedWorldUri', - '${Flags.readData}=$globalDataUri', - '${Flags.writeCodegen}=$codegenUri', - '${Flags.codegenShards}=2', - '${Flags.codegenShard}=1', - ]); + ...options, + '${Flags.inputDill}=$cfeDillUri', + '${Flags.stage}=codegen', + '${Flags.codegenShard}=1', + ] + + commonFlags); final output = await compile([ - ...options, - '${Flags.inputDill}=$cfeDillUri', - '${Flags.readClosedWorld}=$closedWorldUri', - '${Flags.readData}=$globalDataUri', - '${Flags.readCodegen}=$codegenUri', - '${Flags.codegenShards}=2', - '--out=$jsOutUri' - ]); + ...options, + '${Flags.inputDill}=$cfeDillUri', + '--out=$jsOutUri', + '${Flags.stage}=emit-js', + ] + + commonFlags); return output; } diff --git a/pkg/compiler/test/serialization/serialization_test_helper.dart b/pkg/compiler/test/serialization/serialization_test_helper.dart index e9e09b4bca05..d1e8d488f8d2 100644 --- a/pkg/compiler/test/serialization/serialization_test_helper.dart +++ b/pkg/compiler/test/serialization/serialization_test_helper.dart @@ -37,7 +37,7 @@ Future generateJavaScriptCode(Compiler compiler, globalTypeInferenceResults.inferredData, SourceLookup(compiler.componentForTesting), globalTypeInferenceResults.closedWorld); - if (compiler.options.dumpInfo) { + if (compiler.options.stage.emitsDumpInfo) { await compiler.runDumpInfo( codegenResults, globalTypeInferenceResults, @@ -155,7 +155,7 @@ runTest( packageConfig: packageConfig, librariesSpecificationUri: librariesSpecificationUri, outputProvider: cfeDillCollector, - options: options + ['--out=$cfeDillFileUri', Flags.cfeOnly]); + options: options + ['--out=$cfeDillFileUri', '${Flags.stage}=cfe']); Expect.isTrue(resultCfeDill.isSuccess); Expect.isTrue(cfeDillCollector.binaryOutputMap.containsKey(cfeDillFileUri)); @@ -172,7 +172,8 @@ runTest( options: options + [ '${Flags.inputDill}=$cfeDillFileUri', - '${Flags.writeClosedWorld}=$closedWorldUri' + '${Flags.closedWorldUri}=$closedWorldUri', + '${Flags.stage}=closed-world' ], outputProvider: collector3a, beforeRun: (Compiler compiler) { @@ -194,8 +195,9 @@ runTest( options: commonOptions + [ '${Flags.inputDill}=$cfeDillFileUri', - '${Flags.readClosedWorld}=$closedWorldFileUri', - '${Flags.writeData}=$globalDataUri' + '${Flags.closedWorldUri}=$closedWorldFileUri', + '${Flags.globalInferenceUri}=$globalDataUri', + '${Flags.stage}=global-inference' ], outputProvider: collector3b, beforeRun: (Compiler compiler) { @@ -230,8 +232,9 @@ runTest( options: commonOptions + [ '${Flags.inputDill}=$cfeDillFileUri', - '${Flags.readClosedWorld}=$closedWorldFileUri', - '${Flags.readData}=$globalDataFileUri', + '${Flags.closedWorldUri}=$closedWorldFileUri', + '${Flags.globalInferenceUri}=$globalDataFileUri', + '${Flags.stage}=codegen-emit-js', '--out=$jsOutUri' ], outputProvider: collector4, diff --git a/pkg/compiler/tool/modular_dart2js.dart b/pkg/compiler/tool/modular_dart2js.dart index 5ad9761f1bb0..d8d16d1046c5 100644 --- a/pkg/compiler/tool/modular_dart2js.dart +++ b/pkg/compiler/tool/modular_dart2js.dart @@ -76,18 +76,28 @@ Future main(List args) async { stopwatch.start(); if (start <= 0 && stop >= 0) { await subProcess( - baseOptions, [input, Flags.cfeOnly, '--out=$cfeOutput'], '0:\t'); + baseOptions, [input, '${Flags.stage}=cfe', '--out=$cfeOutput'], '0:\t'); } if (start <= 1 && stop >= 1) { await subProcess( baseOptions, - [cfeOutput, '--out=$dillOutput', '${Flags.writeData}=${dataOutput}'], + [ + cfeOutput, + '--out=$dillOutput', + '${Flags.closedWorldUri}=${dataOutput}', + '${Flags.stage}=closed-world' + ], '1:\t'); } if (shards <= 1) { await subProcess( baseOptions, - [dillOutput, '${Flags.readData}=${dataOutput}', '--out=${output}'], + [ + dillOutput, + '${Flags.globalInferenceUri}=${dataOutput}', + '${Flags.stage}=codegen-emit-js', + '--out=${output}' + ], '3:\t'); } else { if (start <= 2 && stop >= 2) { @@ -96,10 +106,11 @@ Future main(List args) async { for (int shard = 0; shard < shards; shard++) { additionalArguments.add([ dillOutput, - '${Flags.readData}=${dataOutput}', + '${Flags.globalInferenceUri}=${dataOutput}', '${Flags.codegenShard}=$shard', '${Flags.codegenShards}=$shards', - '${Flags.writeCodegen}=${codeOutput}' + '${Flags.codegenUri}=${codeOutput}', + '${Flags.stage}=codegen' ]); outputPrefixes.add('2:${shard + 1}/$shards\t'); } @@ -118,9 +129,10 @@ Future main(List args) async { baseOptions, [ dillOutput, - '${Flags.readData}=${dataOutput}', - '${Flags.readCodegen}=${codeOutput}', + '${Flags.globalInferenceUri}=${dataOutput}', + '${Flags.codegenUri}=${codeOutput}', '${Flags.codegenShards}=$shards', + '${Flags.stage}=emit-js', '--out=${output}' ], '3:\t'); diff --git a/pkg/compiler/tool/modular_test_suite_helper.dart b/pkg/compiler/tool/modular_test_suite_helper.dart index 4551b8f819c0..f020d33ab404 100644 --- a/pkg/compiler/tool/modular_test_suite_helper.dart +++ b/pkg/compiler/tool/modular_test_suite_helper.dart @@ -242,7 +242,7 @@ class ConcatenateDillsStep extends IOModularStep { '${Flags.inputDill}=${toUri(module, dillId)}', for (String flag in flags) '--enable-experiment=$flag', '${Flags.dillDependencies}=${dillDependencies.join(',')}', - '${Flags.cfeOnly}', + '${Flags.stage}=cfe', '--out=${toUri(module, fullDillId)}', ]; var result = @@ -294,8 +294,8 @@ class ComputeClosedWorldStep extends IOModularStep { '${Flags.entryUri}=$fakeRoot${module.mainSource}', '${Flags.inputDill}=${toUri(module, fullDillId)}', for (String flag in flags) '--enable-experiment=$flag', - '${Flags.writeClosedWorld}=${toUri(module, closedWorldId)}', - Flags.noClosedWorldInData, + '${Flags.closedWorldUri}=${toUri(module, closedWorldId)}', + '${Flags.stage}=closed-world', ]; var result = await _runProcess(Platform.resolvedExecutable, args, root.toFilePath()); @@ -341,10 +341,9 @@ class GlobalAnalysisStep extends IOModularStep { '${Flags.entryUri}=$fakeRoot${module.mainSource}', '${Flags.inputDill}=${toUri(module, fullDillId)}', for (String flag in flags) '--enable-experiment=$flag', - '${Flags.readClosedWorld}=${toUri(module, closedWorldId)}', - '${Flags.writeData}=${toUri(module, globalDataId)}', - // TODO(joshualitt): delete this flag after google3 roll - '${Flags.noClosedWorldInData}', + '${Flags.closedWorldUri}=${toUri(module, closedWorldId)}', + '${Flags.globalInferenceUri}=${toUri(module, globalDataId)}', + '${Flags.stage}=global-inference', ]; var result = await _runProcess(Platform.resolvedExecutable, args, root.toFilePath()); @@ -396,11 +395,12 @@ class Dart2jsCodegenStep extends IOModularStep { '${Flags.entryUri}=$fakeRoot${module.mainSource}', '${Flags.inputDill}=${toUri(module, fullDillId)}', for (String flag in flags) '--enable-experiment=$flag', - '${Flags.readClosedWorld}=${toUri(module, closedWorldId)}', - '${Flags.readData}=${toUri(module, globalDataId)}', - '${Flags.writeCodegen}=${toUri(module, codeId.dataId)}', + '${Flags.closedWorldUri}=${toUri(module, closedWorldId)}', + '${Flags.globalInferenceUri}=${toUri(module, globalDataId)}', + '${Flags.codegenUri}=${toUri(module, codeId.dataId)}', '${Flags.codegenShard}=${codeId.shard}', '${Flags.codegenShards}=${codeId.dataId.shards}', + '${Flags.stage}=codegen', ]; var result = await _runProcess(Platform.resolvedExecutable, args, root.toFilePath()); @@ -446,11 +446,12 @@ class Dart2jsEmissionStep extends IOModularStep { '${Flags.entryUri}=$fakeRoot${module.mainSource}', '${Flags.inputDill}=${toUri(module, fullDillId)}', for (String flag in flags) '${Flags.enableLanguageExperiments}=$flag', - '${Flags.readClosedWorld}=${toUri(module, closedWorldId)}', - '${Flags.readData}=${toUri(module, globalDataId)}', - '${Flags.readCodegen}=${toUri(module, codeId)}', + '${Flags.closedWorldUri}=${toUri(module, closedWorldId)}', + '${Flags.globalInferenceUri}=${toUri(module, globalDataId)}', + '${Flags.codegenUri}=${toUri(module, codeId)}', '${Flags.codegenShards}=${codeId.shards}', - '${Flags.writeDumpInfoData}=${toUri(module, dumpInfoDataId)}', + '${Flags.dumpInfoDataUri}=${toUri(module, dumpInfoDataId)}', + '${Flags.stage}=emit-js', '--out=${toUri(module, jsId)}', ]; var result = @@ -503,11 +504,12 @@ class Dart2jsDumpInfoStep extends IOModularStep { '${Flags.entryUri}=$fakeRoot${module.mainSource}', '${Flags.inputDill}=${toUri(module, fullDillId)}', for (String flag in flags) '${Flags.enableLanguageExperiments}=$flag', - '${Flags.readClosedWorld}=${toUri(module, closedWorldId)}', - '${Flags.readData}=${toUri(module, globalDataId)}', - '${Flags.readCodegen}=${toUri(module, codeId)}', + '${Flags.closedWorldUri}=${toUri(module, closedWorldId)}', + '${Flags.globalInferenceUri}=${toUri(module, globalDataId)}', + '${Flags.codegenUri}=${toUri(module, codeId)}', '${Flags.codegenShards}=${codeId.shards}', - '${Flags.readDumpInfoData}=${toUri(module, dumpInfoDataId)}', + '${Flags.dumpInfoDataUri}=${toUri(module, dumpInfoDataId)}', + '${Flags.stage}=dump-info', '--out=${toUri(module, jsId)}', ]; var result = From 1e8ea8a7da8be744c41aa2e7d4b12b1bc164aff9 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Tue, 2 Apr 2024 19:55:19 +0000 Subject: [PATCH 05/12] Wrap field initializers copied by TFA in a FileUriExpression. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before TFA runs, MixinFullResolution will clone a mixin's fields into the application classes for that mixin. The cloned Field on the application class will have a fileUri that refers to the original mixin file. However, TFA then copies those fields into FieldInitializers which don't have a fileUri context and so the fileUri for the surrounding Constructor is used. This leaves expressions in the initializer with offsets relative to the mixin's file but in the context of the mixin application's file. To fix this, we can wrap the initializer in a FileUriExpression referring to the original mixin class. We only do this if the field the initializer is copied from refers to a different file than the target constructor. Also add handlers for FileUriExpressions to several visitors that don't already support this new AST node. Change-Id: I47b0d48dfe87303949130a40216b199949cfa1d9 Tested: Existing test suite. Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360420 Commit-Queue: Nate Biggs Reviewed-by: Ömer Ağacan Reviewed-by: Alexander Markov --- pkg/compiler/lib/src/inferrer/builder.dart | 5 +++++ pkg/compiler/lib/src/ir/scope_visitor.dart | 5 +++++ pkg/compiler/lib/src/ssa/builder.dart | 5 +++++ pkg/dart2wasm/lib/await_transformer.dart | 3 +++ pkg/dart2wasm/lib/code_generator.dart | 6 ++++++ .../lib/transformations/type_flow/summary_collector.dart | 5 +++++ pkg/vm/lib/transformations/type_flow/transformer.dart | 8 ++++++++ 7 files changed, 37 insertions(+) diff --git a/pkg/compiler/lib/src/inferrer/builder.dart b/pkg/compiler/lib/src/inferrer/builder.dart index d6c18dd0512b..73d25eaad29f 100644 --- a/pkg/compiler/lib/src/inferrer/builder.dart +++ b/pkg/compiler/lib/src/inferrer/builder.dart @@ -2246,6 +2246,11 @@ class KernelTypeGraphBuilder extends ir.VisitorDefault return TypeInformationConstantVisitor(this, node) .visitConstant(node.constant); } + + @override + TypeInformation visitFileUriExpression(ir.FileUriExpression node) { + return visit(node.expression)!; + } } class TypeInformationConstantVisitor diff --git a/pkg/compiler/lib/src/ir/scope_visitor.dart b/pkg/compiler/lib/src/ir/scope_visitor.dart index 501c21e59c22..782dafc23139 100644 --- a/pkg/compiler/lib/src/ir/scope_visitor.dart +++ b/pkg/compiler/lib/src/ir/scope_visitor.dart @@ -1443,6 +1443,11 @@ class ScopeModelBuilder extends ir.VisitorDefault return const EvaluationComplexity.constant(); } + @override + EvaluationComplexity visitFileUriExpression(ir.FileUriExpression node) { + return visitNode(node.expression); + } + /// Returns true if the node is a field, or a constructor (factory or /// generative). bool _isFieldOrConstructor(ir.Node node) => diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart index 5d90641738ff..1c44d9158f33 100644 --- a/pkg/compiler/lib/src/ssa/builder.dart +++ b/pkg/compiler/lib/src/ssa/builder.dart @@ -6228,6 +6228,11 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault ..cleanUp(); } + @override + void visitFileUriExpression(ir.FileUriExpression node) { + node.expression.accept(this); + } + bool _tryInlineMethod( FunctionEntity function, Selector? selector, diff --git a/pkg/dart2wasm/lib/await_transformer.dart b/pkg/dart2wasm/lib/await_transformer.dart index a7f5b292c6ca..e882385a6d0a 100644 --- a/pkg/dart2wasm/lib/await_transformer.dart +++ b/pkg/dart2wasm/lib/await_transformer.dart @@ -767,6 +767,9 @@ class _ExpressionTransformer extends Transformer { @override TreeNode visitRethrow(Rethrow expr) => nullary(expr); + @override + TreeNode visitFileUriExpression(FileUriExpression expr) => unary(expr); + @override TreeNode visitVariableGet(VariableGet expr) { Expression result = expr; diff --git a/pkg/dart2wasm/lib/code_generator.dart b/pkg/dart2wasm/lib/code_generator.dart index 224258e8588f..18db4b8f43d1 100644 --- a/pkg/dart2wasm/lib/code_generator.dart +++ b/pkg/dart2wasm/lib/code_generator.dart @@ -3160,6 +3160,12 @@ class CodeGenerator extends ExpressionVisitor1 return translator.topInfo.nullableType; } + @override + w.ValueType visitFileUriExpression( + FileUriExpression node, w.ValueType expectedType) { + return wrap(node.expression, expectedType); + } + // Generates a function for a constructor's body, where the allocated struct // object is passed to this function. void generateConstructorBody(Reference target) { diff --git a/pkg/vm/lib/transformations/type_flow/summary_collector.dart b/pkg/vm/lib/transformations/type_flow/summary_collector.dart index 369572a6b37c..68cec037618f 100644 --- a/pkg/vm/lib/transformations/type_flow/summary_collector.dart +++ b/pkg/vm/lib/transformations/type_flow/summary_collector.dart @@ -2635,6 +2635,11 @@ class SummaryCollector extends RecursiveResultVisitor { _visit(node.operand); return _staticType(node); } + + @override + TypeExpr visitFileUriExpression(FileUriExpression node) { + return _visit(node.expression); + } } class RuntimeTypeTranslatorImpl diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart index 2e1f872b438a..d04c01be7d03 100644 --- a/pkg/vm/lib/transformations/type_flow/transformer.dart +++ b/pkg/vm/lib/transformations/type_flow/transformer.dart @@ -221,6 +221,14 @@ class MoveFieldInitializers { if (!isFirst) { initExpr = CloneVisitorNotMembers().clone(initExpr); } + if (c.fileUri != f.fileUri) { + if (initExpr is ConstantExpression) { + initExpr = FileUriConstantExpression(initExpr.constant, + type: initExpr.type, fileUri: f.fileUri); + } else { + initExpr = FileUriExpression(initExpr, f.fileUri); + } + } final Initializer newInit = initializedFields.contains(f) ? LocalInitializer(VariableDeclaration(null, initializer: initExpr, isSynthesized: true)) From c5218f2d4e9d1c3b971e699d73a4df4eecaa4a69 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Tue, 2 Apr 2024 19:57:25 +0000 Subject: [PATCH 06/12] [ddc] Refactor `visitFunctionTearOff` Stop passing `null` as the member parameter of `_emitPropertyGet`. Avoids the use of one method with multiple code paths and returns to handle any situation because it becomes very hard to reason about what original source code leads to each path. Issue: https://github.com/dart-lang/sdk/issues/54463 Change-Id: I1255817c7cf76578b256650789f6530b456b2f03 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357207 Reviewed-by: Srujan Gaddam Reviewed-by: Sigmund Cherem Reviewed-by: Bob Nystrom Commit-Queue: Nicholas Shahan --- pkg/dev_compiler/lib/src/kernel/compiler.dart | 39 ++++++++++++++----- .../lib/src/kernel/js_interop.dart | 31 +++++++++++++++ 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart index 45b47bcf547e..327bef9b8380 100644 --- a/pkg/dev_compiler/lib/src/kernel/compiler.dart +++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart @@ -4896,6 +4896,13 @@ class ProgramCompiler extends ComputeOnceConstantVisitor node.receiver, node.interfaceTarget, node.name.text); } + /// Returns `true` when [member] is a `.call` member (field, getter or method) + /// of a non-static JavaScript Interop class. + bool _isNonStaticJsInteropCallMember(Member? member) => + member != null && + member.name.text == 'call' && + isNonStaticJsInterop(member); + @override js_ast.Expression visitDynamicSet(DynamicSet node) { return _emitPropertySet(node.receiver, null, node.value, node.name.text); @@ -4958,16 +4965,15 @@ class ProgramCompiler extends ComputeOnceConstantVisitor // TODO(54463): Refactor and specialize this code for each type of 'get'. js_ast.Expression _emitPropertyGet( Expression receiver, Member? member, String memberName) { - // TODO(jmesserly): should tearoff of `.call` on a function type be - // encoded as a different node, or possibly eliminated? - // (Regardless, we'll still need to handle the callable JS interop classes.) - if (memberName == 'call' && - _isDirectCallable(receiver.getStaticType(_staticTypeContext))) { - // Tearoff of `call` on a function type is a no-op; - return _visitExpression(receiver); + var jsReceiver = _visitExpression(receiver); + if (_isNonStaticJsInteropCallMember(member)) { + // Historically DDC has treated this as a "callable class" and the + // tearoff of `.call` as a no-op. This is still needed here to preserve + // the existing behavior for the non-static JavaScript interop (including + // potentially failing cases). + return jsReceiver; } var jsName = _emitMemberName(memberName, member: member); - var jsReceiver = _visitExpression(receiver); // TODO(jmesserly): we need to mark an end span for property accessors so // they can be hovered. Unfortunately this is not possible as Kernel does @@ -7391,7 +7397,22 @@ class ProgramCompiler extends ComputeOnceConstantVisitor @override js_ast.Expression visitFunctionTearOff(FunctionTearOff node) { - return _emitPropertyGet(node.receiver, null, 'call'); + var receiver = node.receiver; + var receiverType = receiver.getStaticType(_staticTypeContext); + var jsReceiver = _visitExpression(receiver); + if (receiverType is InterfaceType && + receiverType.classNode == _coreTypes.functionClass) { + // Historically DDC has treated this case as a dynamic get and allowed it + // to evaluate at runtime. + // + // This is here to preserve the existing behavior for the non-static + // JavaScript interop (including some failing cases) but could potentially + // be cleaned up as a breaking change. + return runtimeCall( + 'dload$_replSuffix(#, #)', [jsReceiver, js.string('call')]); + } + // Otherwise, tearoff of `call` on a function type is a no-op. + return jsReceiver; } /// Creates header comments with helpful compilation information. diff --git a/pkg/dev_compiler/lib/src/kernel/js_interop.dart b/pkg/dev_compiler/lib/src/kernel/js_interop.dart index e6c13dacc061..5c4ef902be9a 100644 --- a/pkg/dev_compiler/lib/src/kernel/js_interop.dart +++ b/pkg/dev_compiler/lib/src/kernel/js_interop.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:_js_interop_checks/src/js_interop.dart'; import 'package:kernel/kernel.dart'; import 'kernel_helpers.dart'; @@ -158,3 +159,33 @@ bool usesJSInterop(NamedNode n) { } return false; } + +/// Returns `true` when [member] is a JavaScript interop member using the +/// package:js style of interop. +/// +/// Will return `false` when the newer static interop style is used or when +/// [member] is not a JavaScript interop member at all. +bool isNonStaticJsInterop(Member member) { + return member.isExternal && + !member.isExtensionMember && + !member.isExtensionTypeMember && + _usesNonStaticInteropAnnotation(member); +} + +/// Returns `true` when [member] is a JavaScript interop member using the +/// package:js style of interop annotation. +/// +/// This does not mean [member] has the annotation directly because it can +/// be applied on the class or the library level. +/// +/// Will return `false` when the newer static interop style annotation is +/// found or when [member] is not a JavaScript interop member at all. +bool _usesNonStaticInteropAnnotation(Member member) { + var enclosingClass = member.enclosingClass; + if (enclosingClass != null) { + return hasPackageJSAnnotation(enclosingClass) && + !hasStaticInteropAnnotation(enclosingClass); + } + return hasPackageJSAnnotation(member) || + hasPackageJSAnnotation(member.enclosingLibrary); +} From db3dda17e3f15534c58214129bc434fcebe276e9 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 2 Apr 2024 20:23:37 +0000 Subject: [PATCH 07/12] Roll webdev to 4067462c8d605266a23c3725948a0314102c95f9 Change-Id: Ifcb8fc330a0ef72bb73241994cfcafb47bb5db14 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360140 Reviewed-by: Dan Chevalier Reviewed-by: Elliott Brooks Commit-Queue: Ben Konyi Auto-Submit: Ben Konyi --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index b3fbfd0c3bb4..8468e9072d52 100644 --- a/DEPS +++ b/DEPS @@ -193,7 +193,7 @@ vars = { "watcher_rev": "1bd2f20d0d924c8422aa2b9afdb165bff4f053c0", "web_rev": "e773de957b289d001c90c6b830e91634e305667d", "web_socket_channel_rev": "19d82db86acb7309dd08c40a2af3285232751e83", - "webdev_rev": "51b5484348b4a8ede351e8dff0428b083495ba78", # https://github.com/flutter/devtools/issues/7231 + "webdev_rev": "4067462c8d605266a23c3725948a0314102c95f9", "webdriver_rev": "c80e01e6ce121e55c31e33a31e5d3950023e6bc9", "webkit_inspection_protocol_rev": "153fea4fe5ac45bebf0c2e76bb3d76b0f1fcdaae", "yaml_rev": "5a1c4be2437bc4122ccf08a3a0f06a7683e62f30", From df1361dded4f68032483d7f15889a23024ca692c Mon Sep 17 00:00:00 2001 From: Brian Wilkerson Date: Tue, 2 Apr 2024 20:31:33 +0000 Subject: [PATCH 08/12] Update the style of the AST API docs, part 1 I mostly left the documentation for the classes unchanged in this CL. I intend to improve the class docs in a second CL, but I thought it would be too much to try to do it all in one. As it is, I appologize for the size of the diff. I can break it up if it's too much to look at. Most of it is simple style updates, formatting changes, and deletion of duplicated docs on the Impl classes, but there are some places where I made more substantive changes. Change-Id: I5e92dbce8d39bd9c0bf1f804cded1b00526eb082 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360562 Commit-Queue: Brian Wilkerson Reviewed-by: Samuel Rawlins --- pkg/analyzer/lib/src/dart/ast/ast.dart | 5015 +++++++++--------------- 1 file changed, 1864 insertions(+), 3151 deletions(-) diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart index 1db20c465994..5d55d87aa171 100644 --- a/pkg/analyzer/lib/src/dart/ast/ast.dart +++ b/pkg/analyzer/lib/src/dart/ast/ast.dart @@ -29,33 +29,30 @@ import 'package:meta/meta.dart'; /// Two or more string literals that are implicitly concatenated because of /// being adjacent (separated only by whitespace). /// -/// While the grammar only allows adjacent strings when all of the strings are +/// For example +/// ```dart +/// 'Hello ' 'World' +/// ``` +/// +/// While the grammar only allows adjacent strings where all of the strings are /// of the same kind (single line or multi-line), this class doesn't enforce /// that restriction. /// /// adjacentStrings ::= /// [StringLiteral] [StringLiteral]+ abstract final class AdjacentStrings implements StringLiteral { - /// Return the strings that are implicitly concatenated. + /// The strings that are implicitly concatenated. NodeList get strings; } -/// Two or more string literals that are implicitly concatenated because of -/// being adjacent (separated only by whitespace). -/// -/// While the grammar only allows adjacent strings when all of the strings are -/// of the same kind (single line or multi-line), this class doesn't enforce -/// that restriction. -/// -/// adjacentStrings ::= -/// [StringLiteral] [StringLiteral]+ final class AdjacentStringsImpl extends StringLiteralImpl implements AdjacentStrings { - /// The strings that are implicitly concatenated. final NodeListImpl _strings = NodeListImpl._(); - /// Initialize a newly created list of adjacent strings. To be syntactically - /// valid, the list of [strings] must contain at least two elements. + /// Initializes a newly created list of adjacent strings. + /// + /// To be syntactically valid, the list of [strings] must contain at least two + /// elements. AdjacentStringsImpl({ required List strings, }) { @@ -98,37 +95,38 @@ final class AdjacentStringsImpl extends StringLiteralImpl } } -/// An AST node that can be annotated with both a documentation comment and a -/// list of annotations. +/// An AST node that can be annotated with either a documentation comment, a +/// list of annotations (metadata), or both. abstract final class AnnotatedNode implements AstNode { - /// Return the documentation comment associated with this node, or `null` if - /// this node does not have a documentation comment associated with it. + /// The documentation comment associated with this node, or `null` if this + /// node doesn't have a documentation comment associated with it. Comment? get documentationComment; - /// Return the first token following the comment and metadata. + /// The first token following the comment and metadata. Token get firstTokenAfterCommentAndMetadata; - /// Return the annotations associated with this node. + /// The annotations associated with this node. + /// + /// If there are no annotations, then the returned list is empty. NodeList get metadata; - /// Return a list containing the comment and annotations associated with this - /// node, sorted in lexical order. + /// A list containing the comment and annotations associated with this node, + /// sorted in lexical order. + /// + /// If there are neither annotations nor a comment, then the returned list is + /// empty. List get sortedCommentAndAnnotations; } -/// An AST node that can be annotated with both a documentation comment and a -/// list of annotations. sealed class AnnotatedNodeImpl extends AstNodeImpl implements AnnotatedNode { - /// The documentation comment associated with this node, or `null` if this - /// node does not have a documentation comment associated with it. CommentImpl? _comment; - /// The annotations associated with this node. final NodeListImpl _metadata = NodeListImpl._(); - /// Initialize a newly created annotated node. Either or both of the [comment] - /// and [metadata] can be `null` if the node does not have the corresponding - /// attribute. + /// Initializes a newly created annotated node. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the node + /// doesn't have the corresponding attribute. AnnotatedNodeImpl({ required CommentImpl? comment, required List? metadata, @@ -195,9 +193,10 @@ sealed class AnnotatedNodeImpl extends AstNodeImpl implements AnnotatedNode { } } - /// Return `true` if there are no annotations before the comment. Note that a - /// result of `true` does not imply that there is a comment, nor that there - /// are annotations associated with this node. + /// Returns `true` if there are no annotations before the comment. + /// + /// Note that a result of `true` doesn't imply that there's a comment, nor + /// that there are annotations associated with this node. bool _commentIsBeforeAnnotations() { if (_comment == null || _metadata.isEmpty) { return true; @@ -207,7 +206,17 @@ sealed class AnnotatedNodeImpl extends AstNodeImpl implements AnnotatedNode { } } -/// An annotation that can be associated with an AST node. +/// An annotation that can be associated with a declaration. +/// +/// For example +/// ```dart +/// @override +/// ``` +/// +/// or +/// ```dart +/// @Deprecated('1.3.2') +/// ``` /// /// metadata ::= /// annotation* @@ -220,96 +229,75 @@ sealed class AnnotatedNodeImpl extends AstNodeImpl implements AnnotatedNode { /// | qualifiedName /// | constructorDesignation argumentPart abstract final class Annotation implements AstNode { - /// Return the arguments to the constructor being invoked, or `null` if this - /// annotation is not the invocation of a constructor. + /// The arguments to the constructor being invoked, or `null` if this + /// annotation isn't the invocation of a constructor. ArgumentList? get arguments; - /// Return the at sign that introduced the annotation. + /// The at sign (`@`) that introduces the annotation. Token get atSign; - /// Return the name of the constructor being invoked, or `null` if this - /// annotation is not the invocation of a named constructor. + /// The name of the constructor being invoked, or `null` if this annotation + /// isn't the invocation of a named constructor. SimpleIdentifier? get constructorName; - /// Return the element associated with this annotation, or `null` if the AST - /// structure has not been resolved or if this annotation could not be - /// resolved. + /// The element associated with this annotation, or `null` if the AST + /// structure hasn't been resolved or if this annotation couldn't be resolved. Element? get element; - /// Return the element annotation representing this annotation in the element - /// model; `null` when the AST has not been resolved. + /// The element annotation representing this annotation in the element model, + /// or `null` if the AST hasn't been resolved. ElementAnnotation? get elementAnnotation; - /// Return the name of the class defining the constructor that is being - /// invoked or the name of the field that is being referenced. + /// The name of either the class defining the constructor that is being + /// invoked or the field that is being referenced. + /// + /// If a named constructor is being referenced, then the name of the + /// constructor is available using [constructorName]. Identifier get name; @override AstNode get parent; - /// Return the period before the constructor name, or `null` if this - /// annotation is not the invocation of a named constructor. + /// The period before the constructor name, or `null` if this annotation isn't + /// the invocation of a named constructor. Token? get period; - /// Returns the type arguments to the constructor being invoked, or `null` if - /// (a) this annotation is not the invocation of a constructor or (b) this - /// annotation does not specify type arguments explicitly. + /// The type arguments to the constructor being invoked, or `null` if either + /// this annotation isn't the invocation of a constructor or this annotation + /// doesn't specify type arguments explicitly. /// /// Note that type arguments are only valid if [Feature.generic_metadata] is /// enabled. TypeArgumentList? get typeArguments; } -/// An annotation that can be associated with an AST node. -/// -/// metadata ::= -/// annotation* -/// -/// annotation ::= -/// '@' [Identifier] ('.' [SimpleIdentifier])? [ArgumentList]? final class AnnotationImpl extends AstNodeImpl implements Annotation { - /// The at sign that introduced the annotation. @override final Token atSign; - /// The name of the class defining the constructor that is being invoked or - /// the name of the field that is being referenced. IdentifierImpl _name; - /// The type arguments to the constructor being invoked, or `null` if (a) this - /// annotation is not the invocation of a constructor or (b) this annotation - /// does not specify type arguments explicitly. - /// - /// Note that type arguments are only valid if [Feature.generic_metadata] is - /// enabled. TypeArgumentListImpl? _typeArguments; - /// The period before the constructor name, or `null` if this annotation is - /// not the invocation of a named constructor. @override final Token? period; - /// The name of the constructor being invoked, or `null` if this annotation is - /// not the invocation of a named constructor. SimpleIdentifierImpl? _constructorName; - /// The arguments to the constructor being invoked, or `null` if this - /// annotation is not the invocation of a constructor. ArgumentListImpl? _arguments; - /// The element associated with this annotation, or `null` if the AST - /// structure has not been resolved or if this annotation could not be - /// resolved. Element? _element; - /// The element annotation representing this annotation in the element model. @override ElementAnnotationImpl? elementAnnotation; - /// Initialize a newly created annotation. Both the [period] and the - /// [constructorName] can be `null` if the annotation is not referencing a - /// named constructor. The [arguments] can be `null` if the annotation is not - /// referencing a constructor. + /// Initializes a newly created annotation. + /// + /// Both the [period] and the [constructorName] can be `null` if the + /// annotation isn't referencing a named constructor. + /// + /// The [arguments] can be `null` if the annotation isn't referencing a + /// constructor. /// /// Note that type arguments are only valid if [Feature.generic_metadata] is /// enabled. @@ -384,8 +372,6 @@ final class AnnotationImpl extends AstNodeImpl implements Annotation { @override TypeArgumentListImpl? get typeArguments => _typeArguments; - /// Sets the type arguments to the constructor being invoked to the given - /// [typeArguments]. set typeArguments(TypeArgumentListImpl? typeArguments) { _typeArguments = _becomeParentOf(typeArguments); } @@ -423,50 +409,42 @@ final class AnnotationImpl extends AstNodeImpl implements Annotation { /// [NamedExpression] (',' [NamedExpression])* /// | [Expression] (',' [Expression])* (',' [NamedExpression])* abstract final class ArgumentList implements AstNode { - /// Return the expressions producing the values of the arguments. + /// The expressions producing the values of the arguments. + /// + /// If there are no arguments the list will be empty. /// /// Although the language requires that positional arguments appear before - /// named arguments, this class allows them to be intermixed. + /// named arguments unless the [Feature.named_arguments_anywhere] is enabled, + /// this class allows them to be intermixed. NodeList get arguments; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; } -/// A list of arguments in the invocation of an executable element (that is, a -/// function, method, or constructor). -/// -/// argumentList ::= -/// '(' arguments? ')' -/// -/// arguments ::= -/// [NamedExpression] (',' [NamedExpression])* -/// | [Expression] (',' [Expression])* (',' [NamedExpression])* final class ArgumentListImpl extends AstNodeImpl implements ArgumentList { - /// The left parenthesis. @override final Token leftParenthesis; - /// The expressions producing the values of the arguments. final NodeListImpl _arguments = NodeListImpl._(); - /// The right parenthesis. @override final Token rightParenthesis; /// A list containing the elements representing the parameters corresponding - /// to each of the arguments in this list, or `null` if the AST has not been - /// resolved or if the function or method being invoked could not be - /// determined based on static type information. The list must be the same - /// length as the number of arguments, but can contain `null` entries if a - /// given argument does not correspond to a formal parameter. + /// to each of the arguments in this list, or `null` if the AST hasn't been + /// resolved or if the function or method being invoked couldn't be + /// determined based on static type information. + /// + /// The list must be the same length as the number of arguments, but can + /// contain `null` entries if a given argument doesn't correspond to a formal + /// parameter. List? _correspondingStaticParameters; - /// Initialize a newly created list of arguments. The list of [arguments] can - /// be `null` if there are no arguments. + /// Initializes a newly created list of arguments. ArgumentListImpl({ required this.leftParenthesis, required List arguments, @@ -510,20 +488,19 @@ final class ArgumentListImpl extends AstNodeImpl implements ArgumentList { _arguments.accept(visitor); } - /// If - /// * the given [expression] is a child of this list, - /// * the AST structure has been resolved, - /// * the function being invoked is known based on static type information, - /// and - /// * the expression corresponds to one of the parameters of the function - /// being invoked, - /// then return the parameter element representing the parameter to which the - /// value of the given expression will be bound. Otherwise, return `null`. + /// Returns the parameter element representing the parameter to which the + /// value of the given expression is bound, or `null` if any of the following + /// are not true + /// - the given [expression] is a child of this list + /// - the AST structure is resolved + /// - the function being invoked is known based on static type information + /// - the expression corresponds to one of the parameters of the function + /// being invoked ParameterElement? _getStaticParameterElementFor(Expression expression) { if (_correspondingStaticParameters == null || _correspondingStaticParameters!.length != _arguments.length) { - // Either the AST structure has not been resolved, the invocation of which - // this list is a part could not be resolved, or the argument list was + // Either the AST structure hasn't been resolved, the invocation of which + // this list is a part couldn't be resolved, or the argument list was // modified after the parameters were set. return null; } @@ -541,32 +518,25 @@ final class ArgumentListImpl extends AstNodeImpl implements ArgumentList { /// asExpression ::= /// [Expression] 'as' [TypeAnnotation] abstract final class AsExpression implements Expression { - /// Return the 'as' operator. + /// The `as` operator. Token get asOperator; - /// Return the expression used to compute the value being cast. + /// The expression used to compute the value being cast. Expression get expression; - /// Return the type being cast to. + /// The type being cast to. TypeAnnotation get type; } -/// An as expression. -/// -/// asExpression ::= -/// [Expression] 'as' [NamedType] final class AsExpressionImpl extends ExpressionImpl implements AsExpression { - /// The expression used to compute the value being cast. ExpressionImpl _expression; - /// The 'as' operator. @override final Token asOperator; - /// The type being cast to. TypeAnnotationImpl _type; - /// Initialize a newly created as expression. + /// Initializes a newly created as expression. AsExpressionImpl({ required ExpressionImpl expression, required this.asOperator, @@ -628,10 +598,6 @@ final class AsExpressionImpl extends ExpressionImpl implements AsExpression { abstract final class AssertInitializer implements Assertion, ConstructorInitializer {} -/// An assert in the initializer list of a constructor. -/// -/// assertInitializer ::= -/// 'assert' '(' [Expression] (',' [Expression])? ')' final class AssertInitializerImpl extends ConstructorInitializerImpl implements AssertInitializer { @override @@ -640,20 +606,17 @@ final class AssertInitializerImpl extends ConstructorInitializerImpl @override final Token leftParenthesis; - /// The condition that is being asserted to be `true`. ExpressionImpl _condition; @override final Token? comma; - /// The message to report if the assertion fails, or `null` if no message was - /// supplied. ExpressionImpl? _message; @override final Token rightParenthesis; - /// Initialize a newly created assert initializer. + /// Initializes a newly created assert initializer. AssertInitializerImpl({ required this.assertKeyword, required this.leftParenthesis, @@ -708,24 +671,24 @@ final class AssertInitializerImpl extends ConstructorInitializerImpl /// An assertion, either in a block or in the initializer list of a constructor. abstract final class Assertion implements AstNode { - /// Return the token representing the 'assert' keyword. + /// The token representing the `assert` keyword. Token get assertKeyword; - /// Return the comma between the [condition] and the [message], or `null` if - /// no message was supplied. + /// The comma between the [condition] and the [message], or `null` if no + /// message was supplied. Token? get comma; - /// Return the condition that is being asserted to be `true`. + /// The condition that is being asserted to be `true`. Expression get condition; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the message to report if the assertion fails, or `null` if no - /// message was supplied. + /// The message to report if the assertion fails, or `null` if no message was + /// supplied. Expression? get message; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; } @@ -734,14 +697,10 @@ abstract final class Assertion implements AstNode { /// assertStatement ::= /// 'assert' '(' [Expression] (',' [Expression])? ')' ';' abstract final class AssertStatement implements Assertion, Statement { - /// Return the semicolon terminating the statement. + /// The semicolon terminating the statement. Token get semicolon; } -/// An assert statement. -/// -/// assertStatement ::= -/// 'assert' '(' [Expression] ')' ';' final class AssertStatementImpl extends StatementImpl implements AssertStatement { @override @@ -750,14 +709,11 @@ final class AssertStatementImpl extends StatementImpl @override final Token leftParenthesis; - /// The condition that is being asserted to be `true`. ExpressionImpl _condition; @override final Token? comma; - /// The message to report if the assertion fails, or `null` if no message was - /// supplied. ExpressionImpl? _message; @override @@ -766,7 +722,7 @@ final class AssertStatementImpl extends StatementImpl @override final Token semicolon; - /// Initialize a newly created assert statement. + /// Initializes a newly created assert statement. AssertStatementImpl({ required this.assertKeyword, required this.leftParenthesis, @@ -825,16 +781,14 @@ final class AssertStatementImpl extends StatementImpl /// /// variablePattern ::= identifier abstract final class AssignedVariablePattern implements VariablePattern { - /// Return the element referenced by this pattern, or `null` if either - /// [name] does not resolve to an element, or the AST structure has not - /// been resolved. In valid code this will be either [LocalVariableElement] - /// or [ParameterElement]. + /// The element referenced by this pattern, or `null` if either [name] doesn't + /// resolve to an element or the AST structure hasn't been resolved. + /// + /// In valid code this is either a [LocalVariableElement] or a + /// [ParameterElement]. Element? get element; } -/// A variable pattern in [PatternAssignment]. -/// -/// variablePattern ::= identifier final class AssignedVariablePatternImpl extends VariablePatternImpl implements AssignedVariablePattern { @override @@ -894,41 +848,30 @@ abstract final class AssignmentExpression NullShortableExpression, MethodReferenceExpression, CompoundAssignmentExpression { - /// Return the expression used to compute the left hand side. + /// The expression used to compute the left hand side. Expression get leftHandSide; - /// Return the assignment operator being applied. + /// The assignment operator being applied. Token get operator; - /// Return the expression used to compute the right hand side. + /// The expression used to compute the right-hand side. Expression get rightHandSide; } -/// An assignment expression. -/// -/// assignmentExpression ::= -/// [Expression] operator [Expression] final class AssignmentExpressionImpl extends ExpressionImpl with NullShortableExpressionImpl, CompoundAssignmentExpressionImpl implements AssignmentExpression { - /// The expression used to compute the left hand side. ExpressionImpl _leftHandSide; - /// The assignment operator being applied. @override final Token operator; - /// The expression used to compute the right hand side. ExpressionImpl _rightHandSide; - /// The element associated with the operator based on the static type of the - /// left-hand-side, or `null` if the AST structure has not been resolved, if - /// the operator is not a compound operator, or if the operator could not be - /// resolved. @override MethodElement? staticElement; - /// Initialize a newly created assignment expression. + /// Initializes a newly created assignment expression. AssignmentExpressionImpl({ required ExpressionImpl leftHandSide, required this.operator, @@ -971,10 +914,9 @@ final class AssignmentExpressionImpl extends ExpressionImpl @override AstNode? get _nullShortingExtensionCandidate => parent; - /// If the AST structure has been resolved, and the function being invoked is - /// known based on static type information, then return the parameter element - /// representing the parameter to which the value of the right operand will be - /// bound. Otherwise, return `null`. + /// The parameter element representing the parameter to which the value of the + /// right operand is bound, or `null` if the AST structure is not resolved or + /// the function being invoked is not known based on static type information. ParameterElement? get _staticParameterElementForRightHandSide { Element? executableElement; if (operator.type != TokenType.EQ) { @@ -1021,35 +963,35 @@ final class AssignmentExpressionImpl extends ExpressionImpl abstract final class AstNode implements SyntacticEntity { /// A comparator that can be used to sort AST nodes in lexical order. /// - /// In other words, `compare` will return a negative value if the offset of - /// the first node is less than the offset of the second node, zero (0) if - /// the nodes have the same offset, and a positive value if the offset of the + /// In other words, `compare` returns a negative value if the offset of the + /// first node is less than the offset of the second node, zero (0) if the + /// nodes have the same offset, and a positive value if the offset of the /// first node is greater than the offset of the second node. static Comparator LEXICAL_ORDER = (AstNode first, AstNode second) => first.offset - second.offset; - /// Return the first token included in this node's source range. + /// The first token included in this node's source range. Token get beginToken; - /// Return an iterator that can be used to iterate through all the entities - /// (either AST nodes or tokens) that make up the contents of this node, - /// including doc comments but excluding other comments. + /// An iterator that can be used to iterate through all the entities (either + /// AST nodes or tokens) that make up the contents of this node, including doc + /// comments but excluding other comments. Iterable get childEntities; - /// Return the offset of the character immediately following the last - /// character of this node's source range. + /// The offset of the character immediately following the last character of + /// this node's source range. /// /// This is equivalent to `node.offset + node.length`. For a compilation unit - /// this will be equal to the length of the unit's source. For synthetic nodes - /// this will be equivalent to the node's offset (because the length is zero - /// (0) by definition). + /// this is equal to the length of the unit's source. For synthetic nodes this + /// is equivalent to the node's offset (because the length is zero (`0`) by + /// definition). @override int get end; - /// Return the last token included in this node's source range. + /// The last token included in this node's source range. Token get endToken; - /// Return `true` if this node is a synthetic node. + /// Whether this node is a synthetic node. /// /// A synthetic node is a node that was introduced by the parser in order to /// recover from an error in the code. Synthetic nodes always have a length @@ -1062,14 +1004,14 @@ abstract final class AstNode implements SyntacticEntity { @override int get offset; - /// Return this node's parent node, or `null` if this node is the root of an + /// Returns this node's parent node, or `null` if this node is the root of an /// AST structure. /// /// Note that the relationship between an AST node and its parent node may /// change over the lifetime of a node. AstNode? get parent; - /// Return the node at the root of this node's AST structure. + /// The node at the root of this node's AST structure. /// /// Note that this method's performance is linear with respect to the depth /// of the node in the AST structure (O(depth)). @@ -1077,52 +1019,64 @@ abstract final class AstNode implements SyntacticEntity { /// Use the given [visitor] to visit this node. /// - /// Return the value returned by the visitor as a result of visiting this + /// Returns the value returned by the visitor as a result of visiting this /// node. E? accept(AstVisitor visitor); - /// Return the token before [target] or `null` if it cannot be found. + /// Returns the token before [target], or `null` if it can't be found. Token? findPrevious(Token target); - /// Return the value of the property with the given [name], or `null` if this - /// node does not have a property with the given name. + /// Returns the value of the property with the given [name], or `null` if this + /// node doesn't have a property with the given name. E? getProperty(String name); /// Set the value of the property with the given [name] to the given [value]. - /// If the value is `null`, the property will effectively be removed. + /// + /// If the value is `null`, the property is removed. void setProperty(String name, Object? value); - /// Return either this node or the most immediate ancestor of this node for - /// which the [predicate] returns `true`, or `null` if there is no such node. + /// Returns either this node or the most immediate ancestor of this node for + /// which the [predicate] returns `true`, or `null` if there's no such node. E? thisOrAncestorMatching( bool Function(AstNode) predicate, ); - /// Return either this node or the most immediate ancestor of this node that - /// has the given type, or `null` if there is no such node. + /// Returns either this node or the most immediate ancestor of this node that + /// has the given type, or `null` if there's no such node. E? thisOrAncestorOfType(); - /// Return a textual description of this node in a form approximating valid + /// Returns a textual description of this node in a form approximating valid /// source. /// - /// The returned string will not be valid source primarily in the case where - /// the node itself is not well-formed. + /// The returned string isn't valid source code primarily in the case where + /// the node itself isn't well-formed. + /// + /// Clients should never depend on the returned value being valid code, nor + /// being consistent from one version of the package to the next. As a result, + /// clients should never display the returned string to users. String toSource(); + /// Returns a textual description of this node. + /// + /// The returned string is intended to be useful only for debugging. + /// + /// Clients should never depend on the returned value being useful for any + /// purpose, nor being consistent from one version of the package to the next. + /// As a result, clients should never display the returned string to users. + @override + String toString(); + /// Use the given [visitor] to visit all of the children of this node. /// - /// The children will be visited in lexical order. + /// The children are visited in lexical order. void visitChildren(AstVisitor visitor); } -/// A node in the AST structure for a Dart program. sealed class AstNodeImpl implements AstNode { - /// The parent of the node, or `null` if the node is the root of an AST - /// structure. AstNode? _parent; /// A table mapping the names of properties to their values, or `null` if this - /// node does not have any properties associated with it. + /// node doesn't have any properties associated with it. Map? _propertyMap; @override @@ -1142,9 +1096,9 @@ sealed class AstNodeImpl implements AstNode { return endToken.offset + endToken.length - beginToken.offset; } - /// Return properties (tokens and nodes) of this node, with names, in the - /// order in which these entities should normally appear, not necessary in - /// the order they really are (because of recovery). + /// The properties (tokens and nodes) of this node, with names, in the order + /// in which these entities should normally appear, not necessarily in the + /// order they really are (because of recovery). Iterable get namedChildEntities => _childEntities.entities; @override @@ -1227,7 +1181,7 @@ sealed class AstNodeImpl implements AstNode { @override String toString() => toSource(); - /// Make this node the parent of the given [child] node. Return the child + /// Returns the [child] node after making this node the parent of the [child] /// node. T _becomeParentOf(T child) { child?._parent = this; @@ -1241,10 +1195,10 @@ sealed class AstNodeImpl implements AstNode { /// that implement this interface that provide useful default behaviors in /// `package:analyzer/dart/ast/visitor.dart`. A couple of the most useful /// include -/// * SimpleAstVisitor which implements every visit method by doing nothing, -/// * RecursiveAstVisitor which will cause every node in a structure to be -/// visited, and -/// * ThrowingAstVisitor which implements every visit method by throwing an +/// - SimpleAstVisitor which implements every visit method by doing nothing, +/// - RecursiveAstVisitor which causes every node in a structure to be visited, +/// and +/// - ThrowingAstVisitor which implements every visit method by throwing an /// exception. abstract class AstVisitor { R? visitAdjacentStrings(AdjacentStrings node); @@ -1599,23 +1553,19 @@ abstract class AstVisitor { /// [Annotation] 'import' 'augment' [StringLiteral] ';' @experimental abstract final class AugmentationImportDirective implements UriBasedDirective { - /// The token representing the 'augment' keyword. + /// The token representing the `augment` keyword. Token get augmentKeyword; @override AugmentationImportElement? get element; - /// The token representing the 'import' keyword. + /// The token representing the `import` keyword. Token get importKeyword; - /// Return the semicolon terminating the directive. + /// The semicolon terminating the directive. Token get semicolon; } -/// An augmentation import directive. -/// -/// importDirective ::= -/// [Annotation] 'import' 'augment' [StringLiteral] ';' final class AugmentationImportDirectiveImpl extends UriBasedDirectiveImpl implements AugmentationImportDirective { @override @@ -1667,27 +1617,21 @@ final class AugmentationImportDirectiveImpl extends UriBasedDirectiveImpl /// awaitExpression ::= /// 'await' [Expression] abstract final class AwaitExpression implements Expression { - /// Return the 'await' keyword. + /// The `await` keyword. Token get awaitKeyword; - /// Return the expression whose value is being waited on. + /// The expression whose value is being waited on. Expression get expression; } -/// An await expression. -/// -/// awaitExpression ::= -/// 'await' [Expression] final class AwaitExpressionImpl extends ExpressionImpl implements AwaitExpression { - /// The 'await' keyword. @override final Token awaitKeyword; - /// The expression whose value is being waited on. ExpressionImpl _expression; - /// Initialize a newly created await expression. + /// Initializes a newly created await expression. AwaitExpressionImpl({ required this.awaitKeyword, required ExpressionImpl expression, @@ -1738,46 +1682,36 @@ final class AwaitExpressionImpl extends ExpressionImpl /// [Expression] [Token] [Expression] abstract final class BinaryExpression implements Expression, MethodReferenceExpression { - /// Return the expression used to compute the left operand. + /// The expression used to compute the left operand. Expression get leftOperand; - /// Return the binary operator being applied. + /// The binary operator being applied. Token get operator; - /// Return the expression used to compute the right operand. + /// The expression used to compute the right operand. Expression get rightOperand; - /// The function type of the invocation, or `null` if the AST structure has - /// not been resolved, or if the invocation could not be resolved. + /// The function type of the invocation, or `null` if the AST structure hasn't + /// been resolved or if the invocation couldn't be resolved. FunctionType? get staticInvokeType; } -/// A binary (infix) expression. -/// -/// binaryExpression ::= -/// [Expression] [Token] [Expression] final class BinaryExpressionImpl extends ExpressionImpl implements BinaryExpression { - /// The expression used to compute the left operand. ExpressionImpl _leftOperand; - /// The binary operator being applied. @override final Token operator; - /// The expression used to compute the right operand. ExpressionImpl _rightOperand; - /// The element associated with the operator based on the static type of the - /// left operand, or `null` if the AST structure has not been resolved, if the - /// operator is not user definable, or if the operator could not be resolved. @override MethodElement? staticElement; @override FunctionType? staticInvokeType; - /// Initialize a newly created binary expression. + /// Initializes a newly created binary expression. BinaryExpressionImpl({ required ExpressionImpl leftOperand, required this.operator, @@ -1837,13 +1771,13 @@ final class BinaryExpressionImpl extends ExpressionImpl /// block ::= /// '{' statement* '}' abstract final class Block implements Statement { - /// Return the left curly bracket. + /// The left curly bracket. Token get leftBracket; - /// Return the right curly bracket. + /// The right curly bracket. Token get rightBracket; - /// Return the statements contained in the block. + /// The statements contained in the block. NodeList get statements; } @@ -1852,33 +1786,27 @@ abstract final class Block implements Statement { /// blockFunctionBody ::= /// ('async' | 'async' '*' | 'sync' '*')? [Block] abstract final class BlockFunctionBody implements FunctionBody { - /// Return the block representing the body of the function. + /// The block representing the body of the function. Block get block; } -/// A function body that consists of a block of statements. -/// -/// blockFunctionBody ::= -/// ('async' | 'async' '*' | 'sync' '*')? [Block] final class BlockFunctionBodyImpl extends FunctionBodyImpl implements BlockFunctionBody { - /// The token representing the 'async' or 'sync' keyword, or `null` if there - /// is no such keyword. @override final Token? keyword; - /// The star optionally following the 'async' or 'sync' keyword, or `null` if - /// there is wither no such keyword or no star. @override final Token? star; - /// The block representing the body of the function. BlockImpl _block; - /// Initialize a newly created function body consisting of a block of - /// statements. The [keyword] can be `null` if there is no keyword specified - /// for the block. The [star] can be `null` if there is no star following the - /// keyword (and must be `null` if there is no keyword). + /// Initializes a newly created function body consisting of a block of + /// statements. + /// + /// The [keyword] can be `null` if there's no keyword specified for the block. + /// + /// The [star] can be `null` if there's no star following the keyword (and + /// must be `null` if there's no keyword). BlockFunctionBodyImpl({ required this.keyword, required this.star, @@ -1933,23 +1861,16 @@ final class BlockFunctionBodyImpl extends FunctionBodyImpl } } -/// A sequence of statements. -/// -/// block ::= -/// '{' statement* '}' final class BlockImpl extends StatementImpl implements Block { - /// The left curly bracket. @override final Token leftBracket; - /// The statements contained in the block. final NodeListImpl _statements = NodeListImpl._(); - /// The right curly bracket. @override final Token rightBracket; - /// Initialize a newly created block of code. + /// Initializes a newly created block of code. BlockImpl({ required this.leftBracket, required List statements, @@ -1987,27 +1908,21 @@ final class BlockImpl extends StatementImpl implements Block { /// booleanLiteral ::= /// 'false' | 'true' abstract final class BooleanLiteral implements Literal { - /// Return the token representing the literal. + /// The token representing the literal. Token get literal; - /// Return the value of the literal. + /// The value of the literal. bool get value; } -/// A boolean literal expression. -/// -/// booleanLiteral ::= -/// 'false' | 'true' final class BooleanLiteralImpl extends LiteralImpl implements BooleanLiteral { - /// The token representing the literal. @override final Token literal; - /// The value of the literal. @override final bool value; - /// Initialize a newly created boolean literal. + /// Initializes a newly created boolean literal. BooleanLiteralImpl({ required this.literal, required this.value, @@ -2045,55 +1960,45 @@ final class BooleanLiteralImpl extends LiteralImpl implements BooleanLiteral { /// breakStatement ::= /// 'break' [SimpleIdentifier]? ';' abstract final class BreakStatement implements Statement { - /// Return the token representing the 'break' keyword. + /// The token representing the `break` keyword. Token get breakKeyword; - /// Return the label associated with the statement, or `null` if there is no - /// label. + /// The label associated with the statement, or `null` if there's no label. SimpleIdentifier? get label; - /// Return the semicolon terminating the statement. + /// The semicolon terminating the statement. Token get semicolon; - /// Return the node from which this break statement is breaking. + /// The node from which this break statement is breaking, or `null` if the AST + /// hasn't yet been resolved or if the target couldn't be resolved. + /// + /// This is either a [Statement] (in the case of breaking out of a loop), a + /// [SwitchMember] (in the case of a labeled break statement whose label + /// matches a label on a switch case in an enclosing switch statement). /// - /// This will be either a [Statement] (in the case of breaking out of a - /// loop), a [SwitchMember] (in the case of a labeled break statement whose - /// label matches a label on a switch case in an enclosing switch statement), - /// or `null` if the AST has not yet been resolved or if the target could not - /// be resolved. Note that if the source code has errors, the target might be - /// invalid (e.g. trying to break to a switch case). + /// Note that if the source code has errors, the target might be invalid. + /// For example, if the break statement is trying to break to a switch case + /// the target will be the switch case even though breaking to a switch case + /// isn't valid. AstNode? get target; } -/// A break statement. -/// -/// breakStatement ::= -/// 'break' [SimpleIdentifier]? ';' final class BreakStatementImpl extends StatementImpl implements BreakStatement { - /// The token representing the 'break' keyword. @override final Token breakKeyword; - /// The label associated with the statement, or `null` if there is no label. SimpleIdentifierImpl? _label; - /// The semicolon terminating the statement. @override final Token semicolon; - /// The AstNode which this break statement is breaking from. This will be - /// either a [Statement] (in the case of breaking out of a loop), a - /// [SwitchMember] (in the case of a labeled break statement whose label - /// matches a label on a switch case in an enclosing switch statement), or - /// `null` if the AST has not yet been resolved or if the target could not be - /// resolved. Note that if the source code has errors, the target might be - /// invalid (e.g. trying to break to a switch case). @override AstNode? target; - /// Initialize a newly created break statement. The [label] can be `null` if - /// there is no label associated with the statement. + /// Initializes a newly created break statement. + /// + /// The [label] can be `null` if there's no label associated with the + /// statement. BreakStatementImpl({ required this.breakKeyword, required SimpleIdentifierImpl? label, @@ -2148,41 +2053,26 @@ final class BreakStatementImpl extends StatementImpl implements BreakStatement { /// | identifier abstract final class CascadeExpression implements Expression, NullShortableExpression { - /// Return the cascade sections sharing the common target. + /// The cascade sections sharing the common target. NodeList get cascadeSections; /// Whether this cascade is null aware (as opposed to non-null). bool get isNullAware; - /// Return the target of the cascade sections. + /// The target of the cascade sections. Expression get target; } -/// A sequence of cascaded expressions: expressions that share a common target. -/// There are three kinds of expressions that can be used in a cascade -/// expression: [IndexExpression], [MethodInvocation] and [PropertyAccess]. -/// -/// cascadeExpression ::= -/// [Expression] cascadeSection* -/// -/// cascadeSection ::= -/// '..' (cascadeSelector arguments*) (assignableSelector arguments*)* -/// (assignmentOperator expressionWithoutCascade)? -/// -/// cascadeSelector ::= -/// '[ ' expression '] ' -/// | identifier final class CascadeExpressionImpl extends ExpressionImpl with NullShortableExpressionImpl implements CascadeExpression { - /// The target of the cascade sections. ExpressionImpl _target; - /// The cascade sections sharing the common target. final NodeListImpl _cascadeSections = NodeListImpl._(); - /// Initialize a newly created cascade expression. The list of - /// [cascadeSections] must contain at least one element. + /// Initializes a newly created cascade expression. + /// + /// The list of [cascadeSections] must contain at least one element. CascadeExpressionImpl({ required ExpressionImpl target, required List cascadeSections, @@ -2248,17 +2138,13 @@ final class CascadeExpressionImpl extends ExpressionImpl /// caseClause ::= /// 'case' [GuardedPattern] abstract final class CaseClause implements AstNode { - /// Return the token representing the 'case' keyword. + /// The token representing the `case` keyword. Token get caseKeyword; - /// Return the pattern controlling whether the statements will be executed. + /// The pattern controlling whether the statements are executed. GuardedPattern get guardedPattern; } -/// The `case` clause that can optionally appear in an `if` statement. -/// -/// caseClause ::= -/// 'case' [DartPattern] [WhenClause]? final class CaseClauseImpl extends AstNodeImpl implements CaseClause { @override final Token caseKeyword; @@ -2301,17 +2187,13 @@ abstract final class CastPattern implements DartPattern { /// The `as` token. Token get asToken; - /// The pattern whose matched value will be cast. + /// The pattern used to match the value being cast. DartPattern get pattern; /// The type that the value being matched is cast to. TypeAnnotation get type; } -/// A cast pattern. -/// -/// castPattern ::= -/// [DartPattern] 'as' [TypeAnnotation] final class CastPatternImpl extends DartPatternImpl implements CastPattern { @override final Token asToken; @@ -2395,91 +2277,71 @@ final class CastPatternImpl extends DartPatternImpl implements CastPattern { /// catchPart ::= /// 'catch' '(' [CatchClauseParameter] (',' [CatchClauseParameter])? ')' abstract final class CatchClause implements AstNode { - /// Return the body of the catch block. + /// The body of the catch block. Block get body; - /// Return the token representing the 'catch' keyword, or `null` if there is - /// no 'catch' keyword. + /// The token representing the `catch` keyword, or `null` if there's no + /// `catch` keyword. Token? get catchKeyword; - /// Return the comma separating the exception parameter from the stack trace - /// parameter, or `null` if there is no stack trace parameter. + /// The comma separating the exception parameter from the stack trace + /// parameter, or `null` if there's no stack trace parameter. Token? get comma; - /// Return the parameter whose value will be the exception that was thrown, or - /// `null` if there is no 'catch' keyword. + /// The parameter whose value is the exception that was thrown, or `null` if + /// there's no `catch` keyword. CatchClauseParameter? get exceptionParameter; - /// Return the type of exceptions caught by this catch clause, or `null` if - /// this catch clause catches every type of exception. + /// The type of exceptions caught by this catch clause, or `null` if this + /// catch clause catches every type of exception. TypeAnnotation? get exceptionType; - /// Return the left parenthesis, or `null` if there is no 'catch' keyword. + /// The left parenthesis, or `null` if there's no `catch` keyword. Token? get leftParenthesis; - /// Return the token representing the 'on' keyword, or `null` if there is no - /// 'on' keyword. + /// The token representing the `on` keyword, or `null` if there's no `on` + /// keyword. Token? get onKeyword; - /// Return the right parenthesis, or `null` if there is no 'catch' keyword. + /// The right parenthesis, or `null` if there's no `catch` keyword. Token? get rightParenthesis; - /// Return the parameter whose value will be the stack trace associated with - /// the exception, or `null` if there is no stack trace parameter. + /// The parameter whose value is the stack trace associated with the + /// exception, or `null` if there's no stack trace parameter. CatchClauseParameter? get stackTraceParameter; } -/// A catch clause within a try statement. -/// -/// onPart ::= -/// catchPart [Block] -/// | 'on' type catchPart? [Block] -/// -/// catchPart ::= -/// 'catch' '(' [SimpleIdentifier] (',' [SimpleIdentifier])? ')' final class CatchClauseImpl extends AstNodeImpl implements CatchClause { - /// The token representing the 'on' keyword, or `null` if there is no 'on' - /// keyword. @override final Token? onKeyword; - /// The type of exceptions caught by this catch clause, or `null` if this - /// catch clause catches every type of exception. TypeAnnotationImpl? _exceptionType; - /// The token representing the 'catch' keyword, or `null` if there is no - /// 'catch' keyword. @override final Token? catchKeyword; - /// The left parenthesis, or `null` if there is no 'catch' keyword. @override final Token? leftParenthesis; - /// The parameter whose value will be the exception that was thrown, or `null` - /// if there is no 'catch' keyword. CatchClauseParameterImpl? _exceptionParameter; - /// The comma separating the exception parameter from the stack trace - /// parameter, or `null` if there is no stack trace parameter. @override final Token? comma; - /// The parameter whose value will be the stack trace associated with the - /// exception, or `null` if there is no stack trace parameter. CatchClauseParameterImpl? _stackTraceParameter; - /// The right parenthesis, or `null` if there is no 'catch' keyword. @override final Token? rightParenthesis; - /// The body of the catch block. BlockImpl _body; - /// Initialize a newly created catch clause. The [onKeyword] and - /// [exceptionType] can be `null` if the clause will catch all exceptions. The - /// [comma] and [_stackTraceParameter] can be `null` if the stack trace - /// parameter is not defined. + /// Initializes a newly created catch clause. + /// + /// The [onKeyword] and [exceptionType] can be `null` if the clause is to + /// catch all exceptions. + /// + /// The [comma] and [_stackTraceParameter] can be `null` if the stack trace + /// parameter isn't defined. CatchClauseImpl({ required this.onKeyword, required TypeAnnotationImpl? exceptionType, @@ -2570,9 +2432,9 @@ final class CatchClauseImpl extends AstNodeImpl implements CatchClause { } } -/// The 'exception' or 'stackTrace' parameter in [CatchClause]. +/// An 'exception' or 'stackTrace' parameter in [CatchClause]. abstract final class CatchClauseParameter extends AstNode { - /// The declared element, or `null` if the AST has not been resolved. + /// The declared element, or `null` if the AST hasn't been resolved. LocalVariableElement? get declaredElement; /// The name of the parameter. @@ -2610,7 +2472,7 @@ final class CatchClauseParameterImpl extends AstNodeImpl void visitChildren(AstVisitor visitor) {} } -/// Helper class to allow iteration of child entities of an AST node. +/// A helper class to allow iteration of child entities of an AST node. class ChildEntities { /// The list of child entities to be iterated over. final List entities = []; @@ -2699,67 +2561,65 @@ class ChildEntity { /// | 'abstract'? ('base' | 'interface' | 'final')? /// | 'abstract'? 'base'? 'mixin' abstract final class ClassDeclaration implements NamedCompilationUnitMember { - /// Return the 'abstract' keyword, or `null` if the keyword was absent. - /// - /// In valid code only [ClassDeclaration] can specify it. + /// The `abstract` keyword, or `null` if the keyword was absent. Token? get abstractKeyword; - /// Return the 'augment' keyword, or `null` if the keyword was absent. + /// The `augment` keyword, or `null` if the keyword was absent. @experimental Token? get augmentKeyword; - /// Return the 'base' keyword, or `null` if the keyword was absent. + /// The `base` keyword, or `null` if the keyword was absent. Token? get baseKeyword; - /// Returns the token representing the 'class' keyword. + /// The token representing the `class` keyword. Token get classKeyword; @override ClassElement? get declaredElement; - /// Returns the `extends` clause for this class, or `null` if the class - /// does not extend any other class. + /// The `extends` clause for this class, or `null` if the class doesn't extend + /// any other class. ExtendsClause? get extendsClause; - /// Return the 'final' keyword, or `null` if the keyword was absent. + /// The `final` keyword, or `null` if the keyword was absent. Token? get finalKeyword; - /// Returns the `implements` clause for the class, or `null` if the class - /// does not implement any interfaces. + /// The `implements` clause for the class, or `null` if the class doesn't + /// implement any interfaces. ImplementsClause? get implementsClause; - /// Return the 'interface' keyword, or `null` if the keyword was absent. + /// The `interface` keyword, or `null` if the keyword was absent. Token? get interfaceKeyword; - /// Returns the left curly bracket. + /// The left curly bracket. Token get leftBracket; - /// Return the 'macro' keyword, or `null` if the keyword was absent. + /// The `macro` keyword, or `null` if the keyword was absent. @experimental Token? get macroKeyword; - /// Returns the members defined by the class. + /// The members defined by the class. NodeList get members; - /// Return the 'mixin' keyword, or `null` if the keyword was absent. + /// The `mixin` keyword, or `null` if the keyword was absent. Token? get mixinKeyword; - /// Return the native clause for this class, or `null` if the class does not - /// have a native clause. + /// The native clause for this class, or `null` if the class doesn't have a + /// native clause. NativeClause? get nativeClause; - /// Returns the right curly bracket. + /// The right curly bracket. Token get rightBracket; - /// Return the 'sealed' keyword, or `null` if the keyword was absent. + /// The `sealed` keyword, or `null` if the keyword was absent. Token? get sealedKeyword; - /// Returns the type parameters for the class, or `null` if the class does - /// not have any type parameters. + /// The type parameters for the class, or `null` if the class doesn't have any + /// type parameters. TypeParameterList? get typeParameters; - /// Returns the `with` clause for the class, or `null` if the class does not - /// have a `with` clause. + /// The `with` clause for the class, or `null` if the class doesn't have a + /// `with` clause. WithClause? get withClause; } @@ -2900,17 +2760,15 @@ final class ClassDeclarationImpl extends NamedCompilationUnitMemberImpl } } -/// A node that declares a name within the scope of a class declarations. -/// -/// When the 'extension-methods' experiment is enabled, these nodes can also be -/// located inside extension declarations. +/// A node that declares a name within the scope of a class, enum, extension, +/// extension type, or mixin declaration. sealed class ClassMember implements Declaration {} -/// A node that declares a name within the scope of a class. sealed class ClassMemberImpl extends DeclarationImpl implements ClassMember { - /// Initialize a newly created member of a class. Either or both of the - /// [comment] and [metadata] can be `null` if the member does not have the - /// corresponding attribute. + /// Initializes a newly created member of a class. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the member + /// doesn't have the corresponding attribute. ClassMemberImpl({ required super.comment, required super.metadata, @@ -2920,7 +2778,8 @@ sealed class ClassMemberImpl extends DeclarationImpl implements ClassMember { /// A class type alias. /// /// classTypeAlias ::= -/// classModifiers 'class' [SimpleIdentifier] [TypeParameterList]? '=' mixinApplication +/// classModifiers 'class' [SimpleIdentifier] [TypeParameterList]? '=' +/// mixinApplication /// /// classModifiers ::= 'sealed' /// | 'abstract'? ('base' | 'interface' | 'final')? @@ -2929,123 +2788,103 @@ sealed class ClassMemberImpl extends DeclarationImpl implements ClassMember { /// mixinApplication ::= /// [NamedType] [WithClause] [ImplementsClause]? ';' abstract final class ClassTypeAlias implements TypeAlias { - /// Return the token for the 'abstract' keyword, or `null` if this is not - /// defining an abstract class. + /// The token for the `abstract` keyword, or `null` if this isn't defining an + /// abstract class. Token? get abstractKeyword; - /// Return the 'base' keyword, or `null` if the keyword was absent. + /// The `base` keyword, or `null` if the keyword was absent. Token? get baseKeyword; @override ClassElement? get declaredElement; - /// Return the token for the '=' separating the name from the definition. + /// The token for the '=' separating the name from the definition. Token get equals; - /// Return the 'final' keyword, or `null` if the keyword was absent. + /// The `final` keyword, or `null` if the keyword was absent. Token? get finalKeyword; - /// Return the implements clause for this class, or `null` if there is no - /// implements clause. + /// The implements clause for this class, or `null` if there's no implements + /// clause. ImplementsClause? get implementsClause; - /// Return the 'interface' keyword, or `null` if the keyword was absent. + /// The `interface` keyword, or `null` if the keyword was absent. Token? get interfaceKeyword; - /// Return the 'mixin' keyword, or `null` if the keyword was absent. + /// The `mixin` keyword, or `null` if the keyword was absent. Token? get mixinKeyword; - /// Return the 'sealed' keyword, or `null` if the keyword was absent. + /// The `sealed` keyword, or `null` if the keyword was absent. Token? get sealedKeyword; - /// Return the name of the superclass of the class being declared. + /// The name of the superclass of the class being declared. NamedType get superclass; - /// Return the type parameters for the class, or `null` if the class does not - /// have any type parameters. + /// The type parameters for the class, or `null` if the class doesn't have any + /// type parameters. TypeParameterList? get typeParameters; - /// Return the with clause for this class. + /// The with clause for this class. WithClause get withClause; } -/// A class type alias. -/// -/// classTypeAlias ::= -/// classModifiers 'class' [SimpleIdentifier] [TypeParameterList]? '=' mixinApplication -/// -/// classModifiers ::= 'sealed' -/// | 'abstract'? ('base' | 'interface' | 'final')? -/// | 'abstract'? 'base'? 'mixin' -/// -/// mixinApplication ::= -/// [NamedType] [WithClause] [ImplementsClause]? ';' final class ClassTypeAliasImpl extends TypeAliasImpl implements ClassTypeAlias { - /// The type parameters for the class, or `null` if the class does not have - /// any type parameters. TypeParameterListImpl? _typeParameters; - /// The token for the '=' separating the name from the definition. @override final Token equals; - /// The token for the 'abstract' keyword, or `null` if this is not defining an - /// abstract class. @override final Token? abstractKeyword; - /// The token for the 'macro' keyword, or `null` if this is not defining a + /// The token for the `macro` keyword, or `null` if this isn't defining a /// macro class. +// TODO(brianwilkerson): Move this comment to the getter when it's added to + // the public API. final Token? macroKeyword; - /// The token for the 'sealed' keyword, or `null` if this is not defining a - /// sealed class. @override final Token? sealedKeyword; - /// The token for the 'base' keyword, or `null` if this is not defining a base - /// class. @override final Token? baseKeyword; - /// The token for the 'interface' keyword, or `null` if this is not defining - /// an interface class. @override final Token? interfaceKeyword; - /// The token for the 'final' keyword, or `null` if this is not defining a - /// final class. @override final Token? finalKeyword; - /// The token for the 'augment' keyword, or `null` if this is not defining an + /// The token for the `augment` keyword, or `null` if this isn't defining an /// augmentation class. +// TODO(brianwilkerson): Move this comment to the getter when it's added to + // the public API. final Token? augmentKeyword; - /// The token for the 'mixin' keyword, or `null` if this is not defining a - /// mixin class. @override final Token? mixinKeyword; - /// The name of the superclass of the class being declared. NamedTypeImpl _superclass; - /// The with clause for this class. WithClauseImpl _withClause; - /// The implements clause for this class, or `null` if there is no implements - /// clause. ImplementsClauseImpl? _implementsClause; @override ClassElementImpl? declaredElement; - /// Initialize a newly created class type alias. Either or both of the - /// [comment] and [metadata] can be `null` if the class type alias does not - /// have the corresponding attribute. The [typeParameters] can be `null` if - /// the class does not have any type parameters. The [abstractKeyword] can be - /// `null` if the class is not abstract. The [implementsClause] can be `null` - /// if the class does not implement any interfaces. + /// Initializes a newly created class type alias. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the class + /// type alias doesn't have the corresponding attribute. + /// + /// The [typeParameters] can be `null` if the class doesn't have any type + /// parameters. + /// + /// The [abstractKeyword] can be `null` if the class isn't abstract. + /// + /// The [implementsClause] can be `null` if the class doesn't implement any + /// interfaces. ClassTypeAliasImpl({ required super.comment, required super.metadata, @@ -3148,14 +2987,6 @@ final class ClassTypeAliasImpl extends TypeAliasImpl implements ClassTypeAlias { } } -/// An element in a list, map or set literal. -/// -/// collectionElement ::= -/// [Expression] -/// | [IfElement] -/// | [ForElement] -/// | [MapLiteralEntry] -/// | [SpreadElement] sealed class CollectionElement implements AstNode {} sealed class CollectionElementImpl extends AstNodeImpl @@ -3172,23 +3003,16 @@ sealed class CollectionElementImpl extends AstNodeImpl /// [HideCombinator] /// | [ShowCombinator] sealed class Combinator implements AstNode { - /// Return the 'hide' or 'show' keyword specifying what kind of processing is - /// to be done on the names. + /// The `hide` or `show` keyword specifying what kind of processing is to be + /// done on the names. Token get keyword; } -/// A combinator associated with an import or export directive. -/// -/// combinator ::= -/// [HideCombinator] -/// | [ShowCombinator] sealed class CombinatorImpl extends AstNodeImpl implements Combinator { - /// The 'hide' or 'show' keyword specifying what kind of processing is to be - /// done on the names. @override final Token keyword; - /// Initialize a newly created combinator. + /// Initializes a newly created combinator. CombinatorImpl({ required this.keyword, }); @@ -3214,7 +3038,7 @@ sealed class CombinatorImpl extends AstNodeImpl implements Combinator { /// '/ **' (CHARACTER | [CommentReference])* '*/' /// | ('///' (CHARACTER - EOL)* EOL)+ abstract final class Comment implements AstNode { - /// The Markdown code blocks (both fenced and indented) parsed in this + /// The markdown code blocks (both fenced and indented) contained in this /// comment. @experimental List get codeBlocks; @@ -3226,53 +3050,35 @@ abstract final class Comment implements AstNode { List get docImports; /// Whether this comment has a line beginning with '@nodoc', indicating its - /// contents are not intended for publishing. + /// contents aren't intended for publishing. @experimental bool get hasNodoc; - /// Return `true` if this is a block comment. + /// Whether this is a block comment. bool get isBlock; - /// Return `true` if this is a documentation comment. + /// Whether this is a documentation comment. bool get isDocumentation; - /// Return `true` if this is an end-of-line comment. + /// Whether this is an end-of-line comment. bool get isEndOfLine; - /// Return the references embedded within the documentation comment. + /// The references embedded within the documentation comment. + /// + /// If there are no references in the comment then the list will be empty. NodeList get references; - /// Return the tokens representing the comment. + /// The tokens representing the comment. List get tokens; } -/// A comment within the source code. -/// -/// comment ::= -/// endOfLineComment -/// | blockComment -/// | documentationComment -/// -/// endOfLineComment ::= -/// '//' (CHARACTER - EOL)* EOL -/// -/// blockComment ::= -/// '/ *' CHARACTER* '*/' -/// -/// documentationComment ::= -/// '/ **' (CHARACTER | [CommentReference])* '*/' -/// | ('///' (CHARACTER - EOL)* EOL)+ final class CommentImpl extends AstNodeImpl implements Comment { - /// The tokens representing the comment. @override final List tokens; /// The type of the comment. final CommentType _type; - /// The references embedded within the documentation comment. This list will - /// be empty unless this is a documentation comment that has references embedded - /// within it. final NodeListImpl _references = NodeListImpl._(); @override @@ -3287,10 +3093,14 @@ final class CommentImpl extends AstNodeImpl implements Comment { @override final bool hasNodoc; - /// Initialize a newly created comment. The list of [tokens] must contain at - /// least one token. The [_type] is the type of the comment. The list of - /// [references] can be empty if the comment does not contain any embedded - /// references. + /// Initializes a newly created comment. + /// + /// The list of [tokens] must contain at least one token. + /// + /// The [type] is the type of the comment. + /// + /// The list of [references] can be empty if the comment doesn't contain any + /// embedded references. CommentImpl({ required this.tokens, required CommentType type, @@ -3361,27 +3171,21 @@ abstract final class CommentReference implements AstNode { /// The comment-referable expression being referenced. CommentReferableExpression get expression; - /// Return the token representing the 'new' keyword, or `null` if there was no - /// 'new' keyword. + /// The token representing the `new` keyword, or `null` if there was no `new` + /// keyword. Token? get newKeyword; } -/// A reference to a Dart element that is found within a documentation comment. -/// -/// commentReference ::= -/// '[' 'new'? [Identifier] ']' final class CommentReferenceImpl extends AstNodeImpl implements CommentReference { - /// The token representing the 'new' keyword, or `null` if there was no 'new' - /// keyword. @override final Token? newKeyword; - /// The expression being referenced. CommentReferableExpressionImpl _expression; - /// Initialize a newly created reference to a Dart element. The [newKeyword] - /// can be `null` if the reference is not to a constructor. + /// Initializes a newly created reference to a Dart element. + /// + /// The [newKeyword] can be `null` if the reference isn't to a constructor. CommentReferenceImpl({ required this.newKeyword, required CommentReferableExpressionImpl expression, @@ -3430,7 +3234,7 @@ class CommentType { /// The name of the comment type. final String name; - /// Initialize a newly created comment type to have the given [name]. + /// Initializes a newly created comment type to have the given [name]. const CommentType(this.name); @override @@ -3440,9 +3244,9 @@ class CommentType { /// A compilation unit. /// /// While the grammar restricts the order of the directives and declarations -/// within a compilation unit, this class does not enforce those restrictions. -/// In particular, the children of a compilation unit will be visited in lexical -/// order even if lexical order does not conform to the restrictions of the +/// within a compilation unit, this class doesn't enforce those restrictions. +/// In particular, the children of a compilation unit are visited in lexical +/// order even if lexical order doesn't conform to the restrictions of the /// grammar. /// /// compilationUnit ::= @@ -3459,88 +3263,68 @@ class CommentType { /// declarations ::= /// [CompilationUnitMember]* abstract final class CompilationUnit implements AstNode { - /// Return the declarations contained in this compilation unit. + /// The first (non-EOF) token in the token stream that was parsed to form this + /// compilation unit. + @override + Token get beginToken; + + /// The declarations contained in this compilation unit. NodeList get declarations; - /// Return the element associated with this compilation unit, or `null` if the - /// AST structure has not been resolved. + /// The element associated with this compilation unit, or `null` if the AST + /// structure hasn't been resolved. CompilationUnitElement? get declaredElement; - /// Return the directives contained in this compilation unit. + /// The directives contained in this compilation unit. NodeList get directives; + /// The last token in the token stream that was parsed to form this + /// compilation unit. + /// + /// This token should always have a type of [TokenType.EOF]. + @override + Token get endToken; + /// The set of features available to this compilation unit. /// - /// Determined by some combination of the .packages file, the enclosing - /// package's SDK version constraint, and/or the presence of a `@dart` - /// directive in a comment at the top of the file. + /// Determined by some combination of the `package_config.json` file, the + /// enclosing package's SDK version constraint, and/or the presence of a + /// `@dart` directive in a comment at the top of the file. FeatureSet get featureSet; /// The language version override specified for this compilation unit using a /// token like '// @dart = 2.7', or `null` if no override is specified. LanguageVersionToken? get languageVersionToken; - /// Return the line information for this compilation unit. + /// The line information for this compilation unit. LineInfo get lineInfo; - /// Return the script tag at the beginning of the compilation unit, or `null` - /// if there is no script tag in this compilation unit. + /// The script tag at the beginning of the compilation unit, or `null` if + /// there's no script tag in this compilation unit. ScriptTag? get scriptTag; - /// Return a list containing all of the directives and declarations in this + /// A list containing all of the directives and declarations in this /// compilation unit, sorted in lexical order. List get sortedDirectivesAndDeclarations; } -/// A compilation unit. -/// -/// While the grammar restricts the order of the directives and declarations -/// within a compilation unit, this class does not enforce those restrictions. -/// In particular, the children of a compilation unit will be visited in lexical -/// order even if lexical order does not conform to the restrictions of the -/// grammar. -/// -/// compilationUnit ::= -/// directives declarations -/// -/// directives ::= -/// [ScriptTag]? [LibraryDirective]? namespaceDirective* [PartDirective]* -/// | [PartOfDirective] -/// -/// namespaceDirective ::= -/// [ImportDirective] -/// | [ExportDirective] -/// -/// declarations ::= -/// [CompilationUnitMember]* final class CompilationUnitImpl extends AstNodeImpl implements CompilationUnit { - /// The first token in the token stream that was parsed to form this - /// compilation unit. @override Token beginToken; - /// The script tag at the beginning of the compilation unit, or `null` if - /// there is no script tag in this compilation unit. ScriptTagImpl? _scriptTag; - /// The directives contained in this compilation unit. final NodeListImpl _directives = NodeListImpl._(); - /// The declarations contained in this compilation unit. final NodeListImpl _declarations = NodeListImpl._(); - /// The last token in the token stream that was parsed to form this - /// compilation unit. This token should always have a type of [TokenType.EOF]. @override final Token endToken; - /// The element associated with this compilation unit, or `null` if the AST - /// structure has not been resolved. @override CompilationUnitElementImpl? declaredElement; - /// The line information for this compilation unit. @override final LineInfo lineInfo; @@ -3550,16 +3334,24 @@ final class CompilationUnitImpl extends AstNodeImpl implements CompilationUnit { @override final FeatureSet featureSet; - /// Nodes that were parsed, but happened at locations where they are not - /// allowed. So, instead of dropping them, we remember them here. Quick - /// fixes could look here to determine which source range to remove. + /// Nodes that were parsed, but happened at locations where they aren't + /// allowed. + /// + /// Instead of dropping them, we remember them here. Quick fixes can look + /// here to determine which source range to remove. final List invalidNodes; - /// Initialize a newly created compilation unit to have the given directives - /// and declarations. The [scriptTag] can be `null` if there is no script tag - /// in the compilation unit. The list of [directives] can be `null` if there - /// are no directives in the compilation unit. The list of [declarations] can - /// be `null` if there are no declarations in the compilation unit. + /// Initializes a newly created compilation unit to have the given directives + /// and declarations. + /// + /// The [scriptTag] can be `null` if there's no script tag in the compilation + /// unit. + /// + /// The list of [directives] can be `null` if there are no directives in the + /// compilation unit. + /// + /// The list of [declarations] can be `null` if there are no declarations in + /// the compilation unit. CompilationUnitImpl({ required this.beginToken, required ScriptTagImpl? scriptTag, @@ -3630,8 +3422,7 @@ final class CompilationUnitImpl extends AstNodeImpl implements CompilationUnit { ..addNodeList('declarations', declarations); } - /// Return `true` if all of the directives are lexically before any - /// declarations. + /// Whether all of the directives are lexically before any declarations. bool get _directivesAreBeforeDeclarations { if (_directives.isEmpty || _declarations.isEmpty) { return true; @@ -3674,22 +3465,12 @@ final class CompilationUnitImpl extends AstNodeImpl implements CompilationUnit { /// | [TopLevelVariableDeclaration] abstract final class CompilationUnitMember implements Declaration {} -/// A node that declares one or more names within the scope of a compilation -/// unit. -/// -/// compilationUnitMember ::= -/// [ClassDeclaration] -/// | [MixinDeclaration] -/// | [ExtensionDeclaration] -/// | [EnumDeclaration] -/// | [TypeAlias] -/// | [FunctionDeclaration] -/// | [TopLevelVariableDeclaration] sealed class CompilationUnitMemberImpl extends DeclarationImpl implements CompilationUnitMember { - /// Initialize a newly created generic compilation unit member. Either or both - /// of the [comment] and [metadata] can be `null` if the member does not have - /// the corresponding attribute. + /// Initializes a newly created compilation unit member. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the member + /// doesn't have the corresponding attribute. CompilationUnitMemberImpl({ required super.comment, required super.metadata, @@ -3705,51 +3486,45 @@ sealed class CompilationUnitMemberImpl extends DeclarationImpl /// compound assignment operator, and in a [PrefixExpression] or /// [PostfixExpression] when the operator is an increment operator. abstract final class CompoundAssignmentExpression implements Expression { - /// The element that is used to read the value. - /// - /// If this node is not a compound assignment, this element is `null`. + /// The element that is used to read the value, or `null` if this node isn't a + /// compound assignment, if the AST structure hasn't been resolved, or if the + /// target couldn't be resolved. /// /// In valid code this element can be a [LocalVariableElement], a /// [ParameterElement], or a [PropertyAccessorElement] getter. /// - /// In invalid code this element is `null`, for example `int += 2`. For - /// recovery [writeElement] is filled, and can be used for navigation. - /// - /// This element is `null` if the AST structure has not been resolved, or - /// if the target could not be resolved. + /// In invalid code this element is `null`. For example, in `int += 2`, for + /// recovery purposes, [writeElement] is filled, and can be used for + /// navigation. Element? get readElement; - /// The type of the value read with the [readElement]. + /// The type of the value read with the [readElement], or `null` if this node + /// isn't a compound assignment. /// - /// If this node is not a compound assignment, this type is `null`. - /// - /// In invalid code, e.g. `int += 2`, this type is `dynamic`. - /// - /// This type is `null` if the AST structure has not been resolved. - /// - /// If the target could not be resolved, this type is `dynamic`. + /// Returns the type `dynamic` if the code is invalid, if the AST structure + /// hasn't been resolved, or if the target couldn't be resolved. DartType? get readType; - /// The element that is used to write the result. + /// The element that is used to write the result, or `null` if the AST + /// structure hasn't been resolved, or if the target couldn't be resolved. /// /// In valid code this is a [LocalVariableElement], [ParameterElement], or a /// [PropertyAccessorElement] setter. /// /// In invalid code, for recovery, we might use other elements, for example a /// [PropertyAccessorElement] getter `myGetter = 0` even though the getter - /// cannot be used to write a value. We do this to help the user to navigate + /// can't be used to write a value. We do this to help the user to navigate /// to the getter, and maybe add the corresponding setter. /// /// If this node is a compound assignment, e. g. `x += 2`, both [readElement] - /// and [writeElement] could be not `null`. - /// - /// This element is `null` if the AST structure has not been resolved, or - /// if the target could not be resolved. + /// and [writeElement] could be non-`null`. Element? get writeElement; + /// The type of the target of the assignment. + /// /// The types of assigned values must be subtypes of this type. /// - /// If the target could not be resolved, this type is `dynamic`. + /// If the target couldn't be resolved, this type is `dynamic`. DartType? get writeType; } @@ -3773,50 +3548,37 @@ base mixin CompoundAssignmentExpressionImpl /// conditionalExpression ::= /// [Expression] '?' [Expression] ':' [Expression] abstract final class ConditionalExpression implements Expression { - /// Return the token used to separate the then expression from the else - /// expression. + /// The token used to separate the then expression from the else expression. Token get colon; - /// Return the condition used to determine which of the expressions is - /// executed next. + /// The condition used to determine which of the expressions is executed next. Expression get condition; - /// Return the expression that is executed if the condition evaluates to - /// `false`. + /// The expression that is executed if the condition evaluates to `false`. Expression get elseExpression; - /// Return the token used to separate the condition from the then expression. + /// The token used to separate the condition from the then expression. Token get question; - /// Return the expression that is executed if the condition evaluates to - /// `true`. + /// The expression that is executed if the condition evaluates to `true`. Expression get thenExpression; } -/// A conditional expression. -/// -/// conditionalExpression ::= -/// [Expression] '?' [Expression] ':' [Expression] final class ConditionalExpressionImpl extends ExpressionImpl implements ConditionalExpression { - /// The condition used to determine which of the expressions is executed next. ExpressionImpl _condition; - /// The token used to separate the condition from the then expression. @override final Token question; - /// The expression that is executed if the condition evaluates to `true`. ExpressionImpl _thenExpression; - /// The token used to separate the then expression from the else expression. @override final Token colon; - /// The expression that is executed if the condition evaluates to `false`. ExpressionImpl _elseExpression; - /// Initialize a newly created conditional expression. + /// Initializes a newly created conditional expression. ConditionalExpressionImpl({ required ExpressionImpl condition, required this.question, @@ -3897,45 +3659,35 @@ final class ConditionalExpressionImpl extends ExpressionImpl /// dottedName ::= /// identifier ('.' identifier)* abstract final class Configuration implements AstNode { - /// Return the token for the equal operator, or `null` if the condition does - /// not include an equality test. + /// The token for the equal operator, or `null` if the condition doesn't + /// include an equality test. Token? get equalToken; - /// Return the token for the 'if' keyword. + /// The token for the `if` keyword. Token get ifKeyword; - /// Return the token for the left parenthesis. + /// The token for the left parenthesis. Token get leftParenthesis; - /// Return the name of the declared variable whose value is being used in the + /// The name of the declared variable whose value is being used in the /// condition. DottedName get name; /// The result of resolving [uri]. DirectiveUri? get resolvedUri; - /// Return the token for the right parenthesis. + /// The token for the right parenthesis. Token get rightParenthesis; - /// Return the URI of the implementation library to be used if the condition - /// is true. + /// The URI of the implementation library to be used if the condition is + /// `true`. StringLiteral get uri; - /// Return the value to which the value of the declared variable will be - /// compared, or `null` if the condition does not include an equality test. + /// The value to which the value of the declared variable is compared, or + /// `null` if the condition doesn't include an equality test. StringLiteral? get value; } -/// A configuration in either an import or export directive. -/// -/// configuration ::= -/// 'if' '(' test ')' uri -/// -/// test ::= -/// dottedName ('==' stringLiteral)? -/// -/// dottedName ::= -/// identifier ('.' identifier)* final class ConfigurationImpl extends AstNodeImpl implements Configuration { @override final Token ifKeyword; @@ -4022,8 +3774,6 @@ final class ConfigurationImpl extends AstNodeImpl implements Configuration { } } -/// This class is used as a marker of constant context for initializers -/// of constant fields and top-level variables read from summaries. final class ConstantContextForExpressionImpl extends AstNodeImpl { final Element variable; final ExpressionImpl expression; @@ -4053,31 +3803,19 @@ final class ConstantContextForExpressionImpl extends AstNodeImpl { /// /// This node is also used to recover from cases where a different kind of /// expression is used as a pattern, so clients need to handle the case where -/// the expression is not one of the valid alternatives. +/// the expression isn't one of the valid alternatives. /// /// constantPattern ::= /// 'const'? [Expression] abstract final class ConstantPattern implements DartPattern { - /// Return the `const` keyword, or `null` if the expression is not preceded by - /// the keyword `const`. + /// The `const` keyword, or `null` if the expression isn't preceded by the + /// keyword `const`. Token? get constKeyword; - /// Return the constant expression being used as a pattern. + /// The constant expression being used as a pattern. Expression get expression; } -/// An expression being used as a pattern. -/// -/// The only expressions that can be validly used as a pattern are `bool`, -/// `double`, `int`, `null`, and `String` literals and references to constant -/// variables. -/// -/// This node is also used to recover from cases where a different kind of -/// expression is used as a pattern, so clients need to handle the case where -/// the expression is not one of the valid alternatives. -/// -/// constantPattern ::= -/// 'const'? [Expression] final class ConstantPatternImpl extends DartPatternImpl implements ConstantPattern { @override @@ -4140,12 +3878,15 @@ final class ConstantPatternImpl extends DartPatternImpl /// /// constructorDeclaration ::= /// constructorSignature [FunctionBody]? -/// | constructorName formalParameterList ':' 'this' ('.' [SimpleIdentifier])? arguments +/// | constructorName formalParameterList ':' 'this' +/// ('.' [SimpleIdentifier])? arguments /// /// constructorSignature ::= /// 'external'? constructorName formalParameterList initializerList? -/// | 'external'? 'factory' factoryName formalParameterList initializerList? -/// | 'external'? 'const' constructorName formalParameterList initializerList? +/// | 'external'? 'factory' factoryName formalParameterList +/// initializerList? +/// | 'external'? 'const' constructorName formalParameterList +/// initializerList? /// /// constructorName ::= /// [SimpleIdentifier] ('.' name)? @@ -4156,151 +3897,119 @@ final class ConstantPatternImpl extends DartPatternImpl /// initializerList ::= /// ':' [ConstructorInitializer] (',' [ConstructorInitializer])* abstract final class ConstructorDeclaration implements ClassMember { - /// Return the 'augment' keyword, or `null` if the keyword was absent. + /// The `augment` keyword, or `null` if the keyword was absent. Token? get augmentKeyword; - /// Return the body of the constructor. + /// The body of the constructor. FunctionBody get body; - /// Return the token for the 'const' keyword, or `null` if the constructor is - /// not a const constructor. + /// The token for the `const` keyword, or `null` if the constructor isn't a + /// const constructor. Token? get constKeyword; @override ConstructorElement? get declaredElement; - /// Return the token for the 'external' keyword to the given [token]. + /// The token for the `external` keyword to the given [token]. Token? get externalKeyword; - /// Return the token for the 'factory' keyword, or `null` if the constructor - /// is not a factory constructor. + /// The token for the `factory` keyword, or `null` if the constructor isn't a + /// factory constructor. Token? get factoryKeyword; - /// Return the initializers associated with the constructor. + /// The initializers associated with the constructor. NodeList get initializers; - /// Return the name of the constructor, or `null` if the constructor being - /// declared is unnamed. + /// The name of the constructor, or `null` if the constructor being declared + /// is unnamed. Token? get name; - /// Return the parameters associated with the constructor. + /// The parameters associated with the constructor. FormalParameterList get parameters; - /// Return the token for the period before the constructor name, or `null` if - /// the constructor being declared is unnamed. + /// The token for the period before the constructor name, or `null` if the + /// constructor being declared is unnamed. Token? get period; - /// Return the name of the constructor to which this constructor will be - /// redirected, or `null` if this is not a redirecting factory constructor. + /// The name of the constructor to which this constructor is redirected, or + /// `null` if this isn't a redirecting factory constructor. ConstructorName? get redirectedConstructor; - /// Return the type of object being created. + /// The type of object being created. /// /// This can be different than the type in which the constructor is being /// declared if the constructor is the implementation of a factory /// constructor. Identifier get returnType; - /// Return the token for the separator (colon or equals) before the - /// initializer list or redirection, or `null` if there are no initializers. + /// The token for the separator (colon or equals) before the initializer list + /// or redirection, or `null` if there are neither initializers nor a + /// redirection. Token? get separator; } -/// A constructor declaration. -/// -/// constructorDeclaration ::= -/// constructorSignature [FunctionBody]? -/// | constructorName formalParameterList ':' 'this' -/// ('.' [SimpleIdentifier])? arguments -/// -/// constructorSignature ::= -/// 'external'? constructorName formalParameterList initializerList? -/// | 'external'? 'factory' factoryName formalParameterList -/// initializerList? -/// | 'external'? 'const' constructorName formalParameterList -/// initializerList? -/// -/// constructorName ::= -/// [SimpleIdentifier] ('.' [SimpleIdentifier])? -/// -/// factoryName ::= -/// [Identifier] ('.' [SimpleIdentifier])? -/// -/// initializerList ::= -/// ':' [ConstructorInitializer] (',' [ConstructorInitializer])* final class ConstructorDeclarationImpl extends ClassMemberImpl implements ConstructorDeclaration { @override final Token? augmentKeyword; - /// The token for the 'external' keyword, or `null` if the constructor is not - /// external. @override final Token? externalKeyword; - /// The token for the 'const' keyword, or `null` if the constructor is not a - /// const constructor. @override Token? constKeyword; - /// The token for the 'factory' keyword, or `null` if the constructor is not a - /// factory constructor. @override final Token? factoryKeyword; - /// The type of object being created. This can be different than the type in - /// which the constructor is being declared if the constructor is the - /// implementation of a factory constructor. IdentifierImpl _returnType; - /// The token for the period before the constructor name, or `null` if the - /// constructor being declared is unnamed. @override final Token? period; - /// The name of the constructor, or `null` if the constructor being declared - /// is unnamed. @override final Token? name; - /// The parameters associated with the constructor. FormalParameterListImpl _parameters; - /// The token for the separator (colon or equals) before the initializer list - /// or redirection, or `null` if there are no initializers. @override Token? separator; - /// The initializers associated with the constructor. final NodeListImpl _initializers = NodeListImpl._(); - /// The name of the constructor to which this constructor will be redirected, - /// or `null` if this is not a redirecting factory constructor. ConstructorNameImpl? _redirectedConstructor; - /// The body of the constructor. FunctionBodyImpl _body; - /// The element associated with this constructor, or `null` if the AST - /// structure has not been resolved or if this constructor could not be - /// resolved. @override ConstructorElementImpl? declaredElement; - /// Initialize a newly created constructor declaration. The [externalKeyword] - /// can be `null` if the constructor is not external. Either or both of the - /// [comment] and [metadata] can be `null` if the constructor does not have - /// the corresponding attribute. The [constKeyword] can be `null` if the - /// constructor cannot be used to create a constant. The [factoryKeyword] can - /// be `null` if the constructor is not a factory. The [period] and [name] can - /// both be `null` if the constructor is not a named constructor. The - /// [separator] can be `null` if the constructor does not have any - /// initializers and does not redirect to a different constructor. The list of - /// [initializers] can be `null` if the constructor does not have any - /// initializers. The [redirectedConstructor] can be `null` if the constructor - /// does not redirect to a different constructor. The [body] can be `null` if - /// the constructor does not have a body. + /// Initializes a newly created constructor declaration. + /// + /// The [externalKeyword] can be `null` if the constructor isn't external. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// constructor doesn't have the corresponding attribute. + /// + /// The [constKeyword] can be `null` if the constructor can't be used to + /// create a constant. + /// + /// The [factoryKeyword] can be `null` if the constructor isn't a factory. + /// + /// The [period] and [name] can both be `null` if the constructor isn't a + /// named constructor. + /// + /// The [separator] can be `null` if the constructor doesn't have any + /// initializers and doesn't redirect to a different constructor. + /// + /// The list of [initializers] can be `null` if the constructor doesn't have + /// any initializers. + /// + /// The [redirectedConstructor] can be `null` if the constructor doesn't + /// redirect to a different constructor. + /// + /// The [body] can be `null` if the constructor doesn't have a body. ConstructorDeclarationImpl({ required super.comment, required super.metadata, @@ -4349,9 +4058,11 @@ final class ConstructorDeclarationImpl extends ClassMemberImpl @override NodeListImpl get initializers => _initializers; - // A trivial constructor is a generative constructor that is not a - // redirecting constructor, declares no parameters, has no - // initializer list, has no body, and is not external. + /// Whether this is a trivial constructor. + /// + /// A trivial constructor is a generative constructor that isn't a redirecting + /// constructor, declares no parameters, has no initializer list, has no body, + /// and isn't external. bool get isTrivial => redirectedConstructor == null && parameters.parameters.isEmpty && @@ -4417,54 +4128,43 @@ final class ConstructorDeclarationImpl extends ClassMemberImpl /// ('this' '.')? [SimpleIdentifier] '=' [Expression] abstract final class ConstructorFieldInitializer implements ConstructorInitializer { - /// Return the token for the equal sign between the field name and the - /// expression. + /// The token for the equal sign between the field name and the expression. Token get equals; - /// Return the expression computing the value to which the field will be - /// initialized. + /// The expression computing the value to which the field is initialized. Expression get expression; - /// Return the name of the field being initialized. + /// The name of the field being initialized. SimpleIdentifier get fieldName; - /// Return the token for the period after the 'this' keyword, or `null` if - /// there is no 'this' keyword. + /// The token for the period after the `this` keyword, or `null` if there's no + /// `this` keyword. Token? get period; - /// Return the token for the 'this' keyword, or `null` if there is no 'this' - /// keyword. + /// The token for the `this` keyword, or `null` if there's no `this` keyword. Token? get thisKeyword; } -/// The initialization of a field within a constructor's initialization list. -/// -/// fieldInitializer ::= -/// ('this' '.')? [SimpleIdentifier] '=' [Expression] final class ConstructorFieldInitializerImpl extends ConstructorInitializerImpl implements ConstructorFieldInitializer { - /// The token for the 'this' keyword, or `null` if there is no 'this' keyword. @override final Token? thisKeyword; - /// The token for the period after the 'this' keyword, or `null` if there is - /// no 'this' keyword. @override final Token? period; - /// The name of the field being initialized. SimpleIdentifierImpl _fieldName; - /// The token for the equal sign between the field name and the expression. @override final Token equals; - /// The expression computing the value to which the field will be initialized. ExpressionImpl _expression; - /// Initialize a newly created field initializer to initialize the field with - /// the given name to the value of the given expression. The [thisKeyword] and - /// [period] can be `null` if the 'this' keyword was not specified. + /// Initializes a newly created field initializer to initialize the field with + /// the given name to the value of the given expression. + /// + /// The [thisKeyword] and [period] can be `null` if the `this` keyword isn't + /// specified. ConstructorFieldInitializerImpl({ required this.thisKeyword, required this.period, @@ -4529,12 +4229,6 @@ final class ConstructorFieldInitializerImpl extends ConstructorInitializerImpl /// | [RedirectingConstructorInvocation] sealed class ConstructorInitializer implements AstNode {} -/// A node that can occur in the initializer list of a constructor declaration. -/// -/// constructorInitializer ::= -/// [SuperConstructorInvocation] -/// | [ConstructorFieldInitializer] -/// | [RedirectingConstructorInvocation] sealed class ConstructorInitializerImpl extends AstNodeImpl implements ConstructorInitializer {} @@ -4544,43 +4238,33 @@ sealed class ConstructorInitializerImpl extends AstNodeImpl /// type ('.' identifier)? abstract final class ConstructorName implements AstNode, ConstructorReferenceNode { - /// Return the name of the constructor, or `null` if the specified constructor - /// is the unnamed constructor. + /// The name of the constructor, or `null` if the specified constructor is the + /// unnamed constructor and the name `new` wasn't explicitly used. SimpleIdentifier? get name; - /// Return the token for the period before the constructor name, or `null` if - /// the specified constructor is the unnamed constructor. + /// The token for the period before the constructor name, or `null` if the + /// specified constructor is the unnamed constructor. Token? get period; - /// Return the name of the type defining the constructor. + /// The name of the type defining the constructor. NamedType get type; } -/// The name of the constructor. -/// -/// constructorName ::= -/// type ('.' identifier)? final class ConstructorNameImpl extends AstNodeImpl implements ConstructorName { - /// The name of the type defining the constructor. NamedTypeImpl _type; - /// The token for the period before the constructor name, or `null` if the - /// specified constructor is the unnamed constructor. @override Token? period; - /// The name of the constructor, or `null` if the specified constructor is the - /// unnamed constructor. SimpleIdentifierImpl? _name; - /// The element associated with this constructor name based on static type - /// information, or `null` if the AST structure has not been resolved or if - /// this constructor name could not be resolved. @override ConstructorElement? staticElement; - /// Initialize a newly created constructor name. The [period] and [name] can - /// be`null` if the constructor being named is the unnamed constructor. + /// Initializes a newly created constructor name. + /// + /// The [period] and [name] can be `null` if the constructor being named is + /// the unnamed constructor. ConstructorNameImpl({ required NamedTypeImpl type, required this.period, @@ -4632,11 +4316,12 @@ final class ConstructorNameImpl extends AstNodeImpl implements ConstructorName { } } -/// An expression representing a reference to a constructor, e.g. the expression -/// `List.filled` in `var x = List.filled;`. +/// An expression representing a reference to a constructor. /// -/// Objects of this type are not produced directly by the parser (because the -/// parser cannot tell whether an identifier refers to a type); they are +/// For example, the expression `List.filled` in `var x = List.filled;`. +/// +/// Objects of this type aren't produced directly by the parser (because the +/// parser can't tell whether an identifier refers to a type); they are /// produced at resolution time. abstract final class ConstructorReference implements Expression, CommentReferableExpression { @@ -4644,12 +4329,6 @@ abstract final class ConstructorReference ConstructorName get constructorName; } -/// An expression representing a reference to a constructor, e.g. the expression -/// `List.filled` in `var x = List.filled;`. -/// -/// Objects of this type are not produced directly by the parser (because the -/// parser cannot tell whether an identifier refers to a type); they are -/// produced at resolution time. final class ConstructorReferenceImpl extends CommentReferableExpressionImpl implements ConstructorReference { ConstructorNameImpl _constructorName; @@ -4697,9 +4376,9 @@ final class ConstructorReferenceImpl extends CommentReferableExpressionImpl /// An AST node that makes reference to a constructor. abstract final class ConstructorReferenceNode implements AstNode { - /// Return the element associated with the referenced constructor based on - /// static type information, or `null` if the AST structure has not been - /// resolved or if the constructor could not be resolved. + /// The element associated with the referenced constructor based on static + /// type information, or `null` if the AST structure hasn't been resolved or + /// if the constructor couldn't be resolved. ConstructorElement? get staticElement; } @@ -4708,10 +4387,10 @@ abstract final class ConstructorReferenceNode implements AstNode { /// constructorSelector ::= /// '.' identifier abstract final class ConstructorSelector implements AstNode { - /// Return the constructor name. + /// The constructor name. SimpleIdentifier get name; - /// Return the period before the constructor name. + /// The period before the constructor name. Token get period; } @@ -4755,55 +4434,44 @@ final class ConstructorSelectorImpl extends AstNodeImpl /// continueStatement ::= /// 'continue' [SimpleIdentifier]? ';' abstract final class ContinueStatement implements Statement { - /// Return the token representing the 'continue' keyword. + /// The token representing the `continue` keyword. Token get continueKeyword; - /// Return the label associated with the statement, or `null` if there is no - /// label. + /// The label associated with the statement, or `null` if there's no label. SimpleIdentifier? get label; - /// Return the semicolon terminating the statement. + /// The semicolon terminating the statement. Token get semicolon; - /// Return the node to which this continue statement is continuing. + /// The node to which this continue statement is continuing, or `null` if the + /// AST hasn't yet been resolved or if the target couldn't be resolved. /// - /// This will be either a [Statement] (in the case of continuing a loop), a + /// This is either a [Statement] (in the case of continuing a loop), or a /// [SwitchMember] (in the case of continuing from one switch case to - /// another), or `null` if the AST has not yet been resolved or if the target - /// could not be resolved. Note that if the source code has errors, the - /// target might be invalid (e.g. the target may be in an enclosing - /// function). + /// another). + /// + /// Note that if the source code has errors, the target might be invalid. + /// For example, the target might be in an enclosing function. AstNode? get target; } -/// A continue statement. -/// -/// continueStatement ::= -/// 'continue' [SimpleIdentifier]? ';' final class ContinueStatementImpl extends StatementImpl implements ContinueStatement { - /// The token representing the 'continue' keyword. @override final Token continueKeyword; - /// The label associated with the statement, or `null` if there is no label. SimpleIdentifierImpl? _label; - /// The semicolon terminating the statement. @override final Token semicolon; - /// The AstNode which this continue statement is continuing to. This will be - /// either a Statement (in the case of continuing a loop) or a SwitchMember - /// (in the case of continuing from one switch case to another). Null if the - /// AST has not yet been resolved or if the target could not be resolved. - /// Note that if the source code has errors, the target may be invalid (e.g. - /// the target may be in an enclosing function). @override AstNode? target; - /// Initialize a newly created continue statement. The [label] can be `null` - /// if there is no label associated with the statement. + /// Initializes a newly created continue statement. + /// + /// The [label] can be `null` if there's no label associated with the + /// statement. ContinueStatementImpl({ required this.continueKeyword, required SimpleIdentifierImpl? label, @@ -4858,50 +4526,34 @@ final class ContinueStatementImpl extends StatementImpl /// | [RecordPattern] /// | [RelationalPattern] sealed class DartPattern implements AstNode, ListPatternElement { - /// The matched value type, or `null` if the node is not resolved yet. + /// The matched value type, or `null` if the node isn't resolved yet. DartType? get matchedValueType; - /// Return the precedence of this pattern. + /// The precedence of this pattern. /// /// The precedence is a positive integer value that defines how the source /// code is parsed into an AST. For example `a | b & c` is parsed as `a | (b /// & c)` because the precedence of `&` is greater than the precedence of `|`. PatternPrecedence get precedence; - /// If this pattern is a parenthesized pattern, return the result of - /// unwrapping the pattern inside the parentheses. Otherwise, return this - /// pattern. + /// If this pattern is a parenthesized pattern, the result of unwrapping the + /// pattern inside the parentheses. Otherwise, this pattern. DartPattern get unParenthesized; } -/// A pattern. -/// -/// pattern ::= -/// [AssignedVariablePattern] -/// | [DeclaredVariablePattern] -/// | [CastPattern] -/// | [ConstantPattern] -/// | [ListPattern] -/// | [LogicalAndPattern] -/// | [LogicalOrPattern] -/// | [MapPattern] -/// | [NullAssertPattern] -/// | [NullCheckPattern] -/// | [ObjectPattern] -/// | [ParenthesizedPattern] -/// | [RecordPattern] -/// | [RelationalPattern] sealed class DartPatternImpl extends AstNodeImpl implements DartPattern, ListPatternElementImpl { @override DartType? matchedValueType; - /// Returns the context for this pattern. - /// * Declaration context: + /// The context for this pattern. + /// + /// The possible contexts are + /// - Declaration context: /// [ForEachPartsWithPatternImpl] /// [PatternVariableDeclarationImpl] - /// * Assignment context: [PatternAssignmentImpl] - /// * Matching context: [GuardedPatternImpl] + /// - Assignment context: [PatternAssignmentImpl] + /// - Matching context: [GuardedPatternImpl] AstNodeImpl? get patternContext { for (DartPatternImpl current = this;;) { var parent = current.parent; @@ -4936,6 +4588,12 @@ sealed class DartPatternImpl extends AstNodeImpl DartType computePatternSchema(ResolverVisitor resolverVisitor); + /// Dispatches this pattern to the [resolver], with the given [context] + /// information. + /// + /// Note: most code shouldn't call this method directly, but should instead + /// call [ResolverVisitor.dispatchPattern], which has some special logic for + /// handling dynamic contexts. void resolvePattern( ResolverVisitor resolverVisitor, SharedMatchContext context, @@ -4946,18 +4604,17 @@ sealed class DartPatternImpl extends AstNodeImpl /// /// Each declared name is visible within a name scope. abstract final class Declaration implements AnnotatedNode { - /// Return the element associated with this declaration, or `null` if either - /// this node corresponds to a list of declarations or if the AST structure - /// has not been resolved. + /// The element associated with this declaration, or `null` if either this + /// node corresponds to a list of declarations or if the AST structure hasn't + /// been resolved. Element? get declaredElement; } -/// A node that represents the declaration of one or more names. Each declared -/// name is visible within a name scope. sealed class DeclarationImpl extends AnnotatedNodeImpl implements Declaration { - /// Initialize a newly created declaration. Either or both of the [comment] - /// and [metadata] can be `null` if the declaration does not have the - /// corresponding attribute. + /// Initializes a newly created declaration. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// declaration doesn't have the corresponding attribute. DeclarationImpl({ required super.comment, required super.metadata, @@ -4972,39 +4629,32 @@ abstract final class DeclaredIdentifier implements Declaration { @override LocalVariableElement? get declaredElement; - /// Return `true` if this variable was declared with the 'const' modifier. + /// Whether this variable was declared with the 'const' modifier. bool get isConst; - /// Return `true` if this variable was declared with the 'final' modifier. - /// Variables that are declared with the 'const' modifier will return `false` + /// Whether this variable was declared with the 'final' modifier. + /// + /// Returns `false` for variables that are declared with the 'const' modifier /// even though they are implicitly final. bool get isFinal; - /// Return the token representing either the 'final', 'const' or 'var' - /// keyword, or `null` if no keyword was used. + /// The token representing either the `final`, `const` or `var` keyword, or + /// `null` if no keyword was used. Token? get keyword; - /// Return the name of the variable being declared. + /// The name of the variable being declared. Token get name; - /// Return the name of the declared type of the parameter, or `null` if the - /// parameter does not have a declared type. + /// The name of the declared type of the parameter, or `null` if the parameter + /// doesn't have a declared type. TypeAnnotation? get type; } -/// The declaration of a single identifier. -/// -/// declaredIdentifier ::= -/// [Annotation] finalConstVarOrType [SimpleIdentifier] final class DeclaredIdentifierImpl extends DeclarationImpl implements DeclaredIdentifier { - /// The token representing either the 'final', 'const' or 'var' keyword, or - /// `null` if no keyword was used. @override final Token? keyword; - /// The name of the declared type of the parameter, or `null` if the parameter - /// does not have a declared type. TypeAnnotationImpl? _type; @override @@ -5013,10 +4663,14 @@ final class DeclaredIdentifierImpl extends DeclarationImpl @override LocalVariableElementImpl? declaredElement; - /// Initialize a newly created formal parameter. Either or both of the - /// [comment] and [metadata] can be `null` if the declaration does not have - /// the corresponding attribute. The [keyword] can be `null` if a type name is - /// given. The [type] must be `null` if the keyword is 'var'. + /// Initializes a newly created formal parameter. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// declaration doesn't have the corresponding attribute. + /// + /// The [keyword] can be `null` if a type name is given. + /// + /// The [type] must be `null` if the keyword is `var`. DeclaredIdentifierImpl({ required super.comment, required super.metadata, @@ -5069,11 +4723,11 @@ final class DeclaredIdentifierImpl extends DeclarationImpl /// variablePattern ::= /// ( 'var' | 'final' | 'final'? [TypeAnnotation])? [Identifier] sealed class DeclaredVariablePattern implements VariablePattern { - /// Return the element associated with this declaration, or `null` if the AST - /// structure has not been resolved. + /// The element associated with this declaration, or `null` if the AST + /// structure hasn't been resolved. BindPatternVariableElement? get declaredElement; - /// The 'var' or 'final' keyword. + /// The `var` or `final` keyword. Token? get keyword; /// The type that the variable is required to match, or `null` if any type is @@ -5081,10 +4735,6 @@ sealed class DeclaredVariablePattern implements VariablePattern { TypeAnnotation? get type; } -/// A variable pattern. -/// -/// variablePattern ::= -/// ( 'var' | 'final' | 'final'? [TypeAnnotation])? [Identifier] final class DeclaredVariablePatternImpl extends VariablePatternImpl implements DeclaredVariablePattern { @override @@ -5110,7 +4760,7 @@ final class DeclaredVariablePatternImpl extends VariablePatternImpl @override Token get endToken => name; - /// If [keyword] is `final`, returns it. + /// The `final` keyword, or `null` if the `final` keyword isn't used. Token? get finalKeyword { final keyword = this.keyword; if (keyword != null && keyword.keyword == Keyword.FINAL) { @@ -5171,47 +4821,34 @@ final class DeclaredVariablePatternImpl extends VariablePatternImpl /// defaultNamedParameter ::= /// [NormalFormalParameter] (':' [Expression])? abstract final class DefaultFormalParameter implements FormalParameter { - /// Return the expression computing the default value for the parameter, or - /// `null` if there is no default value. + /// The expression computing the default value for the parameter, or `null` if + /// there's no default value. Expression? get defaultValue; - /// Return the formal parameter with which the default value is associated. + /// The formal parameter with which the default value is associated. NormalFormalParameter get parameter; - /// Return the token separating the parameter from the default value, or - /// `null` if there is no default value. + /// The token separating the parameter from the default value, or `null` if + /// there's no default value. Token? get separator; } -/// A formal parameter with a default value. There are two kinds of parameters -/// that are both represented by this class: named formal parameters and -/// positional formal parameters. -/// -/// defaultFormalParameter ::= -/// [NormalFormalParameter] ('=' [Expression])? -/// -/// defaultNamedParameter ::= -/// [NormalFormalParameter] (':' [Expression])? final class DefaultFormalParameterImpl extends FormalParameterImpl implements DefaultFormalParameter { - /// The formal parameter with which the default value is associated. NormalFormalParameterImpl _parameter; - /// The kind of this parameter. @override ParameterKind kind; - /// The token separating the parameter from the default value, or `null` if - /// there is no default value. @override final Token? separator; - /// The expression computing the default value for the parameter, or `null` if - /// there is no default value. ExpressionImpl? _defaultValue; - /// Initialize a newly created default formal parameter. The [separator] and - /// [defaultValue] can be `null` if there is no default value. + /// Initializes a newly created default formal parameter. + /// + /// The [separator] and [defaultValue] can be `null` if there's no default + /// value. DefaultFormalParameterImpl({ required NormalFormalParameterImpl parameter, required this.kind, @@ -5298,28 +4935,18 @@ final class DefaultFormalParameterImpl extends FormalParameterImpl /// | [PartDirective] /// | [PartOfDirective] sealed class Directive implements AnnotatedNode { - /// Return the element associated with this directive, or `null` if the AST - /// structure has not been resolved. + /// The element associated with this directive, or `null` if the AST structure + /// hasn't been resolved or if this directive couldn't be resolved. Element? get element; } -/// A node that represents a directive. -/// -/// directive ::= -/// [AugmentationImportDirective] -/// | [ExportDirective] -/// | [ImportDirective] -/// | [LibraryDirective] -/// | [PartDirective] -/// | [PartOfDirective] sealed class DirectiveImpl extends AnnotatedNodeImpl implements Directive { - /// The element associated with this directive, or `null` if the AST structure - /// has not been resolved or if this directive could not be resolved. ElementImpl? _element; - /// Initialize a newly create directive. Either or both of the [comment] and - /// [metadata] can be `null` if the directive does not have the corresponding - /// attribute. + /// Initializes a newly create directive. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// directive doesn't have the corresponding attribute. DirectiveImpl({ required super.comment, required super.metadata, @@ -5328,7 +4955,6 @@ sealed class DirectiveImpl extends AnnotatedNodeImpl implements Directive { @override ElementImpl? get element => _element; - /// Set the element associated with this directive to be the given [element]. set element(ElementImpl? element) { _element = element; } @@ -5339,60 +4965,49 @@ sealed class DirectiveImpl extends AnnotatedNodeImpl implements Directive { /// doStatement ::= /// 'do' [Statement] 'while' '(' [Expression] ')' ';' abstract final class DoStatement implements Statement { - /// Return the body of the loop. + /// The body of the loop. Statement get body; - /// Return the condition that determines when the loop will terminate. + /// The condition that determines when the loop terminates. Expression get condition; - /// Return the token representing the 'do' keyword. + /// The token representing the `do` keyword. Token get doKeyword; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; - /// Return the semicolon terminating the statement. + /// The semicolon terminating the statement. Token get semicolon; - /// Return the token representing the 'while' keyword. + /// The token representing the `while` keyword. Token get whileKeyword; } -/// A do statement. -/// -/// doStatement ::= -/// 'do' [Statement] 'while' '(' [Expression] ')' ';' final class DoStatementImpl extends StatementImpl implements DoStatement { - /// The token representing the 'do' keyword. @override final Token doKeyword; - /// The body of the loop. StatementImpl _body; - /// The token representing the 'while' keyword. @override final Token whileKeyword; - /// The left parenthesis. @override final Token leftParenthesis; - /// The condition that determines when the loop will terminate. ExpressionImpl _condition; - /// The right parenthesis. @override final Token rightParenthesis; - /// The semicolon terminating the statement. @override final Token semicolon; - /// Initialize a newly created do loop. + /// Initializes a newly created do loop. DoStatementImpl({ required this.doKeyword, required StatementImpl body, @@ -5452,19 +5067,16 @@ final class DoStatementImpl extends StatementImpl implements DoStatement { /// dottedName ::= /// [SimpleIdentifier] ('.' [SimpleIdentifier])* abstract final class DottedName implements AstNode { - /// Return the components of the identifier. + /// The components of the identifier. NodeList get components; } -/// A dotted name, used in a configuration within an import or export directive. -/// -/// dottedName ::= -/// [SimpleIdentifier] ('.' [SimpleIdentifier])* final class DottedNameImpl extends AstNodeImpl implements DottedName { - /// The components of the identifier. final NodeListImpl _components = NodeListImpl._(); - /// Initialize a newly created dotted name. + /// Initializes a newly created dotted name. + /// + /// The list of [components] must contain at least one element. DottedNameImpl({ required List components, }) { @@ -5503,31 +5115,21 @@ final class DottedNameImpl extends AstNodeImpl implements DottedName { /// exponent ::= /// ('e' | 'E') ('+' | '-')? decimalDigit+ abstract final class DoubleLiteral implements Literal { - /// Return the token representing the literal. + /// The token representing the literal. Token get literal; - /// Return the value of the literal. + /// The value of the literal. double get value; } -/// A floating point literal expression. -/// -/// doubleLiteral ::= -/// decimalDigit+ ('.' decimalDigit*)? exponent? -/// | '.' decimalDigit+ exponent? -/// -/// exponent ::= -/// ('e' | 'E') ('+' | '-')? decimalDigit+ final class DoubleLiteralImpl extends LiteralImpl implements DoubleLiteral { - /// The token representing the literal. @override final Token literal; - /// The value of the literal. @override double value; - /// Initialize a newly created floating point literal. + /// Initializes a newly created floating point literal. DoubleLiteralImpl({ required this.literal, required this.value, @@ -5557,30 +5159,24 @@ final class DoubleLiteralImpl extends LiteralImpl implements DoubleLiteral { } } -/// An empty function body, which can only appear in constructors or abstract -/// methods. +/// An empty function body. +/// +/// An empty function body can only appear in constructors or abstract methods. /// /// emptyFunctionBody ::= /// ';' abstract final class EmptyFunctionBody implements FunctionBody { - /// Return the token representing the semicolon that marks the end of the - /// function body. + /// The token representing the semicolon that marks the end of the function + /// body. Token get semicolon; } -/// An empty function body, which can only appear in constructors or abstract -/// methods. -/// -/// emptyFunctionBody ::= -/// ';' final class EmptyFunctionBodyImpl extends FunctionBodyImpl implements EmptyFunctionBody { - /// The token representing the semicolon that marks the end of the function - /// body. @override final Token semicolon; - /// Initialize a newly created function body. + /// Initializes a newly created function body. EmptyFunctionBodyImpl({ required this.semicolon, }); @@ -5613,20 +5209,15 @@ final class EmptyFunctionBodyImpl extends FunctionBodyImpl /// emptyStatement ::= /// ';' abstract final class EmptyStatement implements Statement { - /// Return the semicolon terminating the statement. + /// The semicolon terminating the statement. Token get semicolon; } -/// An empty statement. -/// -/// emptyStatement ::= -/// ';' final class EmptyStatementImpl extends StatementImpl implements EmptyStatement { - /// The semicolon terminating the statement. @override final Token semicolon; - /// Initialize a newly created empty statement. + /// Initializes a newly created empty statement. EmptyStatementImpl({ required this.semicolon, }); @@ -5658,17 +5249,16 @@ final class EmptyStatementImpl extends StatementImpl implements EmptyStatement { /// enumConstantArguments ::= /// [TypeArgumentList]? [ConstructorSelector]? [ArgumentList] abstract final class EnumConstantArguments implements AstNode { - /// Return the explicit arguments (there are always implicit `index` and - /// `name` leading arguments) to the invoked constructor. + /// The explicit arguments (there are always implicit `index` and `name` + /// leading arguments) to the invoked constructor. ArgumentList get argumentList; - /// Return the selector of the constructor that is invoked by this enum - /// constant, or `null` if the default constructor is invoked. + /// The selector of the constructor that is invoked by this enum constant, or + /// `null` if the default constructor is invoked. ConstructorSelector? get constructorSelector; - /// Return the type arguments applied to the enclosing enum declaration - /// when invoking the constructor, or `null` if no type arguments were - /// provided. + /// The type arguments applied to the enclosing enum declaration when invoking + /// the constructor, or `null` if no type arguments were provided. TypeArgumentList? get typeArguments; } @@ -5721,24 +5311,23 @@ final class EnumConstantArgumentsImpl extends AstNodeImpl /// The declaration of an enum constant. abstract final class EnumConstantDeclaration implements Declaration { - /// Return the explicit arguments (there are always implicit `index` and - /// `name` leading arguments) to the invoked constructor, or `null` if this - /// constant does not provide any explicit arguments. + /// The explicit arguments (there are always implicit `index` and `name` + /// leading arguments) to the invoked constructor, or `null` if this constant + /// doesn't provide any explicit arguments. EnumConstantArguments? get arguments; - /// Return the constructor that is invoked by this enum constant, or `null` - /// if the AST structure has not been resolved, or if the constructor could - /// not be resolved. + /// The constructor that is invoked by this enum constant, or `null` if the + /// AST structure hasn't been resolved, or if the constructor couldn't be + /// resolved. ConstructorElement? get constructorElement; @override FieldElement? get declaredElement; - /// Return the name of the constant. + /// The name of the constant. Token get name; } -/// The declaration of an enum constant. final class EnumConstantDeclarationImpl extends DeclarationImpl implements EnumConstantDeclaration { @override @@ -5753,9 +5342,10 @@ final class EnumConstantDeclarationImpl extends DeclarationImpl @override ConstructorElement? constructorElement; - /// Initialize a newly created enum constant declaration. Either or both of - /// the [documentationComment] and [metadata] can be `null` if the constant - /// does not have the corresponding attribute. + /// Initializes a newly created enum constant declaration. + /// + /// Either or both of the [documentationComment] and [metadata] can be `null` + /// if the constant doesn't have the corresponding attributes. EnumConstantDeclarationImpl({ required super.comment, required super.metadata, @@ -5794,88 +5384,73 @@ final class EnumConstantDeclarationImpl extends DeclarationImpl /// [WithClause]? [ImplementsClause]? '{' [SimpleIdentifier] /// (',' [SimpleIdentifier])* (';' [ClassMember]+)? '}' abstract final class EnumDeclaration implements NamedCompilationUnitMember { - /// Return the enumeration constants being declared. + /// The enumeration constants being declared. NodeList get constants; @override EnumElement? get declaredElement; - /// Return the 'enum' keyword. + /// The `enum` keyword. Token get enumKeyword; - /// Returns the `implements` clause for the enumeration, or `null` if the - /// enumeration does not implement any interfaces. + /// The `implements` clause for the enumeration, or `null` if the enumeration + /// doesn't implement any interfaces. ImplementsClause? get implementsClause; - /// Return the left curly bracket. + /// The left curly bracket. Token get leftBracket; - /// Return the members declared by the enumeration. + /// The members declared by the enumeration. NodeList get members; - /// Return the right curly bracket. + /// The right curly bracket. Token get rightBracket; - /// Return the optional semicolon after the last constant. + /// The optional semicolon after the last constant. Token? get semicolon; - /// Returns the type parameters for the enumeration, or `null` if the - /// enumeration does not have any type parameters. + /// The type parameters for the enumeration, or `null` if the enumeration + /// doesn't have any type parameters. TypeParameterList? get typeParameters; - /// Return the `with` clause for the enumeration, or `null` if the - /// enumeration does not have a `with` clause. + /// The `with` clause for the enumeration, or `null` if the enumeration + /// doesn't have a `with` clause. WithClause? get withClause; } -/// The declaration of an enumeration. -/// -/// enumType ::= -/// metadata 'enum' [SimpleIdentifier] [TypeParameterList]? -/// [WithClause]? [ImplementsClause]? '{' [SimpleIdentifier] -/// (',' [SimpleIdentifier])* (';' [ClassMember]+)? '}' final class EnumDeclarationImpl extends NamedCompilationUnitMemberImpl implements EnumDeclaration { - /// The 'enum' keyword. @override final Token enumKeyword; - /// The type parameters, or `null` if the enumeration does not have any - /// type parameters. TypeParameterListImpl? _typeParameters; - /// The `with` clause for the enumeration, or `null` if the class does not - /// have a `with` clause. WithClauseImpl? _withClause; - /// The `implements` clause for the enumeration, or `null` if the enumeration - /// does not implement any interfaces. ImplementsClauseImpl? _implementsClause; - /// The left curly bracket. @override final Token leftBracket; - /// The enumeration constants being declared. final NodeListImpl _constants = NodeListImpl._(); @override final Token? semicolon; - /// The members defined by the enum. final NodeListImpl _members = NodeListImpl._(); - /// The right curly bracket. @override final Token rightBracket; @override EnumElementImpl? declaredElement; - /// Initialize a newly created enumeration declaration. Either or both of the - /// [comment] and [metadata] can be `null` if the declaration does not have - /// the corresponding attribute. The list of [constants] must contain at least - /// one value. + /// Initializes a newly created enumeration declaration. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// declaration doesn't have the corresponding attribute. + /// + /// The list of [constants] must contain at least one value. EnumDeclarationImpl({ required super.comment, required super.metadata, @@ -5965,28 +5540,26 @@ final class EnumDeclarationImpl extends NamedCompilationUnitMemberImpl /// exportDirective ::= /// [Annotation] 'export' [StringLiteral] [Combinator]* ';' abstract final class ExportDirective implements NamespaceDirective { - /// Return the element associated with this directive, or `null` if the AST - /// structure has not been resolved. + /// The element associated with this directive, or `null` if the AST structure + /// hasn't been resolved. @override LibraryExportElement? get element; - /// The token representing the 'export' keyword. + /// The token representing the `export` keyword. Token get exportKeyword; } -/// An export directive. -/// -/// exportDirective ::= -/// [Annotation] 'export' [StringLiteral] [Combinator]* ';' final class ExportDirectiveImpl extends NamespaceDirectiveImpl implements ExportDirective { @override final Token exportKeyword; - /// Initialize a newly created export directive. Either or both of the - /// [comment] and [metadata] can be `null` if the directive does not have the - /// corresponding attribute. The list of [combinators] can be `null` if there - /// are no combinators. + /// Initializes a newly created export directive. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// directive doesn't have the corresponding attribute. + /// + /// The list of [combinators] can be `null` if there are no combinators. ExportDirectiveImpl({ required super.comment, required super.metadata, @@ -6031,22 +5604,24 @@ final class ExportDirectiveImpl extends NamespaceDirectiveImpl /// | [ConditionalExpression] cascadeSection* /// | [ThrowExpression] abstract final class Expression implements CollectionElement { + /// Whether this expression is in a constant context. + /// /// An expression _e_ is said to _occur in a constant context_, - /// * if _e_ is an element of a constant list literal, or a key or value of an + /// - if _e_ is an element of a constant list literal, or a key or value of an /// entry of a constant map literal. - /// * if _e_ is an actual argument of a constant object expression or of a + /// - if _e_ is an actual argument of a constant object expression or of a /// metadata annotation. - /// * if _e_ is the initializing expression of a constant variable + /// - if _e_ is the initializing expression of a constant variable /// declaration. - /// * if _e_ is a switch case expression. - /// * if _e_ is an immediate subexpression of an expression _e1_ which occurs + /// - if _e_ is a switch case expression. + /// - if _e_ is an immediate subexpression of an expression _e1_ which occurs /// in a constant context, unless _e1_ is a `throw` expression or a function /// literal. /// /// This roughly means that everything which is inside a syntactically /// constant expression is in a constant context. A `throw` expression is /// currently not allowed in a constant expression, but extensions affecting - /// that status may be considered. A similar situation arises for function + /// that status might be considered. A similar situation arises for function /// literals. /// /// Note that the default value of an optional formal parameter is _not_ a @@ -6054,11 +5629,11 @@ abstract final class Expression implements CollectionElement { /// semantics of default values. bool get inConstantContext; - /// Return `true` if this expression is syntactically valid for the LHS of an + /// Whether this expression is syntactically valid for the LHS of an /// [AssignmentExpression]. bool get isAssignable; - /// Return the precedence of this expression. + /// The precedence of this expression. /// /// The precedence is a positive integer value that defines how the source /// code is parsed into an AST. For example `a * b + c` is parsed as @@ -6066,20 +5641,22 @@ abstract final class Expression implements CollectionElement { /// of `+`. Precedence get precedence; - /// If this expression is an argument to an invocation, and the AST structure - /// has been resolved, and the function being invoked is known based on static - /// type information, and this expression corresponds to one of the parameters - /// of the function being invoked, then return the parameter element - /// representing the parameter to which the value of this expression will be - /// bound. Otherwise, return `null`. + /// The parameter element representing the parameter to which the value of + /// this expression is bound, or `null` if any of these conditions are not + /// `true` + /// - this expression is an argument to an invocation + /// - the AST structure is resolved + /// - the function being invoked is known based on static type information + /// - this expression corresponds to one of the parameters of the function + /// being invoked ParameterElement? get staticParameterElement; - /// Return the static type of this expression, or `null` if the AST structure - /// has not been resolved. + /// The static type of this expression, or `null` if the AST structure hasn't + /// been resolved. DartType? get staticType; - /// If this expression is a parenthesized expression, return the result of - /// unwrapping the expression inside the parentheses. Otherwise, return this + /// If this expression is a parenthesized expression, returns the result of + /// unwrapping the expression inside the parentheses. Otherwise, returns this /// expression. Expression get unParenthesized; } @@ -6089,51 +5666,50 @@ abstract final class Expression implements CollectionElement { /// expressionFunctionBody ::= /// 'async'? '=>' [Expression] ';' abstract final class ExpressionFunctionBody implements FunctionBody { - /// Return the expression representing the body of the function. + /// The expression representing the body of the function. Expression get expression; - /// Return the token introducing the expression that represents the body of the + /// The token introducing the expression that represents the body of the /// function. Token get functionDefinition; - /// Return the semicolon terminating the statement. + /// The token representing the `async` keyword, or `null` if there's no such + /// keyword. + @override + Token? get keyword; + + /// The semicolon terminating the statement. Token? get semicolon; + + /// The star following the `async` keyword, or `null` if there's no star. + /// + /// It's an error for an expression function body to feature the star, but + /// the parser accepts it. + @override + Token? get star; } -/// A function body consisting of a single expression. -/// -/// expressionFunctionBody ::= -/// 'async'? '=>' [Expression] ';' final class ExpressionFunctionBodyImpl extends FunctionBodyImpl implements ExpressionFunctionBody { - /// The token representing the 'async' keyword, or `null` if there is no such - /// keyword. @override final Token? keyword; - /// The star optionally following the 'async' or 'sync' keyword, or `null` if - /// there is wither no such keyword or no star. - /// - /// It is an error for an expression function body to feature the star, but - /// the parser will accept it. @override final Token? star; - /// The token introducing the expression that represents the body of the - /// function. @override final Token functionDefinition; - /// The expression representing the body of the function. ExpressionImpl _expression; - /// The semicolon terminating the statement. @override final Token? semicolon; - /// Initialize a newly created function body consisting of a block of - /// statements. The [keyword] can be `null` if the function body is not an - /// async function body. + /// Initializes a newly created function body consisting of a block of + /// statements. + /// + /// The [keyword] can be `null` if the function body isn't an async function + /// body. ExpressionFunctionBodyImpl({ required this.keyword, required this.star, @@ -6198,16 +5774,8 @@ final class ExpressionFunctionBodyImpl extends FunctionBodyImpl } } -/// A node that represents an expression. -/// -/// expression ::= -/// [AssignmentExpression] -/// | [ConditionalExpression] cascadeSection* -/// | [ThrowExpression] sealed class ExpressionImpl extends AstNodeImpl implements CollectionElementImpl, Expression { - /// The static type of this expression, or `null` if the AST structure has not - /// been resolved. @override DartType? staticType; @@ -6281,7 +5849,7 @@ sealed class ExpressionImpl extends AstNodeImpl return parent._staticParameterElementForRightHandSide; } } else if (parent is PrefixExpressionImpl) { - // TODO(scheglov): This does not look right, there is no element for + // TODO(scheglov): This doesn't look right, there's no element for // the operand, for `a++` we invoke `a = a + 1`, so the parameter // is for `1`, not for `a`. return parent._staticParameterElementForOperand; @@ -6306,8 +5874,8 @@ sealed class ExpressionImpl extends AstNodeImpl /// information. /// /// Note: most code shouldn't call this method directly, but should instead - /// call [ResolverVisitor.analyzeExpression], which has some special logic for - /// handling dynamic contexts. + /// call [ResolverVisitor.dispatchExpression], which has some special logic + /// for handling dynamic contexts. void resolveExpression(ResolverVisitor resolver, DartType contextType); } @@ -6316,30 +5884,22 @@ sealed class ExpressionImpl extends AstNodeImpl /// expressionStatement ::= /// [Expression]? ';' abstract final class ExpressionStatement implements Statement { - /// Return the expression that comprises the statement. + /// The expression that comprises the statement. Expression get expression; - /// Return the semicolon terminating the statement, or `null` if the - /// expression is a function expression and therefore isn't followed by a - /// semicolon. + /// The semicolon terminating the statement, or `null` if the expression is a + /// function expression and therefore isn't followed by a semicolon. Token? get semicolon; } -/// An expression used as a statement. -/// -/// expressionStatement ::= -/// [Expression]? ';' final class ExpressionStatementImpl extends StatementImpl implements ExpressionStatement { - /// The expression that comprises the statement. ExpressionImpl _expression; - /// The semicolon terminating the statement, or `null` if the expression is a - /// function expression and therefore isn't followed by a semicolon. @override final Token? semicolon; - /// Initialize a newly created expression statement. + /// Initializes a newly created expression statement. ExpressionStatementImpl({ required ExpressionImpl expression, required this.semicolon, @@ -6388,26 +5948,20 @@ final class ExpressionStatementImpl extends StatementImpl /// extendsClause ::= /// 'extends' [NamedType] abstract final class ExtendsClause implements AstNode { - /// Return the token representing the 'extends' keyword. + /// The token representing the `extends` keyword. Token get extendsKeyword; - /// Return the name of the class that is being extended. + /// The name of the class that is being extended. NamedType get superclass; } -/// The "extends" clause in a class declaration. -/// -/// extendsClause ::= -/// 'extends' [NamedType] final class ExtendsClauseImpl extends AstNodeImpl implements ExtendsClause { - /// The token representing the 'extends' keyword. @override final Token extendsKeyword; - /// The name of the class that is being extended. NamedTypeImpl _superclass; - /// Initialize a newly created extends clause. + /// Initializes a newly created extends clause. ExtendsClauseImpl({ required this.extendsKeyword, required NamedTypeImpl superclass, @@ -6449,7 +6003,7 @@ final class ExtendsClauseImpl extends AstNodeImpl implements ExtendsClause { /// 'on' [TypeAnnotation] [ShowClause]? [HideClause]? /// '{' [ClassMember]* '}' abstract final class ExtensionDeclaration implements CompilationUnitMember { - /// The 'augment' keyword, or `null` if the keyword was absent. + /// The `augment` keyword, or `null` if the keyword was absent. @experimental Token? get augmentKeyword; @@ -6460,17 +6014,16 @@ abstract final class ExtensionDeclaration implements CompilationUnitMember { @Deprecated('Use onClause instead') TypeAnnotation get extendedType; - /// Return the token representing the 'extension' keyword. + /// The token representing the `extension` keyword. Token get extensionKeyword; - /// Return the left curly bracket. + /// The left curly bracket. Token get leftBracket; - /// Return the members being added to the extended class. + /// The members being added to the extended class. NodeList get members; - /// Return the name of the extension, or `null` if the extension does not have - /// a name. + /// The name of the extension, or `null` if the extension doesn't have a name. Token? get name; /// The `on` clause, `null` if an augmentation. @@ -6480,22 +6033,17 @@ abstract final class ExtensionDeclaration implements CompilationUnitMember { @Deprecated('Use onClause instead') Token get onKeyword; - /// Return the right curly bracket. + /// The right curly bracket. Token get rightBracket; - /// Return the token representing the 'type' keyword. + /// The token representing the `type` keyword. Token? get typeKeyword; - /// Return the type parameters for the extension, or `null` if the extension - /// does not have any type parameters. + /// The type parameters for the extension, or `null` if the extension doesn't + /// have any type parameters. TypeParameterList? get typeParameters; } -/// The declaration of an extension of a type. -/// -/// extension ::= -/// 'extension' [SimpleIdentifier] [TypeParameterList]? -/// 'on' [TypeAnnotation] '{' [ClassMember]* '}' final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl implements ExtensionDeclaration { @override @@ -6510,8 +6058,6 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl @override final Token? name; - /// The type parameters for the extension, or `null` if the extension does not - /// have any type parameters. TypeParameterListImpl? _typeParameters; @override @@ -6520,7 +6066,6 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl @override final Token leftBracket; - /// The members being added to the extended class. final NodeListImpl _members = NodeListImpl._(); @override @@ -6652,17 +6197,18 @@ final class ExtensionOnClauseImpl extends AstNodeImpl /// extensionOverride ::= /// [Identifier] [TypeArgumentList]? [ArgumentList] abstract final class ExtensionOverride implements Expression { - /// Return the list of arguments to the override. In valid code this will - /// contain a single argument, which evaluates to the object being extended. + /// The list of arguments to the override. + /// + /// In valid code this contains a single argument that evaluates to the object + /// being extended. ArgumentList get argumentList; /// The forced extension element. ExtensionElement get element; - /// Return the actual type extended by this override, produced by applying - /// [typeArgumentTypes] to the generic type extended by the extension. - /// - /// Return `null` if the AST structure has not been resolved. + /// The actual type extended by this override, produced by applying + /// [typeArgumentTypes] to the generic type extended by the extension, or + /// `null` if the AST structure hasn't been resolved. DartType? get extendedType; /// The optional import prefix before [name]. @@ -6674,25 +6220,18 @@ abstract final class ExtensionOverride implements Expression { /// The name of the extension being selected. Token get name; - /// Return the type arguments to be applied to the extension, or `null` if no - /// type arguments were provided. + /// The type arguments to be applied to the extension, or `null` if there are + /// no type arguments. TypeArgumentList? get typeArguments; - /// Return the actual type arguments to be applied to the extension, either - /// explicitly specified in [typeArguments], or inferred. - /// - /// If the AST has been resolved, never returns `null`, returns an empty list - /// if the extension does not have type parameters. + /// The actual type arguments to be applied to the extension, either + /// explicitly specified in [typeArguments], or inferred, or `null` if the AST + /// structure hasn't been resolved. /// - /// Return `null` if the AST structure has not been resolved. + /// An empty list if the extension doesn't have type arguments. List? get typeArgumentTypes; } -/// An override to force resolution to choose a member from a specific -/// extension. -/// -/// extensionOverride ::= -/// [Identifier] [TypeArgumentList]? [ArgumentList] final class ExtensionOverrideImpl extends ExpressionImpl implements ExtensionOverride { @override @@ -6704,12 +6243,8 @@ final class ExtensionOverrideImpl extends ExpressionImpl @override final ExtensionElement element; - /// The type arguments to be applied to the extension, or `null` if no type - /// arguments were provided. TypeArgumentListImpl? _typeArguments; - /// The list of arguments to the override. In valid code this will contain a - /// single argument, which evaluates to the object being extended. ArgumentListImpl _argumentList; @override @@ -6797,20 +6332,20 @@ final class ExtensionOverrideImpl extends ExpressionImpl @experimental abstract final class ExtensionTypeDeclaration implements NamedCompilationUnitMember { - /// The 'augment' keyword, or `null` if the keyword was absent. + /// The `augment` keyword, or `null` if the keyword was absent. @experimental Token? get augmentKeyword; - /// The 'const' keyword. + /// The `const` keyword. Token? get constKeyword; @override ExtensionTypeElement? get declaredElement; - /// The 'extension' keyword. + /// The `extension` keyword. Token get extensionKeyword; - /// The 'implements' clause. + /// The `implements` clause. ImplementsClause? get implementsClause; /// The left curly bracket. @@ -6825,7 +6360,7 @@ abstract final class ExtensionTypeDeclaration /// The right curly bracket. Token get rightBracket; - /// The 'type' keyword. + /// The `type` keyword. Token get typeKeyword; /// The type parameters. @@ -6939,41 +6474,37 @@ final class ExtensionTypeDeclarationImpl extends NamedCompilationUnitMemberImpl /// | 'abstract' ( | 'covariant' ) /// /// -/// (Note: there is no `` production in the grammar; this is a +/// (Note: there's no `` production in the grammar; this is a /// subset of the grammar production ``, which encompasses /// everything that can appear inside a class declaration except methods). abstract final class FieldDeclaration implements ClassMember { - /// The `abstract` keyword, or `null` if the keyword was not used. + /// The `abstract` keyword, or `null` if the keyword isn't used. Token? get abstractKeyword; - /// Return the 'augment' keyword, or `null` if the keyword was absent. + /// The `augment` keyword, or `null` if the keyword was absent. @experimental Token? get augmentKeyword; - /// The 'covariant' keyword, or `null` if the keyword was not used. + /// The `covariant` keyword, or `null` if the keyword isn't used. Token? get covariantKeyword; - /// The `external` keyword, or `null` if the keyword was not used. + /// The `external` keyword, or `null` if the keyword isn't used. Token? get externalKeyword; - /// Return the fields being declared. + /// The fields being declared. VariableDeclarationList get fields; - /// Return `true` if the fields are declared to be static. + /// Whether the fields are declared to be static. bool get isStatic; - /// Return the semicolon terminating the declaration. + /// The semicolon terminating the declaration. Token get semicolon; - /// Return the token representing the 'static' keyword, or `null` if the - /// fields are not static. + /// The token representing the `static` keyword, or `null` if the fields + /// aren't static. Token? get staticKeyword; } -/// The declaration of one or more fields of the same type. -/// -/// fieldDeclaration ::= -/// 'static'? [VariableDeclarationList] ';' final class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration { @override @@ -6982,29 +6513,26 @@ final class FieldDeclarationImpl extends ClassMemberImpl @override final Token? augmentKeyword; - /// The 'covariant' keyword, or `null` if the keyword was not used. @override final Token? covariantKeyword; @override final Token? externalKeyword; - /// The token representing the 'static' keyword, or `null` if the fields are - /// not static. @override final Token? staticKeyword; - /// The fields being declared. VariableDeclarationListImpl _fieldList; - /// The semicolon terminating the declaration. @override final Token semicolon; - /// Initialize a newly created field declaration. Either or both of the - /// [comment] and [metadata] can be `null` if the declaration does not have - /// the corresponding attribute. The [staticKeyword] can be `null` if the - /// field is not a static field. + /// Initializes a newly created field declaration. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// declaration doesn't have the corresponding attribute. + /// + /// The [staticKeyword] can be `null` if the field isn't a static field. FieldDeclarationImpl({ required super.comment, required super.metadata, @@ -7065,85 +6593,82 @@ final class FieldDeclarationImpl extends ClassMemberImpl /// A field formal parameter. /// /// fieldFormalParameter ::= -/// ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | [TypeAnnotation])? +/// ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | +/// [TypeAnnotation])? /// 'this' '.' name ([TypeParameterList]? [FormalParameterList])? abstract final class FieldFormalParameter implements NormalFormalParameter { - /// Return the token representing either the 'final', 'const' or 'var' - /// keyword, or `null` if no keyword was used. + /// The token representing either the `final`, `const` or `var` keyword, or + /// `null` if no keyword was used. Token? get keyword; @override Token get name; - /// Return the parameters of the function-typed parameter, or `null` if this - /// is not a function-typed field formal parameter. + /// The parameters of the function-typed parameter, or `null` if this isn't a + /// function-typed field formal parameter. FormalParameterList? get parameters; - /// Return the token representing the period. + /// The token representing the period. Token get period; + /// The question mark indicating that the function type is nullable, or `null` + /// if there's no question mark, which will always be the case when the + /// parameter doesn't use the older style for denoting a function typed + /// parameter. + /// /// If the parameter is function-typed, and has the question mark, then its /// function type is nullable. Having a nullable function type means that the - /// parameter can be null. + /// parameter can be `null`. Token? get question; - /// Return the token representing the 'this' keyword. + /// The token representing the `this` keyword. Token get thisKeyword; - /// Return the declared type of the parameter, or `null` if the parameter does - /// not have a declared type. + /// The declared type of the parameter, or `null` if the parameter doesn't + /// have a declared type. /// - /// Note that if this is a function-typed field formal parameter this is the - /// return type of the function. + /// If this is a function-typed field formal parameter this is the return type + /// of the function. TypeAnnotation? get type; - /// Return the type parameters associated with this method, or `null` if this - /// method is not a generic method. + /// The type parameters associated with this method, or `null` if this method + /// isn't a generic method. TypeParameterList? get typeParameters; } -/// A field formal parameter. -/// -/// fieldFormalParameter ::= -/// ('final' [NamedType] | 'const' [NamedType] | 'var' | [NamedType])? -/// 'this' '.' [SimpleIdentifier] -/// ([TypeParameterList]? [FormalParameterList])? final class FieldFormalParameterImpl extends NormalFormalParameterImpl implements FieldFormalParameter { - /// The token representing either the 'final', 'const' or 'var' keyword, or - /// `null` if no keyword was used. @override final Token? keyword; - /// The name of the declared type of the parameter, or `null` if the parameter - /// does not have a declared type. TypeAnnotationImpl? _type; - /// The token representing the 'this' keyword. @override final Token thisKeyword; - /// The token representing the period. @override final Token period; - /// The type parameters associated with the method, or `null` if the method is - /// not a generic method. TypeParameterListImpl? _typeParameters; - /// The parameters of the function-typed parameter, or `null` if this is not a - /// function-typed field formal parameter. FormalParameterListImpl? _parameters; @override final Token? question; - /// Initialize a newly created formal parameter. Either or both of the - /// [comment] and [metadata] can be `null` if the parameter does not have the - /// corresponding attribute. The [keyword] can be `null` if there is a type. - /// The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and - /// [period] can be `null` if the keyword 'this' was not provided. The - /// [parameters] can be `null` if this is not a function-typed field formal + /// Initializes a newly created formal parameter. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// parameter doesn't have the corresponding attribute. + /// + /// The [keyword] can be `null` if there's a type. + /// + /// The [type] must be `null` if the keyword is `var`. + /// + /// The [thisKeyword] and [period] can be `null` if the keyword `this` isn't + /// provided. + /// + /// The [parameters] can be `null` if this isn't a function-typed field formal /// parameter. FieldFormalParameterImpl({ required super.comment, @@ -7246,10 +6771,10 @@ final class FieldFormalParameterImpl extends NormalFormalParameterImpl /// The parts of a for-each loop that control the iteration. sealed class ForEachParts implements ForLoopParts { - /// Return the token representing the 'in' keyword. + /// The token representing the `in` keyword. Token get inKeyword; - /// Return the expression evaluated to produce the iterator. + /// The expression evaluated to produce the iterator. Expression get iterable; } @@ -7257,12 +6782,12 @@ sealed class ForEachPartsImpl extends ForLoopPartsImpl implements ForEachParts { @override final Token inKeyword; - /// The expression evaluated to produce the iterator. ExpressionImpl _iterable; - /// Initialize a newly created for-each statement whose loop control variable - /// is declared internally (in the for-loop part). The [awaitKeyword] can be - /// `null` if this is not an asynchronous for loop. + /// Initializes a newly created for-each statement whose loop control variable + /// is declared internally (in the for-loop part). + /// + /// The [awaitKeyword] can be `null` if this isn't an asynchronous for loop. ForEachPartsImpl({ required this.inKeyword, required ExpressionImpl iterable, @@ -7300,16 +6825,15 @@ sealed class ForEachPartsImpl extends ForLoopPartsImpl implements ForEachParts { /// forLoopParts ::= /// [DeclaredIdentifier] 'in' [Expression] abstract final class ForEachPartsWithDeclaration implements ForEachParts { - /// Return the declaration of the loop variable. + /// The declaration of the loop variable. DeclaredIdentifier get loopVariable; } final class ForEachPartsWithDeclarationImpl extends ForEachPartsImpl implements ForEachPartsWithDeclaration { - /// The declaration of the loop variable. DeclaredIdentifierImpl _loopVariable; - /// Initialize a newly created for-each statement whose loop control variable + /// Initializes a newly created for-each statement whose loop control variable /// is declared internally (inside the for-loop part). ForEachPartsWithDeclarationImpl({ required DeclaredIdentifierImpl loopVariable, @@ -7351,16 +6875,15 @@ final class ForEachPartsWithDeclarationImpl extends ForEachPartsImpl /// forLoopParts ::= /// [SimpleIdentifier] 'in' [Expression] abstract final class ForEachPartsWithIdentifier implements ForEachParts { - /// Return the loop variable. + /// The loop variable. SimpleIdentifier get identifier; } final class ForEachPartsWithIdentifierImpl extends ForEachPartsImpl implements ForEachPartsWithIdentifier { - /// The loop variable. SimpleIdentifierImpl _identifier; - /// Initialize a newly created for-each statement whose loop control variable + /// Initializes a newly created for-each statement whose loop control variable /// is declared externally (outside the for-loop part). ForEachPartsWithIdentifierImpl({ required SimpleIdentifierImpl identifier, @@ -7401,23 +6924,18 @@ final class ForEachPartsWithIdentifierImpl extends ForEachPartsImpl /// forEachPartsWithPattern ::= /// ( 'final' | 'var' ) [DartPattern] 'in' [Expression] abstract final class ForEachPartsWithPattern implements ForEachParts { - /// Return the `var` or `final` keyword introducing the pattern. + /// The `var` or `final` keyword introducing the pattern. Token get keyword; - /// Returns the annotations associated with this node. + /// The annotations associated with this node. NodeList get metadata; - /// The pattern that will match the expression. + /// The pattern used to match the expression. DartPattern get pattern; } -/// A for-loop part with a pattern. -/// -/// forEachPartsWithPattern ::= -/// ( 'final' | 'var' ) [DartPattern] 'in' [Expression] final class ForEachPartsWithPatternImpl extends ForEachPartsImpl implements ForEachPartsWithPattern { - /// The annotations associated with this node. final NodeListImpl _metadata = NodeListImpl._(); @override @@ -7481,23 +6999,23 @@ final class ForEachPartsWithPatternImpl extends ForEachPartsImpl /// The basic structure of a for element. abstract final class ForElement implements CollectionElement { - /// Return the token representing the 'await' keyword, or `null` if there was - /// no 'await' keyword. + /// The token representing the `await` keyword, or `null` if there was no + /// `await` keyword. Token? get awaitKeyword; - /// Return the body of the loop. + /// The body of the loop. CollectionElement get body; - /// Return the token representing the 'for' keyword. + /// The token representing the `for` keyword. Token get forKeyword; - /// Return the parts of the for element that control the iteration. + /// The parts of the for element that control the iteration. ForLoopParts get forLoopParts; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; } @@ -7516,10 +7034,9 @@ final class ForElementImpl extends CollectionElementImpl implements ForElement { @override final Token rightParenthesis; - /// The body of the loop. CollectionElementImpl _body; - /// Initialize a newly created for element. + /// Initializes a newly created for element. ForElementImpl({ required this.awaitKeyword, required this.forKeyword, @@ -7599,82 +7116,75 @@ sealed class ForLoopPartsImpl extends AstNodeImpl implements ForLoopParts {} /// [NormalFormalParameter] /// | [DefaultFormalParameter] sealed class FormalParameter implements AstNode { - /// The 'covariant' keyword, or `null` if the keyword was not used. + /// The `covariant` keyword, or `null` if the keyword isn't used. Token? get covariantKeyword; - /// Return the element representing this parameter, or `null` if this - /// parameter has not been resolved. + /// The element representing this parameter, or `null` if this parameter + /// hasn't been resolved. ParameterElement? get declaredElement; - /// Return `true` if this parameter was declared with the 'const' modifier. + /// Whether this parameter was declared with the 'const' modifier. bool get isConst; - /// Indicates whether the parameter has an explicit type. + /// Whether the parameter has an explicit type. bool get isExplicitlyTyped; - /// Return `true` if this parameter was declared with the 'final' modifier. + /// Whether this parameter was declared with the 'final' modifier. /// - /// Parameters that are declared with the 'const' modifier will return - /// `false` even though they are implicitly final. + /// Returns `false` for parameters that are declared with the 'const' modifier + /// even though they are implicitly final. bool get isFinal; - /// Return `true` if this parameter is a named parameter. + /// Whether this parameter is a named parameter. /// /// Named parameters can either be required or optional. bool get isNamed; - /// Return `true` if this parameter is an optional parameter. + /// Whether this parameter is an optional parameter. /// /// Optional parameters can either be positional or named. bool get isOptional; - /// Return `true` if this parameter is both an optional and named parameter. + /// Whether this parameter is both an optional and named parameter. bool get isOptionalNamed; - /// Return `true` if this parameter is both an optional and positional + /// Whether this parameter is both an optional and positional /// parameter. bool get isOptionalPositional; - /// Return `true` if this parameter is a positional parameter. + /// Whether this parameter is a positional parameter. /// /// Positional parameters can either be required or optional. bool get isPositional; - /// Return `true` if this parameter is a required parameter. + /// Whether this parameter is a required parameter. /// /// Required parameters can either be positional or named. /// - /// Note: this will return `false` for a named parameter that is annotated - /// with the `@required` annotation. + /// Note: this returns `false` for a named parameter that is annotated with + /// the `@required` annotation. bool get isRequired; - /// Return `true` if this parameter is both a required and named parameter. + /// Whether this parameter is both a required and named parameter. /// - /// Note: this will return `false` for a named parameter that is annotated - /// with the `@required` annotation. + /// Note: this returns `false` for a named parameter that is annotated with + /// the `@required` annotation. bool get isRequiredNamed; - /// Return `true` if this parameter is both a required and positional - /// parameter. + /// Whether this parameter is both a required and positional parameter. bool get isRequiredPositional; - /// Return the annotations associated with this parameter. + /// The annotations associated with this parameter. NodeList get metadata; - /// Return the name of the parameter being declared, or `null` if the - /// parameter doesn't have a name, such as when it's part of a generic - /// function type. + /// The name of the parameter being declared, or `null` if the parameter + /// doesn't have a name, such as when it's part of a generic function type. Token? get name; - /// The 'required' keyword, or `null` if the keyword was not used. + /// The `required` keyword, or `null` if the keyword isn't used. Token? get requiredKeyword; } -/// A node representing a parameter to a function. -/// -/// formalParameter ::= -/// [NormalFormalParameter] -/// | [DefaultFormalParameter] sealed class FormalParameterImpl extends AstNodeImpl implements FormalParameter { @override @@ -7704,7 +7214,7 @@ sealed class FormalParameterImpl extends AstNodeImpl @override bool get isRequiredPositional => kind.isRequiredPositional; - /// Return the kind of this parameter. + /// The kind of this parameter. ParameterKind get kind; @override @@ -7714,11 +7224,11 @@ sealed class FormalParameterImpl extends AstNodeImpl /// The formal parameter list of a method declaration, function declaration, or /// function type alias. /// -/// While the grammar requires all optional formal parameters to follow all of -/// the normal formal parameters and at most one grouping of optional formal -/// parameters, this class does not enforce those constraints. All parameters -/// are flattened into a single list, which can have any or all kinds of -/// parameters (normal, named, and positional) in any order. +/// While the grammar requires all required positional parameters to be first, +/// optionally being followed by either optional positional parameters or named +/// parameters (but not both), this class doesn't enforce those constraints. All +/// parameters are flattened into a single list, which can have any or all kinds +/// of parameters (normal, named, and positional) in any order. /// /// formalParameterList ::= /// '(' ')' @@ -7738,84 +7248,53 @@ sealed class FormalParameterImpl extends AstNodeImpl /// namedFormalParameters ::= /// '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}' abstract final class FormalParameterList implements AstNode { - /// Return the left square bracket ('[') or left curly brace ('{') introducing - /// the optional parameters, or `null` if there are no optional parameters. + /// The left square bracket ('[') or left curly brace ('{') introducing the + /// optional or named parameters, or `null` if there are neither optional nor + /// named parameters. Token? get leftDelimiter; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return a list containing the elements representing the parameters in this - /// list. + /// A list containing the elements representing the parameters in this list. /// - /// The list will contain `null`s if the parameters in this list have not - /// been resolved. + /// The list contains `null`s if the parameters in this list haven't been + /// resolved. List get parameterElements; - /// Return the parameters associated with the method. + /// The parameters associated with the method. NodeList get parameters; - /// Return the right square bracket (']') or right curly brace ('}') - /// terminating the optional parameters, or `null` if there are no optional - /// parameters. + /// The right square bracket (']') or right curly brace ('}') terminating the + /// optional or named parameters, or `null` if there are neither optional nor + /// named parameters. Token? get rightDelimiter; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; } -/// The formal parameter list of a method declaration, function declaration, or -/// function type alias. -/// -/// While the grammar requires all optional formal parameters to follow all of -/// the normal formal parameters and at most one grouping of optional formal -/// parameters, this class does not enforce those constraints. All parameters -/// are flattened into a single list, which can have any or all kinds of -/// parameters (normal, named, and positional) in any order. -/// -/// formalParameterList ::= -/// '(' ')' -/// | '(' normalFormalParameters (',' optionalFormalParameters)? ')' -/// | '(' optionalFormalParameters ')' -/// -/// normalFormalParameters ::= -/// [NormalFormalParameter] (',' [NormalFormalParameter])* -/// -/// optionalFormalParameters ::= -/// optionalPositionalFormalParameters -/// | namedFormalParameters -/// -/// optionalPositionalFormalParameters ::= -/// '[' [DefaultFormalParameter] (',' [DefaultFormalParameter])* ']' -/// -/// namedFormalParameters ::= -/// '{' [DefaultFormalParameter] (',' [DefaultFormalParameter])* '}' final class FormalParameterListImpl extends AstNodeImpl implements FormalParameterList { - /// The left parenthesis. @override final Token leftParenthesis; - /// The parameters associated with the method. final NodeListImpl _parameters = NodeListImpl._(); - /// The left square bracket ('[') or left curly brace ('{') introducing the - /// optional parameters, or `null` if there are no optional parameters. @override final Token? leftDelimiter; - /// The right square bracket (']') or right curly brace ('}') terminating the - /// optional parameters, or `null` if there are no optional parameters. @override final Token? rightDelimiter; - /// The right parenthesis. @override final Token rightParenthesis; - /// Initialize a newly created parameter list. The list of [parameters] can be - /// `null` if there are no parameters. The [leftDelimiter] and - /// [rightDelimiter] can be `null` if there are no optional parameters. + /// Initializes a newly created parameter list. + /// + /// The [leftDelimiter] and [rightDelimiter] can be `null` if there are no + /// optional or named parameters, but it must be the case that either both are + /// `null` or that both are non-`null`. FormalParameterListImpl({ required this.leftParenthesis, required List parameters, @@ -7879,17 +7358,17 @@ final class FormalParameterListImpl extends AstNodeImpl /// [VariableDeclaration] ';' [Expression]? ';' expressionList? /// | [Expression]? ';' [Expression]? ';' expressionList? sealed class ForParts implements ForLoopParts { - /// Return the condition used to determine when to terminate the loop, or - /// `null` if there is no condition. + /// The condition used to determine when to terminate the loop, or `null` if + /// there's no condition. Expression? get condition; - /// Return the semicolon separating the initializer and the condition. + /// The semicolon separating the initializer and the condition. Token get leftSeparator; - /// Return the semicolon separating the condition and the updater. + /// The semicolon separating the condition and the updater. Token get rightSeparator; - /// Return the list of expressions run after each execution of the loop body. + /// The list of expressions run after each execution of the loop body. NodeList get updaters; } @@ -7897,20 +7376,19 @@ sealed class ForPartsImpl extends ForLoopPartsImpl implements ForParts { @override final Token leftSeparator; - /// The condition used to determine when to terminate the loop, or `null` if - /// there is no condition. ExpressionImpl? _condition; @override final Token rightSeparator; - /// The list of expressions run after each execution of the loop body. final NodeListImpl _updaters = NodeListImpl._(); - /// Initialize a newly created for statement. Either the [variableList] or the - /// [initialization] must be `null`. Either the [condition] and the list of - /// [updaters] can be `null` if the loop does not have the corresponding - /// attribute. + /// Initializes a newly created for statement. + /// + /// Either the [variableList] or the [initialization] must be `null`. + /// + /// Either the [condition] and the list of [updaters] can be `null` if the + /// loop doesn't have the corresponding attribute. ForPartsImpl({ required this.leftSeparator, required ExpressionImpl? condition, @@ -7957,20 +7435,18 @@ sealed class ForPartsImpl extends ForLoopPartsImpl implements ForParts { /// forLoopParts ::= /// [VariableDeclarationList] ';' [Expression]? ';' expressionList? abstract final class ForPartsWithDeclarations implements ForParts { - /// Return the declaration of the loop variables. + /// The declaration of the loop variables. VariableDeclarationList get variables; } final class ForPartsWithDeclarationsImpl extends ForPartsImpl implements ForPartsWithDeclarations { - /// The declaration of the loop variables, or `null` if there are no - /// variables. Note that a for statement cannot have both a variable list and - /// an initialization expression, but can validly have neither. VariableDeclarationListImpl _variableList; - /// Initialize a newly created for statement. Both the [condition] and the - /// list of [updaters] can be `null` if the loop does not have the - /// corresponding attribute. + /// Initializes a newly created for statement. + /// + /// Both the [condition] and the list of [updaters] can be `null` if the loop + /// doesn't have the corresponding attribute. ForPartsWithDeclarationsImpl({ required VariableDeclarationListImpl variableList, required super.leftSeparator, @@ -8014,21 +7490,22 @@ final class ForPartsWithDeclarationsImpl extends ForPartsImpl /// forLoopParts ::= /// [Expression]? ';' [Expression]? ';' expressionList? abstract final class ForPartsWithExpression implements ForParts { - /// Return the initialization expression, or `null` if there is no - /// initialization expression. + /// The initialization expression, or `null` if there's no initialization + /// expression. + /// + /// Note that a for statement can't have both a variable list and an + /// initialization expression, but can validly have neither. Expression? get initialization; } final class ForPartsWithExpressionImpl extends ForPartsImpl implements ForPartsWithExpression { - /// The initialization expression, or `null` if there is no initialization - /// expression. Note that a for statement cannot have both a variable list and - /// an initialization expression, but can validly have neither. ExpressionImpl? _initialization; - /// Initialize a newly created for statement. Both the [condition] and the - /// list of [updaters] can be `null` if the loop does not have the - /// corresponding attribute. + /// Initializes a newly created for statement. + /// + /// Both the [condition] and the list of [updaters] can be `null` if the loop + /// doesn't have the corresponding attribute. ForPartsWithExpressionImpl({ required ExpressionImpl? initialization, required super.leftSeparator, @@ -8065,21 +7542,16 @@ final class ForPartsWithExpressionImpl extends ForPartsImpl } } -/// The parts of a for loop that control the iteration when there is a pattern +/// The parts of a for loop that control the iteration when there's a pattern /// declaration as part of the for loop. /// /// forLoopParts ::= /// [PatternVariableDeclaration] ';' [Expression]? ';' expressionList? abstract final class ForPartsWithPattern implements ForParts { - /// Return the declaration of the loop variables. + /// The declaration of the loop variables. PatternVariableDeclaration get variables; } -/// The parts of a for loop that control the iteration when there is a pattern -/// declaration as part of the for loop. -/// -/// forLoopParts ::= -/// [PatternVariableDeclaration] ';' [Expression]? ';' expressionList? final class ForPartsWithPatternImpl extends ForPartsImpl implements ForPartsWithPattern { @override @@ -8123,29 +7595,24 @@ final class ForPartsWithPatternImpl extends ForPartsImpl /// | [Expression]? ';' [Expression]? ';' expressionList? /// | [DeclaredIdentifier] 'in' [Expression] /// | [SimpleIdentifier] 'in' [Expression] -/// -/// This is the class that is used to represent a for loop when either the -/// 'control-flow-collections' or 'spread-collections' experiments are enabled. -/// If neither of those experiments are enabled, then either `ForStatement` or -/// `ForEachStatement` will be used. abstract final class ForStatement implements Statement { - /// Return the token representing the 'await' keyword, or `null` if there is - /// no 'await' keyword. + /// The token representing the `await` keyword, or `null` if there's no + /// `await` keyword. Token? get awaitKeyword; - /// Return the body of the loop. + /// The body of the loop. Statement get body; - /// Return the token representing the 'for' keyword. + /// The token representing the `for` keyword. Token get forKeyword; - /// Return the parts of the for element that control the iteration. + /// The parts of the for element that control the iteration. ForLoopParts get forLoopParts; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; } @@ -8164,10 +7631,9 @@ final class ForStatementImpl extends StatementImpl implements ForStatement { @override final Token rightParenthesis; - /// The body of the loop. StatementImpl _body; - /// Initialize a newly created for statement. + /// Initializes a newly created for statement. ForStatementImpl({ required this.awaitKeyword, required this.forKeyword, @@ -8228,21 +7694,21 @@ final class ForStatementImpl extends StatementImpl implements ForStatement { /// | [ExpressionFunctionBody] /// | [NativeFunctionBody] sealed class FunctionBody implements AstNode { - /// Return `true` if this function body is asynchronous. + /// Whether this function body is asynchronous. bool get isAsynchronous; - /// Return `true` if this function body is a generator. + /// Whether this function body is a generator. bool get isGenerator; - /// Return `true` if this function body is synchronous. + /// Whether this function body is synchronous. bool get isSynchronous; - /// Return the token representing the 'async' or 'sync' keyword, or `null` if - /// there is no such keyword. + /// The token representing the `async` or `sync` keyword, or `null` if there's + /// no such keyword. Token? get keyword; - /// Return the star following the 'async' or 'sync' keyword, or `null` if - /// there is no star. + /// The star following the `async` or `sync` keyword, or `null` if there's no + /// star. Token? get star; /// If [variable] is a local variable or parameter declared anywhere within @@ -8250,51 +7716,38 @@ sealed class FunctionBody implements AstNode { /// boolean indicating whether [variable] is potentially mutated within the /// scope of its declaration. /// - /// If [variable] is not a local variable or parameter declared within the top + /// If [variable] isn't a local variable or parameter declared within the top /// level function or method containing this [FunctionBody], return `false`. /// - /// Throws an exception if resolution has not yet been performed. + /// Throws an exception if resolution hasn't been performed. bool isPotentiallyMutatedInScope(VariableElement variable); } -/// A node representing the body of a function or method. -/// -/// functionBody ::= -/// [BlockFunctionBody] -/// | [EmptyFunctionBody] -/// | [ExpressionFunctionBody] sealed class FunctionBodyImpl extends AstNodeImpl implements FunctionBody { /// Additional information about local variables and parameters that are - /// declared within this function body or any enclosing function body. `null` - /// if resolution has not yet been performed. + /// declared within this function body or any enclosing function body, or + /// `null` if resolution hasn't yet been performed. LocalVariableInfo? localVariableInfo; - /// Return `true` if this function body is asynchronous. @override bool get isAsynchronous => false; - /// Return `true` if this function body is a generator. @override bool get isGenerator => false; - /// Return `true` if this function body is synchronous. @override bool get isSynchronous => true; - /// Return the token representing the 'async' or 'sync' keyword, or `null` if - /// there is no such keyword. @override Token? get keyword => null; - /// Return the star following the 'async' or 'sync' keyword, or `null` if - /// there is no star. @override Token? get star => null; @override bool isPotentiallyMutatedInScope(VariableElement variable) { if (localVariableInfo == null) { - throw StateError('Resolution has not yet been performed'); + throw StateError('Resolution has not been performed'); } return localVariableInfo!.potentiallyMutatedInScope.contains(variable); } @@ -8302,7 +7755,7 @@ sealed class FunctionBodyImpl extends AstNodeImpl implements FunctionBody { /// Dispatch this function body to the resolver, imposing [imposedType] as the /// return type context for `return` statements. /// - /// Return value is the actual return type of the method. + /// Returns value is the actual return type of the method. DartType resolve(ResolverVisitor resolver, DartType? imposedType); } @@ -8318,76 +7771,64 @@ sealed class FunctionBodyImpl extends AstNodeImpl implements FunctionBody { /// functionSignature ::= /// [Type]? ('get' | 'set')? name [FormalParameterList] abstract final class FunctionDeclaration implements NamedCompilationUnitMember { - /// The 'augment' keyword. + /// The `augment` keyword, or `null` if there is no `augment` keyword. @experimental Token? get augmentKeyword; @override ExecutableElement? get declaredElement; - /// Return the token representing the 'external' keyword, or `null` if this is - /// not an external function. + /// The token representing the `external` keyword, or `null` if this isn't an + /// external function. Token? get externalKeyword; - /// Return the function expression being wrapped. + /// The function expression being wrapped. FunctionExpression get functionExpression; - /// Return `true` if this function declares a getter. + /// Whether this function declares a getter. bool get isGetter; - /// Return `true` if this function declares a setter. + /// Whether this function declares a setter. bool get isSetter; - /// Return the token representing the 'get' or 'set' keyword, or `null` if - /// this is a function declaration rather than a property declaration. + /// The token representing the `get` or `set` keyword, or `null` if this is a + /// function declaration rather than a property declaration. Token? get propertyKeyword; - /// Return the return type of the function, or `null` if no return type was - /// declared. + /// The return type of the function, or `null` if no return type was declared. TypeAnnotation? get returnType; } -/// A function declaration. -/// -/// Wrapped in a [FunctionDeclarationStatementImpl] to represent a local -/// function declaration, otherwise a top-level function declaration. -/// -/// functionDeclaration ::= -/// 'external' functionSignature -/// | functionSignature [FunctionBody] -/// -/// functionSignature ::= -/// [Type]? ('get' | 'set')? [SimpleIdentifier] [FormalParameterList] final class FunctionDeclarationImpl extends NamedCompilationUnitMemberImpl implements FunctionDeclaration { @override final Token? augmentKeyword; - /// The token representing the 'external' keyword, or `null` if this is not an - /// external function. @override final Token? externalKeyword; - /// The return type of the function, or `null` if no return type was declared. TypeAnnotationImpl? _returnType; - /// The token representing the 'get' or 'set' keyword, or `null` if this is a - /// function declaration rather than a property declaration. @override final Token? propertyKeyword; - /// The function expression being wrapped. FunctionExpressionImpl _functionExpression; @override ExecutableElementImpl? declaredElement; - /// Initialize a newly created function declaration. Either or both of the - /// [comment] and [metadata] can be `null` if the function does not have the - /// corresponding attribute. The [externalKeyword] can be `null` if the - /// function is not an external function. The [returnType] can be `null` if no - /// return type was specified. The [propertyKeyword] can be `null` if the - /// function is neither a getter or a setter. + /// Initializes a newly created function declaration. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// function doesn't have the corresponding attribute. + /// + /// The [externalKeyword] can be `null` if the function isn't an external + /// function. + /// + /// The [returnType] can be `null` if no return type was specified. + /// + /// The [propertyKeyword] can be `null` if the function is neither a getter or + /// a setter. FunctionDeclarationImpl({ required super.comment, required super.metadata, @@ -8457,17 +7898,15 @@ final class FunctionDeclarationImpl extends NamedCompilationUnitMemberImpl /// A [FunctionDeclaration] used as a statement. abstract final class FunctionDeclarationStatement implements Statement { - /// Return the function declaration being wrapped. + /// The function declaration being wrapped. FunctionDeclaration get functionDeclaration; } -/// A [FunctionDeclaration] used as a statement. final class FunctionDeclarationStatementImpl extends StatementImpl implements FunctionDeclarationStatement { - /// The function declaration being wrapped. FunctionDeclarationImpl _functionDeclaration; - /// Initialize a newly created function declaration statement. + /// Initializes a newly created function declaration statement. FunctionDeclarationStatementImpl({ required FunctionDeclarationImpl functionDeclaration, }) : _functionDeclaration = functionDeclaration { @@ -8506,48 +7945,40 @@ final class FunctionDeclarationStatementImpl extends StatementImpl /// functionExpression ::= /// [TypeParameterList]? [FormalParameterList] [FunctionBody] abstract final class FunctionExpression implements Expression { - /// Return the body of the function. + /// The body of the function. FunctionBody get body; - /// Return the element associated with the function, or `null` if the AST - /// structure has not been resolved. + /// The element associated with the function, or `null` if the AST structure + /// hasn't been resolved. ExecutableElement? get declaredElement; - /// Return the parameters associated with the function, or `null` if the - /// function is part of a top-level getter. + /// The parameters associated with the function, or `null` if the function is + /// part of a top-level getter. FormalParameterList? get parameters; - /// Return the type parameters associated with this method, or `null` if this - /// method is not a generic method. + /// The type parameters associated with this method, or `null` if this method + /// isn't a generic method. TypeParameterList? get typeParameters; } -/// A function expression. -/// -/// functionExpression ::= -/// [TypeParameterList]? [FormalParameterList] [FunctionBody] final class FunctionExpressionImpl extends ExpressionImpl implements FunctionExpression { - /// The type parameters associated with the method, or `null` if the method is - /// not a generic method. TypeParameterListImpl? _typeParameters; - /// The parameters associated with the function, or `null` if the function is - /// part of a top-level getter. FormalParameterListImpl? _parameters; - /// The body of the function. FunctionBodyImpl _body; - /// If resolution has been performed, this boolean indicates whether a - /// function type was supplied via context for this function expression. - /// `false` if resolution hasn't been performed yet. + /// Whether a function type was supplied via context for this function + /// expression. + /// + /// Returns `false` if resolution hasn't been performed yet. bool wasFunctionTypeSupplied = false; @override ExecutableElementImpl? declaredElement; - /// Initialize a newly created function declaration. + /// Initializes a newly created function declaration. FunctionExpressionImpl({ required TypeParameterListImpl? typeParameters, required FormalParameterListImpl? parameters, @@ -8631,36 +8062,25 @@ final class FunctionExpressionImpl extends ExpressionImpl /// [Expression] [TypeArgumentList]? [ArgumentList] abstract final class FunctionExpressionInvocation implements NullShortableExpression, InvocationExpression { - /// Return the expression producing the function being invoked. + /// The expression producing the function being invoked. @override Expression get function; - /// Return the element associated with the function being invoked based on - /// static type information, or `null` if the AST structure has not been - /// resolved or the function could not be resolved. + /// The element associated with the function being invoked based on static + /// type information, or `null` if the AST structure hasn't been resolved or + /// the function couldn't be resolved. ExecutableElement? get staticElement; } -/// The invocation of a function resulting from evaluating an expression. -/// Invocations of methods and other forms of functions are represented by -/// [MethodInvocation] nodes. Invocations of getters and setters are represented -/// by either [PrefixedIdentifier] or [PropertyAccess] nodes. -/// -/// functionExpressionInvocation ::= -/// [Expression] [TypeArgumentList]? [ArgumentList] final class FunctionExpressionInvocationImpl extends InvocationExpressionImpl with NullShortableExpressionImpl implements FunctionExpressionInvocation { - /// The expression producing the function being invoked. ExpressionImpl _function; - /// The element associated with the function being invoked based on static - /// type information, or `null` if the AST structure has not been resolved or - /// the function could not be resolved. @override ExecutableElement? staticElement; - /// Initialize a newly created function expression invocation. + /// Initializes a newly created function expression invocation. FunctionExpressionInvocationImpl({ required ExpressionImpl function, required super.typeArguments, @@ -8716,36 +8136,34 @@ final class FunctionExpressionInvocationImpl extends InvocationExpressionImpl } /// An expression representing a reference to a function, possibly with type -/// arguments applied to it, e.g. the expression `print` in `var x = print;`. +/// arguments applied to it. +/// +/// For example, the expression `print` in `var x = print;`. abstract final class FunctionReference implements Expression, CommentReferableExpression { /// The function being referenced. /// - /// In error-free code, this will be either a SimpleIdentifier (indicating a - /// function that is in scope), a PrefixedIdentifier (indicating a either + /// In error-free code, this is either a [SimpleIdentifier] (indicating a + /// function that is in scope), a [PrefixedIdentifier] (indicating a either /// function imported via prefix or a static method in a class), or a - /// PropertyAccess (indicating a static method in a class imported via - /// prefix). In code with errors, this could be other kinds of expressions - /// (e.g. `(...)` parses as a FunctionReference whose referent is a - /// ParenthesizedExpression. + /// [PropertyAccess] (indicating a static method in a class imported via + /// prefix). In code with errors, this could be other kinds of expressions. + /// For example, `(...)` parses as a [FunctionReference] whose referent + /// is a [ParenthesizedExpression]. Expression get function; /// The type arguments being applied to the function, or `null` if there are /// no type arguments. TypeArgumentList? get typeArguments; - /// The actual type arguments being applied to the function, either explicitly - /// specified in [typeArguments], or inferred. - /// - /// If the AST has been resolved, never returns `null`, returns an empty list - /// if the function does not have type parameters. + /// The actual type arguments being applied to the function, either + /// explicitly specified in [typeArguments], or inferred. /// - /// Returns `null` if the AST structure has not been resolved. + /// An empty list if the function doesn't have type parameters, or `null` if + /// the AST structure hasn't been resolved. List? get typeArgumentTypes; } -/// An expression representing a reference to a function, possibly with type -/// arguments applied to it, e.g. the expression `print` in `var x = print;`. final class FunctionReferenceImpl extends CommentReferableExpressionImpl implements FunctionReference { ExpressionImpl _function; @@ -8811,7 +8229,8 @@ final class FunctionReferenceImpl extends CommentReferableExpressionImpl /// A function type alias. /// /// functionTypeAlias ::= -/// 'typedef' functionPrefix [TypeParameterList]? [FormalParameterList] ';' +/// 'typedef' functionPrefix [TypeParameterList]? +/// [FormalParameterList] ';' /// /// functionPrefix ::= /// [TypeAnnotation]? [SimpleIdentifier] @@ -8819,46 +8238,37 @@ abstract final class FunctionTypeAlias implements TypeAlias { @override TypeAliasElement? get declaredElement; - /// Return the parameters associated with the function type. + /// The parameters associated with the function type. FormalParameterList get parameters; - /// Return the return type of the function type being defined, or `null` if no - /// return type was given. + /// The return type of the function type being defined, or `null` if no return + /// type was given. TypeAnnotation? get returnType; - /// Return the type parameters for the function type, or `null` if the - /// function type does not have any type parameters. + /// The type parameters for the function type, or `null` if the function type + /// doesn't have any type parameters. TypeParameterList? get typeParameters; } -/// A function type alias. -/// -/// functionTypeAlias ::= -/// 'typedef' functionPrefix [TypeParameterList]? [FormalParameterList] ';' -/// -/// functionPrefix ::= -/// [TypeAnnotation]? [SimpleIdentifier] final class FunctionTypeAliasImpl extends TypeAliasImpl implements FunctionTypeAlias { - /// The name of the return type of the function type being defined, or `null` - /// if no return type was given. TypeAnnotationImpl? _returnType; - /// The type parameters for the function type, or `null` if the function type - /// does not have any type parameters. TypeParameterListImpl? _typeParameters; - /// The parameters associated with the function type. FormalParameterListImpl _parameters; @override TypeAliasElementImpl? declaredElement; - /// Initialize a newly created function type alias. Either or both of the - /// [comment] and [metadata] can be `null` if the function does not have the - /// corresponding attribute. The [returnType] can be `null` if no return type - /// was specified. The [typeParameters] can be `null` if the function has no - /// type parameters. + /// Initializes a newly created function type alias. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// function doesn't have the corresponding attribute. + /// + /// The [returnType] can be `null` if no return type was specified. + /// + /// The [typeParameters] can be `null` if the function has no type parameters. FunctionTypeAliasImpl({ required super.comment, required super.metadata, @@ -8928,48 +8338,41 @@ abstract final class FunctionTypedFormalParameter @override Token get name; - /// Return the parameters of the function-typed parameter. + /// The parameters of the function-typed parameter. FormalParameterList get parameters; - /// Return the question mark indicating that the function type is nullable, or - /// `null` if there is no question mark. Having a nullable function type means - /// that the parameter can be null. + /// The question mark indicating that the function type is nullable, or `null` + /// if there's no question mark. + /// + /// Having a nullable function type means that the parameter can be null. Token? get question; - /// Return the return type of the function, or `null` if the function does not - /// have a return type. + /// The return type of the function, or `null` if the function doesn't have a + /// return type. TypeAnnotation? get returnType; - /// Return the type parameters associated with this function, or `null` if - /// this function is not a generic function. + /// The type parameters associated with this function, or `null` if this + /// function isn't a generic function. TypeParameterList? get typeParameters; } -/// A function-typed formal parameter. -/// -/// functionSignature ::= -/// [NamedType]? [SimpleIdentifier] [TypeParameterList]? -/// [FormalParameterList] '?'? final class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl implements FunctionTypedFormalParameter { - /// The return type of the function, or `null` if the function does not have a - /// return type. TypeAnnotationImpl? _returnType; - /// The type parameters associated with the function, or `null` if the - /// function is not a generic function. TypeParameterListImpl? _typeParameters; - /// The parameters of the function-typed parameter. FormalParameterListImpl _parameters; @override final Token? question; - /// Initialize a newly created formal parameter. Either or both of the - /// [comment] and [metadata] can be `null` if the parameter does not have the - /// corresponding attribute. The [returnType] can be `null` if no return type - /// was specified. + /// Initializes a newly created formal parameter. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// parameter doesn't have the corresponding attribute. + /// + /// The [returnType] can be `null` if no return type was specified. FunctionTypedFormalParameterImpl({ required super.comment, required super.metadata, @@ -9087,63 +8490,30 @@ final class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl /// optionalPositionalParameterTypes ::= /// [ normalParameterTypes ,? ] abstract final class GenericFunctionType implements TypeAnnotation { - /// Return the keyword 'Function'. + /// The `Function` keyword. Token get functionKeyword; - /// Return the parameters associated with the function type. + /// The parameters associated with the function type. FormalParameterList get parameters; - /// Return the return type of the function type being defined, or `null` if - /// no return type was given. + /// The return type of the function type being defined, or `null` if no return + /// type was given. TypeAnnotation? get returnType; - /// Return the type parameters for the function type, or `null` if the - /// function type does not have any type parameters. + /// The type parameters for the function type, or `null` if the function type + /// doesn't have any type parameters. TypeParameterList? get typeParameters; } -/// An anonymous function type. -/// -/// functionType ::= -/// [TypeAnnotation]? 'Function' [TypeParameterList]? -/// [FormalParameterList] -/// -/// where the FormalParameterList is being used to represent the following -/// grammar, despite the fact that FormalParameterList can represent a much -/// larger grammar than the one below. This is done in order to simplify the -/// implementation. -/// -/// parameterTypeList ::= -/// () | -/// ( normalParameterTypes ,? ) | -/// ( normalParameterTypes , optionalParameterTypes ) | -/// ( optionalParameterTypes ) -/// namedParameterTypes ::= -/// { namedParameterType (, namedParameterType)* ,? } -/// namedParameterType ::= -/// [TypeAnnotation]? [SimpleIdentifier] -/// normalParameterTypes ::= -/// normalParameterType (, normalParameterType)* -/// normalParameterType ::= -/// [TypeAnnotation] [SimpleIdentifier]? -/// optionalParameterTypes ::= -/// optionalPositionalParameterTypes | namedParameterTypes -/// optionalPositionalParameterTypes ::= -/// [ normalParameterTypes ,? ] final class GenericFunctionTypeImpl extends TypeAnnotationImpl implements GenericFunctionType { - /// The name of the return type of the function type being defined, or - /// `null` if no return type was given. TypeAnnotationImpl? _returnType; @override final Token functionKeyword; - /// The type parameters for the function type, or `null` if the function type - /// does not have any type parameters. TypeParameterListImpl? _typeParameters; - /// The parameters associated with the function type. FormalParameterListImpl _parameters; @override @@ -9152,11 +8522,11 @@ final class GenericFunctionTypeImpl extends TypeAnnotationImpl @override DartType? type; - /// Return the element associated with the function type, or `null` if the - /// AST structure has not been resolved. + /// The element associated with the function type, or `null` if the AST + /// structure hasn't been resolved. GenericFunctionTypeElementImpl? declaredElement; - /// Initialize a newly created generic function type. + /// Initializes a newly created generic function type. GenericFunctionTypeImpl({ required TypeAnnotationImpl? returnType, required this.functionKeyword, @@ -9191,13 +8561,9 @@ final class GenericFunctionTypeImpl extends TypeAnnotationImpl _returnType = _becomeParentOf(type); } - /// Return the type parameters for the function type, or `null` if the - /// function type does not have any type parameters. @override TypeParameterListImpl? get typeParameters => _typeParameters; - /// Set the type parameters for the function type to the given list of - /// [typeParameters]. set typeParameters(TypeParameterListImpl? typeParameters) { _typeParameters = _becomeParentOf(typeParameters); } @@ -9226,37 +8592,29 @@ final class GenericFunctionTypeImpl extends TypeAnnotationImpl /// A generic type alias. /// /// functionTypeAlias ::= -/// 'typedef' [SimpleIdentifier] [TypeParameterList]? = [FunctionType] ';' +/// 'typedef' [SimpleIdentifier] [TypeParameterList]? = +/// [FunctionType] ';' abstract final class GenericTypeAlias implements TypeAlias { - /// Return the equal sign separating the name being defined from the function - /// type. + /// The equal sign separating the name being defined from the function type. Token get equals; - /// Return the type of function being defined by the alias. - /// - /// When the non-function type aliases feature is enabled and the denoted - /// type is not a [GenericFunctionType], return `null`. + /// The type of function being defined by the alias, or `null` if the + /// non-function type aliases feature is enabled and the denoted type isn't a + /// [GenericFunctionType]. GenericFunctionType? get functionType; - /// Return the type being defined by the alias. + /// The type being defined by the alias. TypeAnnotation get type; - /// Return the type parameters for the function type, or `null` if the - /// function type does not have any type parameters. + /// The type parameters for the function type, or `null` if the function type + /// doesn't have any type parameters. TypeParameterList? get typeParameters; } -/// A generic type alias. -/// -/// functionTypeAlias ::= -/// 'typedef' [SimpleIdentifier] [TypeParameterList]? = [FunctionType] ';' final class GenericTypeAliasImpl extends TypeAliasImpl implements GenericTypeAlias { - /// The type being defined by the alias. TypeAnnotationImpl _type; - /// The type parameters for the function type, or `null` if the function - /// type does not have any type parameters. TypeParameterListImpl? _typeParameters; @override @@ -9265,10 +8623,12 @@ final class GenericTypeAliasImpl extends TypeAliasImpl @override ElementImpl? declaredElement; - /// Returns a newly created generic type alias. Either or both of the - /// [comment] and [metadata] can be `null` if the variable list does not have - /// the corresponding attribute. The [typeParameters] can be `null` if there - /// are no type parameters. + /// Initializes a newly created generic type alias. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// variable list doesn't have the corresponding attribute. + /// + /// The [typeParameters] can be `null` if there are no type parameters. GenericTypeAliasImpl({ required super.comment, required super.metadata, @@ -9284,11 +8644,6 @@ final class GenericTypeAliasImpl extends TypeAliasImpl _becomeParentOf(_type); } - /// The type of function being defined by the alias. - /// - /// If the non-function type aliases feature is enabled, a type alias may have - /// a [_type] which is not a [GenericFunctionTypeImpl]. In that case `null` - /// is returned. @override GenericFunctionType? get functionType { var type = _type; @@ -9302,7 +8657,6 @@ final class GenericTypeAliasImpl extends TypeAliasImpl @override TypeAnnotationImpl get type => _type; - /// Set the type being defined by the alias to the given [TypeAnnotation]. set type(TypeAnnotationImpl typeAnnotation) { _type = _becomeParentOf(typeAnnotation); } @@ -9341,17 +8695,13 @@ final class GenericTypeAliasImpl extends TypeAliasImpl /// guardedPattern ::= /// [DartPattern] [WhenClause]? abstract final class GuardedPattern implements AstNode { - /// Return the pattern controlling whether the statements will be executed. + /// The pattern controlling whether the statements are executed. DartPattern get pattern; - /// Return the clause controlling whether the statements will be executed. + /// The clause controlling whether the statements are be executed. WhenClause? get whenClause; } -/// The `case` clause that can optionally appear in an `if` statement. -/// -/// caseClause ::= -/// 'case' [DartPattern] [WhenClause]? final class GuardedPatternImpl extends AstNodeImpl implements GuardedPattern { @override final DartPatternImpl pattern; @@ -9392,28 +8742,21 @@ final class GuardedPatternImpl extends AstNodeImpl implements GuardedPattern { } } -/// A combinator that restricts the names being imported to those that are not +/// A combinator that restricts the names being imported to those that aren't /// in a given list. /// /// hideCombinator ::= /// 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* abstract final class HideCombinator implements Combinator { - /// Return the list of names from the library that are hidden by this - /// combinator. + /// The list of names from the library that are hidden by this combinator. NodeList get hiddenNames; } -/// A combinator that restricts the names being imported to those that are not -/// in a given list. -/// -/// hideCombinator ::= -/// 'hide' [SimpleIdentifier] (',' [SimpleIdentifier])* final class HideCombinatorImpl extends CombinatorImpl implements HideCombinator { - /// The list of names from the library that are hidden by this combinator. final NodeListImpl _hiddenNames = NodeListImpl._(); - /// Initialize a newly created import show combinator. + /// Initializes a newly created import show combinator. HideCombinatorImpl({ required super.keyword, required List hiddenNames, @@ -9447,27 +8790,20 @@ final class HideCombinatorImpl extends CombinatorImpl /// [SimpleIdentifier] /// | [PrefixedIdentifier] sealed class Identifier implements Expression, CommentReferableExpression { - /// Return the lexical representation of the identifier. + /// The lexical representation of the identifier. String get name; - /// Return the element associated with this identifier based on static type - /// information, or `null` if the AST structure has not been resolved or if - /// this identifier could not be resolved. - /// - /// One example of the latter case is an identifier that is not defined - /// within the scope in which it appears. + /// The element associated with this identifier based on static type + /// information, or `null` if the AST structure hasn't been resolved or if + /// this identifier couldn't be resolved. One example of the latter case is an + /// identifier that isn't defined within the scope in which it appears. Element? get staticElement; - /// Return `true` if the given [name] is visible only within the library in - /// which it is declared. + /// Returns `true` if the given [name] is visible only within the library in + /// which it's declared. static bool isPrivateName(String name) => name.isNotEmpty && name[0] == "_"; } -/// A node that represents an identifier. -/// -/// identifier ::= -/// [SimpleIdentifier] -/// | [PrefixedIdentifier] sealed class IdentifierImpl extends CommentReferableExpressionImpl implements Identifier { @override @@ -9476,38 +8812,36 @@ sealed class IdentifierImpl extends CommentReferableExpressionImpl /// The basic structure of an if element. abstract final class IfElement implements CollectionElement { - /// Return the `case` clause used to match a pattern against the [expression]. + /// The `case` clause used to match a pattern against the [expression]. CaseClause? get caseClause; - /// Return the condition used to determine which of the statements is executed - /// next. + /// The condition used to determine which of the statements is executed next. @Deprecated('Use expression instead') Expression get condition; - /// Return the statement that is executed if the condition evaluates to - /// `false`, or `null` if there is no else statement. + /// The statement that is executed if the condition evaluates to `false`, or + /// `null` if there's no else statement. CollectionElement? get elseElement; - /// Return the token representing the 'else' keyword, or `null` if there is no - /// else statement. + /// The token representing the `else` keyword, or `null` if there's no else + /// expression. Token? get elseKeyword; - /// Return the expression used to either determine which of the statements is + /// The expression used to either determine which of the statements is /// executed next or to compute the value to be matched against the pattern in /// the `case` clause. Expression get expression; - /// Return the token representing the 'if' keyword. + /// The token representing the `if` keyword. Token get ifKeyword; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; - /// Return the statement that is executed if the condition evaluates to - /// `true`. + /// The statement that is executed if the condition evaluates to `true`. CollectionElement get thenElement; } @@ -9530,14 +8864,11 @@ final class IfElementImpl extends CollectionElementImpl @override final Token? elseKeyword; - /// The element to be executed if the condition is `true`. CollectionElementImpl _thenElement; - /// The element to be executed if the condition is `false`, or `null` if there - /// is no such element. CollectionElementImpl? _elseElement; - /// Initialize a newly created for element. + /// Initializes a newly created for element. IfElementImpl({ required this.ifKeyword, required this.leftParenthesis, @@ -9625,10 +8956,10 @@ final class IfElementImpl extends CollectionElementImpl sealed class IfElementOrStatementImpl implements AstNodeImpl { - /// Return the `case` clause used to match a pattern against the [expression]. + /// The `case` clause used to match a pattern against the [expression]. CaseClauseImpl? get caseClause; - /// Return the expression used to either determine which of the statements is + /// The expression used to either determine which of the statements is /// executed next or to compute the value matched against the pattern in the /// `case` clause. ExpressionImpl get expression; @@ -9646,47 +8977,40 @@ sealed class IfElementOrStatementImpl /// 'if' '(' [Expression] [CaseClause]? ')'[Statement] /// ('else' [Statement])? abstract final class IfStatement implements Statement { - /// Return the `case` clause used to match a pattern against the [expression]. + /// The `case` clause used to match a pattern against the [expression]. CaseClause? get caseClause; - /// Return the condition used to determine which of the statements is executed - /// next. + /// The condition used to determine which of the statements is executed next. @Deprecated('Use expression instead') Expression get condition; - /// Return the token representing the 'else' keyword, or `null` if there is no - /// else statement. + /// The token representing the `else` keyword, or `null` if there's no else + /// statement. Token? get elseKeyword; - /// Return the statement that is executed if the condition evaluates to - /// `false`, or `null` if there is no else statement. + /// The statement that is executed if the condition evaluates to `false`, or + /// `null` if there's no else statement. Statement? get elseStatement; - /// Return the expression used to either determine which of the statements is + /// The expression used to either determine which of the statements is /// executed next or to compute the value matched against the pattern in the /// `case` clause. Expression get expression; - /// Return the token representing the 'if' keyword. + /// The token representing the `if` keyword. // TODO(scheglov): Extract shared `IfCondition`, see the patterns spec. Token get ifKeyword; - /// Return the left parenthesis. + /// The left parenthesis. Token get leftParenthesis; - /// Return the right parenthesis. + /// The right parenthesis. Token get rightParenthesis; - /// Return the statement that is executed if the condition evaluates to - /// `true`. + /// The statement that is executed if the condition evaluates to `true`. Statement get thenStatement; } -/// An if statement. -/// -/// ifStatement ::= -/// 'if' '(' [Expression] [CaseClause]? ')'[Statement] -/// ('else' [Statement])? final class IfStatementImpl extends StatementImpl implements IfStatement, IfElementOrStatementImpl { @override @@ -9695,7 +9019,6 @@ final class IfStatementImpl extends StatementImpl @override final Token leftParenthesis; - /// The condition used to determine which of the branches is executed next. ExpressionImpl _expression; @override @@ -9707,15 +9030,14 @@ final class IfStatementImpl extends StatementImpl @override final Token? elseKeyword; - /// The statement that is executed if the condition evaluates to `true`. StatementImpl _thenStatement; - /// The statement that is executed if the condition evaluates to `false`, or - /// `null` if there is no else statement. StatementImpl? _elseStatement; - /// Initialize a newly created if statement. The [elseKeyword] and - /// [elseStatement] can be `null` if there is no else clause. + /// Initializes a newly created if statement. + /// + /// The [elseKeyword] and [elseStatement] can be `null` if there's no else + /// clause. IfStatementImpl({ required this.ifKeyword, required this.leftParenthesis, @@ -9804,27 +9126,21 @@ final class IfStatementImpl extends StatementImpl /// implementsClause ::= /// 'implements' [NamedType] (',' [NamedType])* abstract final class ImplementsClause implements AstNode { - /// Return the token representing the 'implements' keyword. + /// The token representing the `implements` keyword. Token get implementsKeyword; - /// Return the list of the interfaces that are being implemented. + /// The list of the interfaces that are being implemented. NodeList get interfaces; } -/// The "implements" clause in an class declaration. -/// -/// implementsClause ::= -/// 'implements' [NamedType] (',' [NamedType])* final class ImplementsClauseImpl extends AstNodeImpl implements ImplementsClause { - /// The token representing the 'implements' keyword. @override final Token implementsKeyword; - /// The interfaces that are being implemented. final NodeListImpl _interfaces = NodeListImpl._(); - /// Initialize a newly created implements clause. + /// Initializes a newly created implements clause. ImplementsClauseImpl({ required this.implementsKeyword, required List interfaces, @@ -9858,16 +9174,16 @@ final class ImplementsClauseImpl extends AstNodeImpl /// An expression representing an implicit 'call' method reference. /// -/// Objects of this type are not produced directly by the parser (because the -/// parser cannot tell whether an expression refers to a callable type); they +/// Objects of this type aren't produced directly by the parser (because the +/// parser can't tell whether an expression refers to a callable type); they /// are produced at resolution time. abstract final class ImplicitCallReference implements MethodReferenceExpression { - /// Return the expression from which a `call` method is being referenced. + /// The expression from which a `call` method is being referenced. Expression get expression; - /// Return the element associated with the implicit 'call' reference based on - /// the static types. + /// The element associated with the implicit `call` reference based on the + /// static types. @override MethodElement get staticElement; @@ -9878,7 +9194,7 @@ abstract final class ImplicitCallReference /// The actual type arguments being applied to the tear-off, either explicitly /// specified in [typeArguments], or inferred. /// - /// Returns an empty list if the 'call' method does not have type parameters. + /// An empty list if the 'call' method doesn't have type parameters. List get typeArgumentTypes; } @@ -9954,62 +9270,56 @@ final class ImplicitCallReferenceImpl extends ExpressionImpl /// An import directive. /// /// importDirective ::= -/// [Annotation] 'import' [StringLiteral] ('as' identifier)? [Combinator]* ';' -/// | [Annotation] 'import' [StringLiteral] 'deferred' 'as' identifier [Combinator]* ';' +/// [Annotation] 'import' [StringLiteral] ('as' identifier)? +/// [Combinator]* ';' +/// | [Annotation] 'import' [StringLiteral] 'deferred' 'as' identifier +/// [Combinator]* ';' abstract final class ImportDirective implements NamespaceDirective { - /// Return the token representing the 'as' keyword, or `null` if the imported - /// names are not prefixed. + /// The token representing the `as` keyword, or `null` if the imported names + /// aren't prefixed. Token? get asKeyword; - /// Return the token representing the 'deferred' keyword, or `null` if the - /// imported URI is not deferred. + /// The token representing the `deferred` keyword, or `null` if the imported + /// URI isn't deferred. Token? get deferredKeyword; - /// Return the element associated with this directive, or `null` if the AST - /// structure has not been resolved. + /// The element associated with this directive, or `null` if the AST structure + /// hasn't been resolved. @override LibraryImportElement? get element; - /// The token representing the 'import' keyword. + /// The token representing the `import` keyword. Token get importKeyword; - /// Return the prefix to be used with the imported names, or `null` if the - /// imported names are not prefixed. + /// The prefix to be used with the imported names, or `null` if the imported + /// names aren't prefixed. SimpleIdentifier? get prefix; } -/// An import directive. -/// -/// importDirective ::= -/// [Annotation] 'import' [StringLiteral] ('as' identifier)? -// [Combinator]* ';' -/// | [Annotation] 'import' [StringLiteral] 'deferred' 'as' identifier -// [Combinator]* ';' final class ImportDirectiveImpl extends NamespaceDirectiveImpl implements ImportDirective { @override final Token importKeyword; - /// The token representing the 'deferred' keyword, or `null` if the imported - /// is not deferred. @override final Token? deferredKeyword; - /// The token representing the 'as' keyword, or `null` if the imported names - /// are not prefixed. @override final Token? asKeyword; - /// The prefix to be used with the imported names, or `null` if the imported - /// names are not prefixed. SimpleIdentifierImpl? _prefix; - /// Initialize a newly created import directive. Either or both of the - /// [comment] and [metadata] can be `null` if the function does not have the - /// corresponding attribute. The [deferredKeyword] can be `null` if the import - /// is not deferred. The [asKeyword] and [prefix] can be `null` if the import - /// does not specify a prefix. The list of [combinators] can be `null` if - /// there are no combinators. + /// Initializes a newly created import directive. + /// + /// Either or both of the [comment] and [metadata] can be `null` if the + /// function doesn't have the corresponding attribute. + /// + /// The [deferredKeyword] can be `null` if the import isn't deferred. + /// + /// The [asKeyword] and [prefix] can be `null` if the import doesn't specify a + /// prefix. + /// + /// The list of [combinators] can be `null` if there are no combinators. ImportDirectiveImpl({ required super.comment, required super.metadata, @@ -10061,10 +9371,12 @@ final class ImportDirectiveImpl extends NamespaceDirectiveImpl combinators.accept(visitor); } - /// Return `true` if the non-URI components of the two directives are - /// syntactically identical. URIs are checked outside to see if they resolve - /// to the same absolute URI, so to the same library, regardless of the used - /// syntax (absolute, relative, not normalized). + /// Returns `true` if the non-URI components of the two directives are + /// syntactically identical. + /// + /// URIs are checked outside to see if they resolve to the same absolute URI, + /// so to the same library, regardless of the used syntax (absolute, relative, + /// not normalized). static bool areSyntacticallyIdenticalExceptUri( NamespaceDirective node1, NamespaceDirective node2, @@ -10118,8 +9430,9 @@ final class ImportDirectiveImpl extends NamespaceDirectiveImpl /// Reference to an import prefix name. abstract final class ImportPrefixReference implements AstNode { - /// The element to which [name] is resolved. Usually a [PrefixElement], but - /// can be anything in invalid code. + /// The element to which [name] is resolved. + /// + /// Usually a [PrefixElement], but can be anything in invalid code. Element? get element; /// The name of the referenced import prefix. @@ -10171,80 +9484,74 @@ final class ImportPrefixReferenceImpl extends AstNodeImpl /// [Expression] '[' [Expression] ']' abstract final class IndexExpression implements NullShortableExpression, MethodReferenceExpression { - /// Return the expression used to compute the index. + /// The expression used to compute the index. Expression get index; - /// Return `true` if this expression is cascaded. + /// Whether this expression is cascaded. /// - /// If it is, then the target of this expression is not stored locally but is + /// If it is, then the target of this expression isn't stored locally but is /// stored in the nearest ancestor that is a [CascadeExpression]. bool get isCascaded; /// Whether this index expression is null aware (as opposed to non-null). bool get isNullAware; - /// Return the left square bracket. + /// The left square bracket. Token get leftBracket; - /// Return the period (".." | "?..") before a cascaded index expression, or - /// `null` if this index expression is not part of a cascade expression. + /// The period (".." | "?..") before a cascaded index expression, or `null` if + /// this index expression isn't part of a cascade expression. Token? get period; - /// Return the question mark before the left bracket, or `null` if there is no + /// The question mark before the left bracket, or `null` if there's no /// question mark. Token? get question; - /// Return the expression used to compute the object being indexed. + /// The expression used to compute the object being indexed. /// - /// If this index expression is not part of a cascade expression, then this + /// If this index expression isn't part of a cascade expression, then this /// is the same as [target]. If this index expression is part of a cascade /// expression, then the target expression stored with the cascade expression /// is returned. Expression get realTarget; - /// Return the right square bracket. + /// The right square bracket. Token get rightBracket; - /// Return the expression used to compute the object being indexed, or `null` - /// if this index expression is part of a cascade expression. + /// The expression used to compute the object being indexed, or `null` if this + /// index expression is part of a cascade expression. /// /// Use [realTarget] to get the target independent of whether this is part of /// a cascade expression. Expression? get target; - /// Return `true` if this expression is computing a right-hand value (that is, - /// if this expression is in a context where the operator '[]' will be + /// Returns `true` if this expression is computing a right-hand value (that + /// is, if this expression is in a context where the operator '[]' is /// invoked). /// - /// Note that [inGetterContext] and [inSetterContext] are not opposites, nor - /// are they mutually exclusive. In other words, it is possible for both + /// Note that [inGetterContext] and [inSetterContext] aren't opposites, nor + /// are they mutually exclusive. In other words, it's possible for both /// methods to return `true` when invoked on the same node. // TODO(brianwilkerson): Convert this to a getter. bool inGetterContext(); - /// Return `true` if this expression is computing a left-hand value (that is, - /// if this expression is in a context where the operator '[]=' will be + /// Returns `true` if this expression is computing a left-hand value (that is, + /// if this expression is in a context where the operator '[]=' is /// invoked). /// - /// Note that [inGetterContext] and [inSetterContext] are not opposites, nor - /// are they mutually exclusive. In other words, it is possible for both + /// Note that [inGetterContext] and [inSetterContext] aren't opposites, nor + /// are they mutually exclusive. In other words, it's possible for both /// methods to return `true` when invoked on the same node. // TODO(brianwilkerson): Convert this to a getter. bool inSetterContext(); } -/// An index expression. -/// -/// indexExpression ::= -/// [Expression] '[' [Expression] ']' final class IndexExpressionImpl extends ExpressionImpl with NullShortableExpressionImpl implements IndexExpression { @override Token? period; - /// The expression used to compute the object being indexed, or `null` if this - /// index expression is part of a cascade expression. ExpressionImpl? _target; @override @@ -10253,19 +9560,18 @@ final class IndexExpressionImpl extends ExpressionImpl @override final Token leftBracket; - /// The expression used to compute the index. ExpressionImpl _index; @override final Token rightBracket; /// The element associated with the operator based on the static type of the - /// target, or `null` if the AST structure has not been resolved or if the - /// operator could not be resolved. + /// target, or `null` if the AST structure hasn't been resolved or if the + /// operator couldn't be resolved. @override MethodElement? staticElement; - /// Initialize a newly created index expression that is a child of a cascade + /// Initializes a newly created index expression that is a child of a cascade /// expression. IndexExpressionImpl.forCascade({ required this.period, @@ -10277,7 +9583,7 @@ final class IndexExpressionImpl extends ExpressionImpl _becomeParentOf(_index); } - /// Initialize a newly created index expression that is not a child of a + /// Initializes a newly created index expression that isn't a child of a /// cascade expression. IndexExpressionImpl.forTarget({ required ExpressionImpl? target, @@ -10344,7 +9650,7 @@ final class IndexExpressionImpl extends ExpressionImpl _target = _becomeParentOf(expression); } - /// Return the cascade that contains this [IndexExpression]. + /// The cascade that contains this [IndexExpression]. /// /// We expect that [isCascaded] is `true`. CascadeExpressionImpl get _ancestorCascade { @@ -10367,10 +9673,10 @@ final class IndexExpressionImpl extends ExpressionImpl @override AstNode get _nullShortingExtensionCandidate => parent!; - /// If the AST structure has been resolved, and the function being invoked is - /// known based on static type information, then return the parameter element - /// representing the parameter to which the value of the index expression will - /// be bound. Otherwise, return `null`. + /// The parameter element representing the parameter to which the value of the + /// index expression is bound, or `null` if the AST structure is not resolved, + /// or the function being invoked is not known based on static type + /// information. ParameterElement? get _staticParameterElementForIndex { Element? element = staticElement; @@ -10439,54 +9745,47 @@ final class IndexExpressionImpl extends ExpressionImpl /// An instance creation expression. /// /// newExpression ::= -/// ('new' | 'const')? [NamedType] ('.' [SimpleIdentifier])? [ArgumentList] +/// ('new' | 'const')? [NamedType] ('.' [SimpleIdentifier])? +/// [ArgumentList] abstract final class InstanceCreationExpression implements Expression { - /// Return the list of arguments to the constructor. + /// The list of arguments to the constructor. ArgumentList get argumentList; - /// Return the name of the constructor to be invoked. + /// The name of the constructor to be invoked. ConstructorName get constructorName; - /// Return `true` if this creation expression is used to invoke a constant - /// constructor, either because the keyword `const` was explicitly provided or - /// because no keyword was provided and this expression is in a constant - /// context. + /// Whether this creation expression is used to invoke a constant constructor, + /// either because the keyword `const` was explicitly provided or because no + /// keyword was provided and this expression is in a constant context. bool get isConst; - /// Return the 'new' or 'const' keyword used to indicate how an object should - /// be created, or `null` if the keyword was not explicitly provided. + /// The `new` or `const` keyword used to indicate how an object should be + /// created, or `null` if the keyword isn't explicitly provided. Token? get keyword; } -/// An instance creation expression. -/// -/// newExpression ::= -/// ('new' | 'const')? [NamedType] ('.' [SimpleIdentifier])? -/// [ArgumentList] final class InstanceCreationExpressionImpl extends ExpressionImpl implements InstanceCreationExpression { // TODO(brianwilkerson): Consider making InstanceCreationExpressionImpl extend // InvocationExpressionImpl. This would probably be a breaking change, but is // also probably worth it. - /// The 'new' or 'const' keyword used to indicate how an object should be - /// created, or `null` if the keyword is implicit. @override Token? keyword; - /// The name of the constructor to be invoked. ConstructorNameImpl _constructorName; /// The type arguments associated with the constructor, rather than with the - /// class in which the constructor is defined. It is always an error if there - /// are type arguments because Dart doesn't currently support generic - /// constructors, but we capture them in the AST in order to recover better. + /// class in which the constructor is defined. + /// + /// It's always an error if there are type arguments because Dart doesn't + /// currently support generic constructors, but we capture them in the AST in + /// order to recover better. TypeArgumentListImpl? _typeArguments; - /// The list of arguments to the constructor. ArgumentListImpl _argumentList; - /// Initialize a newly created instance creation expression. + /// Initializes a newly created instance creation expression. InstanceCreationExpressionImpl({ required this.keyword, required ConstructorNameImpl constructorName, @@ -10529,22 +9828,20 @@ final class InstanceCreationExpressionImpl extends ExpressionImpl } } - /// Return `true` if this is an implicit constructor invocations. + /// Whether this is an implicit constructor invocation. bool get isImplicit => keyword == null; @override Precedence get precedence => Precedence.primary; - /// Return the type arguments associated with the constructor, rather than - /// with the class in which the constructor is defined. It is always an error - /// if there are type arguments because Dart doesn't currently support generic - /// constructors, but we capture them in the AST in order to recover better. + /// The type arguments associated with the constructor, rather than with the + /// class in which the constructor is defined. + /// + /// It's always an error if there are type arguments because Dart doesn't + /// currently support generic constructors, but we capture them in the AST in + /// order to recover better. TypeArgumentListImpl? get typeArguments => _typeArguments; - /// Return the type arguments associated with the constructor, rather than - /// with the class in which the constructor is defined. It is always an error - /// if there are type arguments because Dart doesn't currently support generic - /// constructors, but we capture them in the AST in order to recover better. set typeArguments(TypeArgumentListImpl? typeArguments) { _typeArguments = _becomeParentOf(typeArguments); } @@ -10586,36 +9883,22 @@ final class InstanceCreationExpressionImpl extends ExpressionImpl /// '0x' hexadecimalDigit+ /// | '0X' hexadecimalDigit+ abstract final class IntegerLiteral implements Literal { - /// Return the token representing the literal. + /// The token representing the literal. Token get literal; - /// Return the value of the literal, or `null` when [literal] does not - /// represent a valid `int` value, for example because of overflow. + /// The value of the literal, or `null` when [literal] doesn't represent a + /// valid `int` value, for example because of overflow. int? get value; } -/// An integer literal expression. -/// -/// integerLiteral ::= -/// decimalIntegerLiteral -/// | hexadecimalIntegerLiteral -/// -/// decimalIntegerLiteral ::= -/// decimalDigit+ -/// -/// hexadecimalIntegerLiteral ::= -/// '0x' hexadecimalDigit+ -/// | '0X' hexadecimalDigit+ final class IntegerLiteralImpl extends LiteralImpl implements IntegerLiteral { - /// The token representing the literal. @override final Token literal; - /// The value of the literal. @override int? value = 0; - /// Initialize a newly created integer literal. + /// Initializes a newly created integer literal. IntegerLiteralImpl({ required this.literal, required this.value, @@ -10627,12 +9910,11 @@ final class IntegerLiteralImpl extends LiteralImpl implements IntegerLiteral { @override Token get endToken => literal; - /// Returns whether this literal's [parent] is a [PrefixExpression] of unary - /// negation. + /// Whether this literal's [parent] is a [PrefixExpression] of unary negation. /// /// Note: this does *not* indicate that the value itself is negated, just that /// the literal is the child of a negation operation. The literal value itself - /// will always be positive. + /// is always positive. bool get immediatelyNegated { final parent = this.parent!; return parent is PrefixExpression && @@ -10657,7 +9939,7 @@ final class IntegerLiteralImpl extends LiteralImpl implements IntegerLiteral { } static bool isValidAsDouble(String lexeme) { - // Less than 16 characters must be a valid double since it will be less than + // Less than 16 characters must be a valid double since it's less than // 9007199254740992, 0x10000000000000, both 16 characters and 53 bits. if (lexeme.length < 16) { return true; @@ -10687,24 +9969,28 @@ final class IntegerLiteralImpl extends LiteralImpl implements IntegerLiteral { return fullPrecision & bottomMask == BigInt.zero; } - /// Return `true` if the given [lexeme] is a valid lexeme for an integer - /// literal. The flag [isNegative] should be `true` if the lexeme is preceded - /// by a unary negation operator. + /// Returns `true` if the given [lexeme] is a valid lexeme for an integer + /// literal. + /// + /// The flag [isNegative] should be `true` if the lexeme is preceded by a + /// unary negation operator. static bool isValidAsInteger(String lexeme, bool isNegative) { // TODO(jmesserly): this depends on the platform int implementation, and - // may not be accurate if run on dart4web. + // might not be accurate if run on dart4web. // // (Prior to https://dart-review.googlesource.com/c/sdk/+/63023 there was - // a partial implementation here which may be a good starting point. + // a partial implementation here which might be a good starting point. // _isValidDecimalLiteral relied on int.parse so that would need some fixes. // _isValidHexadecimalLiteral worked except for negative int64 max.) if (isNegative) lexeme = '-$lexeme'; return int.tryParse(lexeme) != null; } - /// Suggest the nearest valid double to a user. If the integer they wrote - /// requires more than a 53 bit mantissa, or more than 10 exponent bits, do - /// them the favor of suggesting the nearest integer that would work for them. + /// Suggest the nearest valid double to a user. + /// + /// If the integer they wrote requires more than a 53 bit mantissa, or more + /// than 10 exponent bits, do them the favor of suggesting the nearest integer + /// that would work for them. static double nearestValidDouble(String lexeme) => math.min(double.maxFinite, BigInt.parse(lexeme).toDouble()); } @@ -10716,11 +10002,6 @@ final class IntegerLiteralImpl extends LiteralImpl implements IntegerLiteral { /// | [InterpolationString] sealed class InterpolationElement implements AstNode {} -/// A node within a [StringInterpolation]. -/// -/// interpolationElement ::= -/// [InterpolationExpression] -/// | [InterpolationString] sealed class InterpolationElementImpl extends AstNodeImpl implements InterpolationElement {} @@ -10730,43 +10011,32 @@ sealed class InterpolationElementImpl extends AstNodeImpl /// '$' [SimpleIdentifier] /// | '$' '{' [Expression] '}' abstract final class InterpolationExpression implements InterpolationElement { - /// Return the expression to be evaluated for the value to be converted into a + /// The expression to be evaluated for the value to be converted into a /// string. Expression get expression; - /// Return the token used to introduce the interpolation expression; either - /// '$' if the expression is a simple identifier or '${' if the expression is - /// a full expression. + /// The token used to introduce the interpolation expression. + /// + /// This will either be `$` if the expression is a simple identifier or `${` + /// if the expression is a full expression. Token get leftBracket; - /// Return the right curly bracket, or `null` if the expression is an - /// identifier without brackets. + /// The right curly bracket, or `null` if the expression is an identifier + /// without brackets. Token? get rightBracket; } -/// An expression embedded in a string interpolation. -/// -/// interpolationExpression ::= -/// '$' [SimpleIdentifier] -/// | '$' '{' [Expression] '}' final class InterpolationExpressionImpl extends InterpolationElementImpl implements InterpolationExpression { - /// The token used to introduce the interpolation expression; either '$' if - /// the expression is a simple identifier or '${' if the expression is a full - /// expression. @override final Token leftBracket; - /// The expression to be evaluated for the value to be converted into a - /// string. ExpressionImpl _expression; - /// The right curly bracket, or `null` if the expression is an identifier - /// without brackets. @override final Token? rightBracket; - /// Initialize a newly created interpolation expression. + /// Initializes a newly created interpolation expression. InterpolationExpressionImpl({ required this.leftBracket, required ExpressionImpl expression, @@ -10809,34 +10079,28 @@ final class InterpolationExpressionImpl extends InterpolationElementImpl /// interpolationString ::= /// characters abstract final class InterpolationString implements InterpolationElement { - /// Return the characters that will be added to the string. + /// The characters that are added to the string. Token get contents; - /// Return the offset of the after-last contents character. + /// The offset of the after-last contents character. int get contentsEnd; - /// Return the offset of the first contents character. + /// The offset of the first contents character. int get contentsOffset; - /// Return the value of the literal. + /// The value of the literal. String get value; } -/// A non-empty substring of an interpolated string. -/// -/// interpolationString ::= -/// characters final class InterpolationStringImpl extends InterpolationElementImpl implements InterpolationString { - /// The characters that will be added to the string. @override final Token contents; - /// The value of the literal. @override String value; - /// Initialize a newly created string of characters that are part of a string + /// Initializes a newly created string of characters that are part of a string /// interpolation. InterpolationStringImpl({ required this.contents, @@ -10875,54 +10139,50 @@ final class InterpolationStringImpl extends InterpolationElementImpl void visitChildren(AstVisitor visitor) {} } -/// The invocation of a function or method; either a -/// [FunctionExpressionInvocation] or a [MethodInvocation]. +/// The invocation of a function or method. +/// +/// This will either be a [FunctionExpressionInvocation] or a +/// [MethodInvocation]. abstract final class InvocationExpression implements Expression { - /// Return the list of arguments to the method. + /// The list of arguments to the method. ArgumentList get argumentList; /// The expression that identifies the function or method being invoked. + /// /// For example: /// - /// (o.m)(args); // target will be `o.m` - /// o.m(args); // target will be `m` + /// (o.m)(args); // target is `o.m` + /// o.m(args); // target is `m` /// - /// In either case, the [function.staticType] will be the - /// [staticInvokeType] before applying type arguments `TArgs`. + /// In either case, the [function.staticType] is the [staticInvokeType] before + /// applying type arguments `TArgs`. Expression get function; - /// Return the function type of the invocation based on the static type - /// information, or `null` if the AST structure has not been resolved, or if - /// the invoke could not be resolved. + /// The function type of the invocation based on the static type information, + /// or `null` if the AST structure hasn't been resolved, or if the invoke + /// couldn't be resolved. /// - /// This will usually be a [FunctionType], but it can also be `dynamic` or + /// This is usually a [FunctionType], but it can also be `dynamic` or /// `Function`. In the case of interface types that have a `call` method, we /// store the type of that `call` method here as parameterized. DartType? get staticInvokeType; - /// Return the type arguments to be applied to the method being invoked, or - /// `null` if no type arguments were provided. + /// The type arguments to be applied to the method being invoked, or `null` if + /// no type arguments were provided. TypeArgumentList? get typeArguments; - /// Return the actual type arguments of the invocation, either explicitly - /// specified in [typeArguments], or inferred. - /// - /// If the AST has been resolved, never returns `null`, returns an empty list - /// if the [function] does not have type parameters. + /// The actual type arguments of the invocation, either explicitly specified + /// in [typeArguments], or inferred, or `null` if the AST structure hasn't + /// been resolved. /// - /// Return `null` if the AST structure has not been resolved. + /// An empty list if the [function] doesn't have type parameters. List? get typeArgumentTypes; } -/// Common base class for [FunctionExpressionInvocationImpl] and -/// [MethodInvocationImpl]. sealed class InvocationExpressionImpl extends ExpressionImpl implements InvocationExpression { - /// The list of arguments to the function. ArgumentListImpl _argumentList; - /// The type arguments to be applied to the method being invoked, or `null` if - /// no type arguments were provided. TypeArgumentListImpl? _typeArguments; @override @@ -10931,7 +10191,7 @@ sealed class InvocationExpressionImpl extends ExpressionImpl @override DartType? staticInvokeType; - /// Initialize a newly created invocation. + /// Initializes a newly created invocation. InvocationExpressionImpl({ required TypeArgumentListImpl? typeArguments, required ArgumentListImpl argumentList, @@ -10961,42 +10221,33 @@ sealed class InvocationExpressionImpl extends ExpressionImpl /// isExpression ::= /// [Expression] 'is' '!'? [TypeAnnotation] abstract final class IsExpression implements Expression { - /// Return the expression used to compute the value whose type is being - /// tested. + /// The expression used to compute the value whose type is being tested. Expression get expression; - /// Return the is operator. + /// The is operator. Token get isOperator; - /// Return the not operator, or `null` if the sense of the test is not - /// negated. + /// The not operator, or `null` if the sense of the test isn't negated. Token? get notOperator; - /// Return the type being tested for. + /// The type being tested for. TypeAnnotation get type; } -/// An is expression. -/// -/// isExpression ::= -/// [Expression] 'is' '!'? [NamedType] final class IsExpressionImpl extends ExpressionImpl implements IsExpression { - /// The expression used to compute the value whose type is being tested. ExpressionImpl _expression; - /// The is operator. @override final Token isOperator; - /// The not operator, or `null` if the sense of the test is not negated. @override final Token? notOperator; - /// The name of the type being tested for. TypeAnnotationImpl _type; - /// Initialize a newly created is expression. The [notOperator] can be `null` - /// if the sense of the test is not negated. + /// Initializes a newly created is expression. + /// + /// The [notOperator] can be `null` if the sense of the test isn't negated. IsExpressionImpl({ required ExpressionImpl expression, required this.isOperator, @@ -11058,10 +10309,10 @@ final class IsExpressionImpl extends ExpressionImpl implements IsExpression { /// label ::= /// [SimpleIdentifier] ':' abstract final class Label implements AstNode { - /// Return the colon that separates the label from the statement. + /// The colon that separates the label from the statement. Token get colon; - /// Return the label being associated with the statement. + /// The label being associated with the statement. SimpleIdentifier get label; } @@ -11070,26 +10321,20 @@ abstract final class Label implements AstNode { /// labeledStatement ::= /// [Label]+ [Statement] abstract final class LabeledStatement implements Statement { - /// Return the labels being associated with the statement. + /// The labels being associated with the statement. NodeList