DeCo. Support empty bodies in membered declarations
Allow enums, extensions, and mixins to use `;` as their body and represent that form explicitly in the AST. The parser now produces `EmptyEnumBody` or `EmptyClassBody` for the empty form. Also replace `LibraryIdentifier` with token-based `DottedName` and store the full token sequence for dotted names. This preserves periods and source offsets directly in the AST, which keeps printing, selection, and directive name handling working with the new shape. See https://github.com/dart-lang/sdk/issues/62819 See https://github.com/dart-lang/language/issues/4645 Google3 presubmit looks green: https://fusion2.corp.google.com/presubmit/884063020/OCL:884063020:BASE:884079610:1773618867493:b2110d76 Change-Id: I2d023cd03b6423da634c3e14742e02a61dc3b403 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486080 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
Commit Queue
parent
63dc645f6e
commit
e9d8109258
@@ -129,14 +129,14 @@ vars = {
|
||||
# and land the review.
|
||||
#
|
||||
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
|
||||
"dart_style_rev": "a6b10dcc3db33597d058cdd602c6059137550b9b", # rolled manually
|
||||
"dart_style_rev": "9b302dd20b4b38979352f21cf515b44617d344ce", # rolled manually
|
||||
|
||||
### /third_party/pkg dependencies
|
||||
# 'tools/rev_sdk_deps.dart' will rev pkg dependencies to their latest; put an
|
||||
# EOL comment after a dependency to instead pin at the current revision.
|
||||
"ai_rev": "a619d4bba99e736b0fbabd3e8b94b0538e013f46",
|
||||
"core_rev": "1ce6453c52f498e24fe769b1eba10565a3a61c6b",
|
||||
"dartdoc_rev": "3b019e40d6365af9456bea886da0476e5b7fdff4",
|
||||
"dartdoc_rev": "e3484b5adb4b0316667c7b07cd16ec4cfc877887",
|
||||
"ecosystem_rev": "b305b11424f712d174f767369739f9a11ded6a1e",
|
||||
"flute_rev": "b84119fba67016a80c3eb80765762bcc4d0d0b8d",
|
||||
"http_rev": "9aa867e97717dc1b80ffb4abc670b7855e0a7554",
|
||||
|
||||
@@ -1216,6 +1216,11 @@ class ForwardingListener implements Listener {
|
||||
listener?.endMetadataStar(count);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoMixinBody(Token semicolonToken) {
|
||||
listener?.handleNoMixinBody(semicolonToken);
|
||||
}
|
||||
|
||||
@override
|
||||
void endMixinDeclaration(Token beginToken, Token endToken) {
|
||||
listener?.endMixinDeclaration(beginToken, endToken);
|
||||
@@ -1556,11 +1561,21 @@ class ForwardingListener implements Listener {
|
||||
listener?.handleClassNoWithClause();
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoExtensionBody(Token semicolonToken) {
|
||||
listener?.handleNoExtensionBody(semicolonToken);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleEnumNoWithClause() {
|
||||
listener?.handleEnumNoWithClause();
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoEnumBody(Token semicolonToken) {
|
||||
listener?.handleNoEnumBody(semicolonToken);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleImplements(Token? implementsKeyword, int interfacesCount) {
|
||||
listener?.handleImplements(implementsKeyword, interfacesCount);
|
||||
|
||||
@@ -256,6 +256,11 @@ abstract class Listener implements UnescapeErrorListener {
|
||||
logEvent("RecoverMixinHeader");
|
||||
}
|
||||
|
||||
/// Handle `;` as a mixin body.
|
||||
void handleNoMixinBody(Token semicolonToken) {
|
||||
logEvent("NoMixinBody");
|
||||
}
|
||||
|
||||
/// Handle the end of a mixin declaration. Substructures:
|
||||
/// - mixin header
|
||||
/// - class or mixin body
|
||||
@@ -300,6 +305,11 @@ abstract class Listener implements UnescapeErrorListener {
|
||||
logEvent('ExtensionDeclaration');
|
||||
}
|
||||
|
||||
/// Handle `;` as an extension body.
|
||||
void handleNoExtensionBody(Token semicolonToken) {
|
||||
logEvent("NoExtensionBody");
|
||||
}
|
||||
|
||||
/// Handle the beginning of an extension type declaration. Substructures:
|
||||
/// - type variables
|
||||
///
|
||||
@@ -495,6 +505,11 @@ abstract class Listener implements UnescapeErrorListener {
|
||||
/// Handle the end of an enum body.
|
||||
void endEnumBody(Token beginToken, Token endToken) {}
|
||||
|
||||
/// Handle `;` as an enum body.
|
||||
void handleNoEnumBody(Token semicolonToken) {
|
||||
logEvent("NoEnumBody");
|
||||
}
|
||||
|
||||
/// Handle the enum element. Substructures:
|
||||
/// - Metadata
|
||||
/// - Enum value (identifier)
|
||||
|
||||
@@ -2613,7 +2613,18 @@ class Parser {
|
||||
Token leftBrace = token.next!;
|
||||
int elementCount = 0;
|
||||
int memberCount = 0;
|
||||
if (leftBrace.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
if (leftBrace.isA(TokenType.SEMICOLON)) {
|
||||
if (!isPrimaryConstructorsFeatureEnabled) {
|
||||
reportExperimentNotEnabled(
|
||||
ExperimentalFlag.primaryConstructors,
|
||||
leftBrace,
|
||||
leftBrace,
|
||||
);
|
||||
}
|
||||
listener.handleEnumHeader(augmentToken, enumKeyword, leftBrace);
|
||||
listener.handleNoEnumBody(leftBrace);
|
||||
token = leftBrace;
|
||||
} else if (leftBrace.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
listener.handleEnumHeader(augmentToken, enumKeyword, leftBrace);
|
||||
listener.beginEnumBody(leftBrace);
|
||||
token = leftBrace;
|
||||
@@ -2682,7 +2693,10 @@ class Parser {
|
||||
token = leftBrace.endGroup!;
|
||||
listener.endEnumBody(leftBrace, token);
|
||||
}
|
||||
assert(token.isA(TokenType.CLOSE_CURLY_BRACKET));
|
||||
assert(
|
||||
token.isA(TokenType.CLOSE_CURLY_BRACKET) ||
|
||||
token.isA(TokenType.SEMICOLON),
|
||||
);
|
||||
listener.endEnumDeclaration(
|
||||
beginToken,
|
||||
enumKeyword,
|
||||
@@ -3369,16 +3383,28 @@ class Parser {
|
||||
name,
|
||||
);
|
||||
Token token = parseMixinHeaderOpt(headerStart, mixinKeyword);
|
||||
if (!token.next!.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
// Recovery
|
||||
token = parseMixinHeaderRecovery(token, mixinKeyword, headerStart);
|
||||
ensureBlock(token, BlockKind.mixinDeclaration);
|
||||
if (token.next!.isA(TokenType.SEMICOLON)) {
|
||||
Token semicolonToken = token = token.next!;
|
||||
if (!isPrimaryConstructorsFeatureEnabled) {
|
||||
reportExperimentNotEnabled(
|
||||
ExperimentalFlag.primaryConstructors,
|
||||
semicolonToken,
|
||||
semicolonToken,
|
||||
);
|
||||
}
|
||||
listener.handleNoMixinBody(semicolonToken);
|
||||
} else {
|
||||
if (!token.next!.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
// Recovery
|
||||
token = parseMixinHeaderRecovery(token, mixinKeyword, headerStart);
|
||||
ensureBlock(token, BlockKind.mixinDeclaration);
|
||||
}
|
||||
token = parseClassOrMixinOrExtensionBody(
|
||||
token,
|
||||
DeclarationKind.Mixin,
|
||||
name.lexeme,
|
||||
);
|
||||
}
|
||||
token = parseClassOrMixinOrExtensionBody(
|
||||
token,
|
||||
DeclarationKind.Mixin,
|
||||
name.lexeme,
|
||||
);
|
||||
listener.endMixinDeclaration(beginToken, token);
|
||||
return token;
|
||||
}
|
||||
@@ -3620,35 +3646,47 @@ class Parser {
|
||||
token = typeInfo.ensureTypeOrVoid(onKeyword, this);
|
||||
}
|
||||
|
||||
if (!token.next!.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
// Recovery
|
||||
Token next = token.next!;
|
||||
while (!next.isEof) {
|
||||
if (next.isA(TokenType.COMMA) ||
|
||||
next.isA(Keyword.EXTENDS) ||
|
||||
next.isA(Keyword.IMPLEMENTS) ||
|
||||
next.isA(Keyword.ON) ||
|
||||
next.isA(Keyword.WITH)) {
|
||||
// Report an error and skip `,` or specific keyword
|
||||
// optionally followed by an identifier
|
||||
reportRecoverableErrorWithToken(next, diag.unexpectedToken);
|
||||
token = next;
|
||||
next = token.next!;
|
||||
if (next.isIdentifier) {
|
||||
if (token.next!.isA(TokenType.SEMICOLON)) {
|
||||
Token semicolonToken = token = token.next!;
|
||||
if (!isPrimaryConstructorsFeatureEnabled) {
|
||||
reportExperimentNotEnabled(
|
||||
ExperimentalFlag.primaryConstructors,
|
||||
semicolonToken,
|
||||
semicolonToken,
|
||||
);
|
||||
}
|
||||
listener.handleNoExtensionBody(semicolonToken);
|
||||
} else {
|
||||
if (!token.next!.isA(TokenType.OPEN_CURLY_BRACKET)) {
|
||||
// Recovery
|
||||
Token next = token.next!;
|
||||
while (!next.isEof) {
|
||||
if (next.isA(TokenType.COMMA) ||
|
||||
next.isA(Keyword.EXTENDS) ||
|
||||
next.isA(Keyword.IMPLEMENTS) ||
|
||||
next.isA(Keyword.ON) ||
|
||||
next.isA(Keyword.WITH)) {
|
||||
// Report an error and skip `,` or specific keyword
|
||||
// optionally followed by an identifier
|
||||
reportRecoverableErrorWithToken(next, diag.unexpectedToken);
|
||||
token = next;
|
||||
next = token.next!;
|
||||
if (next.isIdentifier) {
|
||||
token = next;
|
||||
next = token.next!;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
ensureBlock(token, BlockKind.extensionDeclaration);
|
||||
}
|
||||
ensureBlock(token, BlockKind.extensionDeclaration);
|
||||
token = parseClassOrMixinOrExtensionBody(
|
||||
token,
|
||||
DeclarationKind.Extension,
|
||||
name?.lexeme,
|
||||
);
|
||||
}
|
||||
token = parseClassOrMixinOrExtensionBody(
|
||||
token,
|
||||
DeclarationKind.Extension,
|
||||
name?.lexeme,
|
||||
);
|
||||
listener.endExtensionDeclaration(
|
||||
beginToken,
|
||||
extensionKeyword,
|
||||
|
||||
@@ -63,6 +63,24 @@ abstract class TokenStreamRewriter {
|
||||
return leftParen;
|
||||
}
|
||||
|
||||
/// Insert a synthetic `{` and `}` after [previousToken] and return them.
|
||||
(Token, Token) insertBlock(Token previousToken) {
|
||||
Token followingToken = previousToken.next!;
|
||||
int offset = followingToken.charOffset;
|
||||
BeginToken leftBracket = new SyntheticBeginToken(
|
||||
TokenType.OPEN_CURLY_BRACKET,
|
||||
offset,
|
||||
);
|
||||
Token rightBracket = new SyntheticToken(
|
||||
TokenType.CLOSE_CURLY_BRACKET,
|
||||
offset,
|
||||
);
|
||||
insertToken(previousToken, leftBracket);
|
||||
insertToken(leftBracket, rightBracket);
|
||||
_setEndGroup(leftBracket, rightBracket);
|
||||
return (leftBracket, rightBracket);
|
||||
}
|
||||
|
||||
/// Insert [newToken] after [token] and return [newToken].
|
||||
Token insertToken(Token token, Token newToken) {
|
||||
// Throw if the token is eof, though allow an eof-token if the offset
|
||||
|
||||
@@ -302,11 +302,13 @@ class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
@override
|
||||
void visitEnumDeclaration(EnumDeclaration node) {
|
||||
_computer._addRegionForAnnotations(node.metadata);
|
||||
_computer._addRegion(
|
||||
node.body.leftBracket.end,
|
||||
node.body.rightBracket.offset,
|
||||
FoldingKind.CLASS_BODY,
|
||||
);
|
||||
if (node.body case BlockEnumBody body) {
|
||||
_computer._addRegion(
|
||||
body.leftBracket.end,
|
||||
body.rightBracket.offset,
|
||||
FoldingKind.CLASS_BODY,
|
||||
);
|
||||
}
|
||||
super.visitEnumDeclaration(node);
|
||||
}
|
||||
|
||||
@@ -319,11 +321,13 @@ class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
@override
|
||||
void visitExtensionDeclaration(ExtensionDeclaration node) {
|
||||
_computer._addRegionForAnnotations(node.metadata);
|
||||
_computer._addRegion(
|
||||
node.body.leftBracket.end,
|
||||
node.body.rightBracket.offset,
|
||||
FoldingKind.CLASS_BODY,
|
||||
);
|
||||
if (node.body case BlockClassBody body) {
|
||||
_computer._addRegion(
|
||||
body.leftBracket.end,
|
||||
body.rightBracket.offset,
|
||||
FoldingKind.CLASS_BODY,
|
||||
);
|
||||
}
|
||||
super.visitExtensionDeclaration(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -1038,6 +1038,23 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
if (node.parent is Configuration) {
|
||||
for (var token in node.tokens) {
|
||||
if (token.type != TokenType.PERIOD) {
|
||||
computer._addRegion_token(
|
||||
token,
|
||||
HighlightRegionType.IDENTIFIER_DEFAULT,
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
computer._addRegion_node(node, HighlightRegionType.LIBRARY_NAME);
|
||||
}
|
||||
super.visitDottedName(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDoubleLiteral(DoubleLiteral node) {
|
||||
computer._addRegion_node(node, HighlightRegionType.LITERAL_DOUBLE);
|
||||
@@ -1423,12 +1440,6 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
|
||||
super.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
computer._addRegion_node(node, HighlightRegionType.LIBRARY_NAME);
|
||||
null;
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
computer._addRegion_node(node, HighlightRegionType.LITERAL_LIST);
|
||||
|
||||
@@ -33,35 +33,34 @@ class DartUnitOutlineComputer {
|
||||
);
|
||||
} else if (unitMember is MixinDeclaration) {
|
||||
unitContents.add(
|
||||
_newMixinOutline(
|
||||
unitMember,
|
||||
_outlinesForMembers(unitMember.body.members),
|
||||
),
|
||||
_newMixinOutline(unitMember, [
|
||||
if (unitMember.body case BlockClassBody body)
|
||||
..._outlinesForMembers(body.members),
|
||||
]),
|
||||
);
|
||||
} else if (unitMember is EnumDeclaration) {
|
||||
unitContents.add(
|
||||
_newEnumOutline(unitMember, [
|
||||
for (var constant in unitMember.body.constants)
|
||||
_newEnumConstant(constant),
|
||||
..._outlinesForMembers(unitMember.body.members),
|
||||
if (unitMember.body case BlockEnumBody body) ...[
|
||||
for (var constant in body.constants) _newEnumConstant(constant),
|
||||
..._outlinesForMembers(body.members),
|
||||
],
|
||||
]),
|
||||
);
|
||||
} else if (unitMember is ExtensionDeclaration) {
|
||||
unitContents.add(
|
||||
_newExtensionOutline(
|
||||
unitMember,
|
||||
_outlinesForMembers(unitMember.body.members),
|
||||
),
|
||||
_newExtensionOutline(unitMember, [
|
||||
if (unitMember.body case BlockClassBody body)
|
||||
..._outlinesForMembers(body.members),
|
||||
]),
|
||||
);
|
||||
} else if (unitMember is ExtensionTypeDeclaration) {
|
||||
if (unitMember.body case BlockClassBody body) {
|
||||
unitContents.add(
|
||||
_newExtensionTypeOutline(
|
||||
unitMember,
|
||||
_outlinesForMembers(body.members),
|
||||
),
|
||||
);
|
||||
}
|
||||
unitContents.add(
|
||||
_newExtensionTypeOutline(unitMember, [
|
||||
if (unitMember.body case BlockClassBody body)
|
||||
..._outlinesForMembers(body.members),
|
||||
]),
|
||||
);
|
||||
} else if (unitMember is TopLevelVariableDeclaration) {
|
||||
var fieldDeclaration = unitMember;
|
||||
var fields = fieldDeclaration.variables;
|
||||
|
||||
@@ -32,13 +32,17 @@ class DartUnitOverridesComputer {
|
||||
_classMembers(body.members);
|
||||
}
|
||||
} else if (unitMember is EnumDeclaration) {
|
||||
_classMembers(unitMember.body.members);
|
||||
if (unitMember.body case BlockEnumBody body) {
|
||||
_classMembers(body.members);
|
||||
}
|
||||
} else if (unitMember is ExtensionTypeDeclaration) {
|
||||
if (unitMember.body case BlockClassBody body) {
|
||||
_classMembers(body.members);
|
||||
}
|
||||
} else if (unitMember is MixinDeclaration) {
|
||||
_classMembers(unitMember.body.members);
|
||||
if (unitMember.body case BlockClassBody body) {
|
||||
_classMembers(body.members);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _overrides;
|
||||
|
||||
@@ -146,7 +146,7 @@ class FormatOnTypeHandler
|
||||
'}' => switch (node) {
|
||||
Block(:var rightBracket) ||
|
||||
BlockClassBody(:var rightBracket) ||
|
||||
EnumBody(:var rightBracket) ||
|
||||
BlockEnumBody(:var rightBracket) ||
|
||||
ListLiteral(:var rightBracket) ||
|
||||
SetOrMapLiteral(:var rightBracket) ||
|
||||
SwitchExpression(:var rightBracket) ||
|
||||
|
||||
@@ -172,15 +172,12 @@ void sendAnalysisNotificationOverrides(
|
||||
String? _computeLibraryName(CompilationUnit unit) {
|
||||
for (var directive in unit.directives) {
|
||||
if (directive is LibraryDirective) {
|
||||
return directive.name?.name;
|
||||
return directive.name?.tokens.join();
|
||||
}
|
||||
}
|
||||
for (var directive in unit.directives) {
|
||||
if (directive is PartOfDirective) {
|
||||
var libraryName = directive.libraryName;
|
||||
if (libraryName != null) {
|
||||
return libraryName.name;
|
||||
}
|
||||
return directive.libraryName?.tokens.join();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -429,9 +429,8 @@ class DeclarationHelper {
|
||||
}
|
||||
switch (parent) {
|
||||
case BlockClassBody():
|
||||
parent = parent.parent;
|
||||
case EnumBody():
|
||||
parent = parent.parent;
|
||||
case BlockEnumBody():
|
||||
parent = parent?.parent;
|
||||
}
|
||||
if (parent is EnumConstantDeclaration) {
|
||||
assert(node is CommentReference);
|
||||
@@ -446,9 +445,8 @@ class DeclarationHelper {
|
||||
}
|
||||
switch (parent) {
|
||||
case BlockClassBody():
|
||||
parent = parent.parent;
|
||||
case EnumBody():
|
||||
parent = parent.parent;
|
||||
case BlockEnumBody():
|
||||
parent = parent?.parent;
|
||||
}
|
||||
CompilationUnitMember? topLevelMember;
|
||||
if (parent is CompilationUnitMember) {
|
||||
|
||||
+78
-65
@@ -566,6 +566,11 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
_forStatement(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
node.parent?.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBooleanLiteral(BooleanLiteral node) {
|
||||
_forExpression(node);
|
||||
@@ -1088,27 +1093,30 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
keywordHelper.addKeyword(Keyword.ENUM);
|
||||
return;
|
||||
}
|
||||
if (offset <= node.namePart.typeName.end) {
|
||||
var hasSyntheticBody =
|
||||
node.body.leftBracket.isSynthetic &&
|
||||
node.body.rightBracket.isSynthetic;
|
||||
identifierHelper(
|
||||
includePrivateIdentifiers: false,
|
||||
).addTopLevelName(includeBody: hasSyntheticBody);
|
||||
return;
|
||||
}
|
||||
if (offset <= node.body.leftBracket.offset) {
|
||||
keywordHelper.addEnumDeclarationKeywords(node);
|
||||
return;
|
||||
}
|
||||
var rightBracket = node.body.rightBracket;
|
||||
if (!rightBracket.isSynthetic && offset >= rightBracket.end) {
|
||||
return;
|
||||
}
|
||||
var semicolon = node.body.semicolon;
|
||||
if (semicolon != null && offset >= semicolon.end) {
|
||||
collector.completionLocation = 'EnumDeclaration_member';
|
||||
_forEnumMember(node);
|
||||
|
||||
if (node.body case BlockEnumBody body) {
|
||||
if (offset <= node.namePart.typeName.end) {
|
||||
identifierHelper(includePrivateIdentifiers: false).addTopLevelName(
|
||||
includeBody:
|
||||
body.leftBracket.isSynthetic && body.rightBracket.isSynthetic,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset <= body.leftBracket.offset) {
|
||||
keywordHelper.addEnumDeclarationKeywords(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!body.rightBracket.isSynthetic && offset >= body.rightBracket.end) {
|
||||
return;
|
||||
}
|
||||
|
||||
var semicolon = body.semicolon;
|
||||
if (semicolon != null && offset >= semicolon.end) {
|
||||
collector.completionLocation = 'EnumDeclaration_member';
|
||||
_forEnumMember(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1283,19 +1291,22 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
includePrivateIdentifiers: false,
|
||||
).addTopLevelName(includeBody: false);
|
||||
}
|
||||
if (offset <= node.body.leftBracket.offset) {
|
||||
collector.completionLocation = 'ExtensionDeclaration_onClause';
|
||||
if (node.onClause case var onClause?) {
|
||||
if (onClause.onKeyword.isSynthetic) {
|
||||
keywordHelper.addExtensionDeclarationKeywords(node);
|
||||
|
||||
if (node.body case BlockClassBody body) {
|
||||
if (offset <= body.leftBracket.offset) {
|
||||
collector.completionLocation = 'ExtensionDeclaration_onClause';
|
||||
if (node.onClause case var onClause?) {
|
||||
if (onClause.onKeyword.isSynthetic) {
|
||||
keywordHelper.addExtensionDeclarationKeywords(node);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (offset >= body.leftBracket.end &&
|
||||
offset <= body.rightBracket.offset) {
|
||||
collector.completionLocation = 'ExtensionDeclaration_member';
|
||||
_forExtensionMember(node);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (offset >= node.body.leftBracket.end &&
|
||||
offset <= node.body.rightBracket.offset) {
|
||||
collector.completionLocation = 'ExtensionDeclaration_member';
|
||||
_forExtensionMember(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2122,35 +2133,39 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
|
||||
keywordHelper.addKeyword(Keyword.MIXIN);
|
||||
return;
|
||||
}
|
||||
if (offset <= node.name.end) {
|
||||
var hasSyntheticBody =
|
||||
node.body.leftBracket.isSynthetic &&
|
||||
node.body.rightBracket.isSynthetic;
|
||||
identifierHelper(
|
||||
includePrivateIdentifiers: false,
|
||||
).addTopLevelName(includeBody: hasSyntheticBody);
|
||||
return;
|
||||
}
|
||||
if (offset <= node.body.leftBracket.offset) {
|
||||
keywordHelper.addMixinDeclarationKeywords(node);
|
||||
return;
|
||||
}
|
||||
if (offset >= node.body.leftBracket.end &&
|
||||
offset <= node.body.rightBracket.offset) {
|
||||
collector.completionLocation = 'MixinDeclaration_member';
|
||||
if (_tryAnnotationAtEndOfClassBody(node)) {
|
||||
|
||||
if (node.body case BlockClassBody body) {
|
||||
if (offset <= node.name.end) {
|
||||
var hasSyntheticBody =
|
||||
body.leftBracket.isSynthetic && body.rightBracket.isSynthetic;
|
||||
identifierHelper(
|
||||
includePrivateIdentifiers: false,
|
||||
).addTopLevelName(includeBody: hasSyntheticBody);
|
||||
return;
|
||||
}
|
||||
_forMixinMember(node);
|
||||
var element = node.body.members.elementBefore(offset);
|
||||
if (element is MethodDeclaration) {
|
||||
var body = element.body;
|
||||
if (body.isEmpty) {
|
||||
keywordHelper.addFunctionBodyModifiers(body);
|
||||
}
|
||||
|
||||
if (offset <= body.leftBracket.offset) {
|
||||
keywordHelper.addMixinDeclarationKeywords(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset >= body.leftBracket.end &&
|
||||
offset <= body.rightBracket.offset) {
|
||||
collector.completionLocation = 'MixinDeclaration_member';
|
||||
if (_tryAnnotationAtEndOfClassBody(node)) {
|
||||
return;
|
||||
}
|
||||
_forMixinMember(node);
|
||||
var element = body.members.elementBefore(offset);
|
||||
if (element is MethodDeclaration) {
|
||||
var body = element.body;
|
||||
if (body.isEmpty) {
|
||||
keywordHelper.addFunctionBodyModifiers(body);
|
||||
}
|
||||
}
|
||||
// TODO(brianwilkerson): Consider enabling the generation of overrides in
|
||||
// this location.
|
||||
}
|
||||
// TODO(brianwilkerson): Consider enabling the generation of overrides in
|
||||
// this location.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4550,6 +4565,8 @@ extension on AstNode {
|
||||
ArgumentList(:var arguments) => arguments.contains(child),
|
||||
Block(:var statements) => statements.contains(child),
|
||||
BlockClassBody(:var members) => members.contains(child),
|
||||
BlockEnumBody(:var constants, :var members) =>
|
||||
constants.contains(child) || members.contains(child),
|
||||
CascadeExpression(:var cascadeSections) => cascadeSections.contains(
|
||||
child,
|
||||
),
|
||||
@@ -4561,10 +4578,7 @@ extension on AstNode {
|
||||
ConstructorDeclaration(:var initializers, :var metadata) =>
|
||||
initializers.contains(child) || metadata.contains(child),
|
||||
DeclaredIdentifier(:var metadata) => metadata.contains(child),
|
||||
DottedName(:var components) => components.contains(child),
|
||||
EnumConstantDeclaration(:var metadata) => metadata.contains(child),
|
||||
EnumBody(:var constants, :var members) =>
|
||||
constants.contains(child) || members.contains(child),
|
||||
EnumDeclaration(:var metadata) => metadata.contains(child),
|
||||
ExportDirective(:var combinators, :var configurations, :var metadata) =>
|
||||
combinators.contains(child) ||
|
||||
@@ -4588,7 +4602,6 @@ extension on AstNode {
|
||||
metadata.contains(child),
|
||||
LabeledStatement(:var labels) => labels.contains(child),
|
||||
LibraryDirective(:var metadata) => metadata.contains(child),
|
||||
LibraryIdentifier(:var components) => components.contains(child),
|
||||
ListLiteral(:var elements) => elements.contains(child),
|
||||
ListPattern(:var elements) => elements.contains(child),
|
||||
MapPattern(:var elements) => elements.contains(child),
|
||||
@@ -4646,10 +4659,10 @@ extension on ClassMember {
|
||||
var parent = this.parent?.parent;
|
||||
var members = switch (parent) {
|
||||
ClassDeclaration(:BlockClassBody body) => body.members,
|
||||
EnumDeclaration() => parent.body.members,
|
||||
ExtensionDeclaration() => parent.body.members,
|
||||
EnumDeclaration(:BlockEnumBody body) => body.members,
|
||||
ExtensionDeclaration(:BlockClassBody body) => body.members,
|
||||
ExtensionTypeDeclaration(:BlockClassBody body) => body.members,
|
||||
MixinDeclaration() => parent.body.members,
|
||||
MixinDeclaration(:BlockClassBody body) => body.members,
|
||||
_ => null,
|
||||
};
|
||||
if (members == null) {
|
||||
|
||||
@@ -6,9 +6,11 @@ import 'package:analysis_server/src/services/correction/fix.dart';
|
||||
import 'package:analysis_server/src/services/correction/util.dart';
|
||||
import 'package:analysis_server_plugin/edit/dart/correction_producer.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
|
||||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
|
||||
import 'package:analyzer_plugin/utilities/range_factory.dart';
|
||||
|
||||
class AddEnumConstant extends ResolvedCorrectionProducer {
|
||||
/// The name of the constant to be created.
|
||||
@@ -67,7 +69,17 @@ class AddEnumConstant extends ResolvedCorrectionProducer {
|
||||
}
|
||||
}
|
||||
|
||||
var lastConstant = targetNode.body.constants.lastOrNull;
|
||||
EnumConstantDeclaration? lastConstant;
|
||||
Token? rightBracket;
|
||||
Token? semicolon;
|
||||
switch (targetNode.body) {
|
||||
case BlockEnumBody body:
|
||||
lastConstant = body.constants.lastOrNull;
|
||||
rightBracket = body.rightBracket;
|
||||
case EmptyEnumBody body:
|
||||
semicolon = body.semicolon;
|
||||
}
|
||||
|
||||
var targetFile = targetFragment.libraryFragment.source.fullName;
|
||||
|
||||
await builder.addDartFileEdit(targetFile, (builder) {
|
||||
@@ -77,11 +89,19 @@ class AddEnumConstant extends ResolvedCorrectionProducer {
|
||||
builder.write(_constantName);
|
||||
if (constructorName != null) builder.write('.$constructorName()');
|
||||
});
|
||||
} else {
|
||||
builder.addInsertion(targetNode.body.rightBracket.offset, (builder) {
|
||||
} else if (rightBracket != null) {
|
||||
// If has a block body.
|
||||
builder.addInsertion(rightBracket.offset, (builder) {
|
||||
builder.write(_constantName);
|
||||
if (constructorName != null) builder.write('.$constructorName()');
|
||||
});
|
||||
} else if (semicolon != null) {
|
||||
builder.addReplacement(range.token(semicolon), (builder) {
|
||||
builder.write(' { ');
|
||||
builder.write(_constantName);
|
||||
if (constructorName != null) builder.write('.$constructorName()');
|
||||
builder.write(' }');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class AddFieldFormalParameters extends ResolvedCorrectionProducer {
|
||||
var parent = node.parent;
|
||||
if (parent case ConstructorDeclarationImpl constructor) {
|
||||
var parent = constructor.parent;
|
||||
if (parent is! BlockClassBody && parent is! EnumBody) {
|
||||
if (parent is! BlockClassBody && parent is! BlockEnumBody) {
|
||||
return;
|
||||
}
|
||||
await _computeFromPieces(
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/source/source_range.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/utilities/extensions/object.dart';
|
||||
import 'package:analyzer_plugin/utilities/assist/assist.dart';
|
||||
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
|
||||
import 'package:analyzer_plugin/utilities/range_factory.dart';
|
||||
@@ -115,12 +116,16 @@ class BindToField extends ResolvedCorrectionProducer {
|
||||
// Parameter is already a method.
|
||||
return;
|
||||
}
|
||||
if (container is EnumDeclaration &&
|
||||
container.body.constants.any(
|
||||
(constant) => constant.name.lexeme == parameter.name?.lexeme,
|
||||
)) {
|
||||
// Parameter is already a constant.
|
||||
return;
|
||||
if (container is EnumDeclaration) {
|
||||
var constants =
|
||||
container.body.tryCast<BlockEnumBody>()?.constants ??
|
||||
<EnumConstantDeclaration>[];
|
||||
if (constants.any(
|
||||
(constant) => constant.name.lexeme == parameter.name?.lexeme,
|
||||
)) {
|
||||
// Parameter is already a constant.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
|
||||
+4
-3
@@ -8,11 +8,12 @@ import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/source/source_range.dart';
|
||||
import 'package:analyzer/src/utilities/extensions/ast.dart';
|
||||
import 'package:analyzer_plugin/utilities/assist/assist.dart';
|
||||
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
|
||||
import 'package:analyzer_plugin/utilities/range_factory.dart';
|
||||
|
||||
import '../../../utilities/extensions/ast.dart';
|
||||
|
||||
typedef _RefactorData = ({
|
||||
FieldElement fieldElement,
|
||||
ConstructorFieldInitializer? initializer,
|
||||
@@ -268,8 +269,8 @@ class ConvertToDeclaringParameter extends ResolvedCorrectionProducer {
|
||||
(node) => node is ClassDeclaration || node is EnumDeclaration,
|
||||
);
|
||||
return switch (declaration) {
|
||||
ClassDeclaration() => declaration.body.classMembers,
|
||||
EnumDeclaration() => declaration.body.members,
|
||||
ClassDeclaration() => declaration.members2,
|
||||
EnumDeclaration() => declaration.members2,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
+5
-4
@@ -97,10 +97,11 @@ class ConvertToPrimaryConstructor extends ResolvedCorrectionProducer {
|
||||
int nonRedirectingGenerativeConstructorCount;
|
||||
bool isEnum = false;
|
||||
var parent = constructor.parent;
|
||||
if (parent is BlockClassBody) {
|
||||
parent = parent.parent;
|
||||
} else if (parent is EnumBody) {
|
||||
parent = parent.parent;
|
||||
switch (parent) {
|
||||
case BlockClassBody body:
|
||||
parent = body.parent;
|
||||
case BlockEnumBody body:
|
||||
parent = body.parent;
|
||||
}
|
||||
switch (parent) {
|
||||
case ClassDeclaration(:var namePart):
|
||||
|
||||
+10
-3
@@ -76,7 +76,13 @@ class ConvertToSecondaryConstructor extends ResolvedCorrectionProducer {
|
||||
EnumDeclaration enumDeclaration,
|
||||
) async {
|
||||
var containerBody = enumDeclaration.body;
|
||||
if (containerBody.constants.isEmpty) return;
|
||||
if (containerBody is! BlockEnumBody) {
|
||||
return;
|
||||
}
|
||||
|
||||
var constants = containerBody.constants;
|
||||
if (constants.isEmpty) return;
|
||||
|
||||
var namePart = enumDeclaration.namePart;
|
||||
if (namePart is! PrimaryConstructorDeclaration) return;
|
||||
|
||||
@@ -114,10 +120,11 @@ class ConvertToSecondaryConstructor extends ResolvedCorrectionProducer {
|
||||
var parent = declaration.parent;
|
||||
if (parent is EnumDeclaration) {
|
||||
var body = parent.body;
|
||||
var semicolon = body.semicolon;
|
||||
var semicolon = body is BlockEnumBody ? body.semicolon : null;
|
||||
if (semicolon == null) {
|
||||
needsSemicolon = true;
|
||||
fieldOffset = body.constants.endToken?.end ?? fieldOffset;
|
||||
var constants = body is BlockEnumBody ? body.constants : null;
|
||||
fieldOffset = constants?.endToken?.end ?? fieldOffset;
|
||||
} else {
|
||||
fieldOffset = semicolon.end;
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class CreateConstructorForFinalFields extends ResolvedCorrectionProducer {
|
||||
builder: builder,
|
||||
containerName: container.namePart.typeName.lexeme,
|
||||
superType: superType,
|
||||
variableLists: container.body.members.interestingVariableLists,
|
||||
variableLists: container.members2.interestingVariableLists,
|
||||
);
|
||||
case _:
|
||||
return;
|
||||
|
||||
@@ -69,7 +69,7 @@ class EncapsulateField extends ResolvedCorrectionProducer {
|
||||
classMembers = parent.members2;
|
||||
parentElement = parent.declaredFragment!.element;
|
||||
case MixinDeclaration():
|
||||
classMembers = parent.body.members;
|
||||
classMembers = parent.members2;
|
||||
parentElement = parent.declaredFragment!.element;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -42,7 +42,7 @@ class MakeFieldPublic extends ResolvedCorrectionProducer {
|
||||
if (container is ClassDeclaration) {
|
||||
members = container.members2;
|
||||
} else if (container is MixinDeclaration) {
|
||||
members = container.body.members;
|
||||
members = container.members2;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,18 +65,23 @@ class RemoveConstructor extends ResolvedCorrectionProducer {
|
||||
_Container? _findContainer() {
|
||||
switch (node.parent) {
|
||||
case ExtensionDeclaration extension:
|
||||
return _Container(
|
||||
leftBracket: extension.body.leftBracket,
|
||||
members: extension.body.members,
|
||||
);
|
||||
if (extension.body case BlockClassBody body) {
|
||||
return _Container(
|
||||
leftBracket: body.leftBracket,
|
||||
members: body.members,
|
||||
);
|
||||
}
|
||||
case MixinDeclaration mixin:
|
||||
return _Container(
|
||||
leftBracket: mixin.body.leftBracket,
|
||||
members: mixin.body.members,
|
||||
);
|
||||
if (mixin.body case BlockClassBody body) {
|
||||
return _Container(
|
||||
leftBracket: body.leftBracket,
|
||||
members: body.members,
|
||||
);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class RemoveLibraryName extends ResolvedCorrectionProducer {
|
||||
@override
|
||||
Future<void> compute(ChangeBuilder builder) async {
|
||||
var libraryName = node;
|
||||
if (libraryName is SimpleIdentifier || libraryName is LibraryIdentifier) {
|
||||
if (libraryName is SimpleIdentifier || libraryName is DottedName) {
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
builder.addDeletion(
|
||||
range.endStart(
|
||||
|
||||
@@ -29,11 +29,13 @@ class RemoveOnClause extends ResolvedCorrectionProducer {
|
||||
if (extensionDeclaration == null) return;
|
||||
|
||||
await builder.addDartFileEdit(file, (builder) {
|
||||
var body = extensionDeclaration.body;
|
||||
var endToken = switch (body) {
|
||||
BlockClassBody() => body.leftBracket,
|
||||
EmptyClassBody() => body.semicolon,
|
||||
};
|
||||
builder.addDeletion(
|
||||
range.startStart(
|
||||
extensionDeclaration.onClause!,
|
||||
extensionDeclaration.body.leftBracket,
|
||||
),
|
||||
range.startStart(extensionDeclaration.onClause!, endToken),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -88,7 +88,12 @@ class RemoveUnusedElement extends _RemoveUnused {
|
||||
return;
|
||||
}
|
||||
case EnumDeclaration enumDeclaration:
|
||||
members = enumDeclaration.body.members;
|
||||
switch (enumDeclaration.body) {
|
||||
case BlockEnumBody body:
|
||||
members = body.members;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
case _:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,13 +103,13 @@ class MemberSorter {
|
||||
if (unitMember is ClassDeclaration) {
|
||||
_sortClassMembers(unitMember.members2);
|
||||
} else if (unitMember is EnumDeclaration) {
|
||||
_sortClassMembers(unitMember.body.members);
|
||||
_sortClassMembers(unitMember.members2);
|
||||
} else if (unitMember is ExtensionDeclaration) {
|
||||
_sortClassMembers(unitMember.body.members);
|
||||
_sortClassMembers(unitMember.members2);
|
||||
} else if (unitMember is ExtensionTypeDeclaration) {
|
||||
_sortClassMembers(unitMember.members2);
|
||||
} else if (unitMember is MixinDeclaration) {
|
||||
_sortClassMembers(unitMember.body.members);
|
||||
_sortClassMembers(unitMember.members2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +132,8 @@ AstNode? getEnclosingClassOrUnitMember(AstNode input) {
|
||||
for (var node in input.withAncestors) {
|
||||
switch (node) {
|
||||
case BlockClassBody _:
|
||||
case BlockEnumBody _:
|
||||
case CompilationUnit _:
|
||||
case EnumBody _:
|
||||
return member;
|
||||
}
|
||||
member = node;
|
||||
|
||||
@@ -635,11 +635,11 @@ final class ExtractMethodRefactoringImpl extends RefactoringImpl
|
||||
var libraryElement = parent.declaredFragment!.element;
|
||||
return validateCreateFunction(_searchEngine, libraryElement, name);
|
||||
}
|
||||
// Stop up through BlockClassBody or EnumBody.
|
||||
// Stop up through BlockClassBody or BlockEnumBody.
|
||||
switch (parent) {
|
||||
case BlockClassBody():
|
||||
parent = parent.parent!;
|
||||
case EnumBody():
|
||||
case BlockEnumBody():
|
||||
parent = parent.parent!;
|
||||
}
|
||||
// method of class
|
||||
|
||||
@@ -555,6 +555,8 @@ abstract class RenameRefactoring implements Refactoring {
|
||||
nameNode = node.name;
|
||||
} else if (node is DeclaredVariablePattern) {
|
||||
nameNode = node.name;
|
||||
} else if (node is DottedName) {
|
||||
nameNode = node;
|
||||
} else if (node is EnumConstantDeclaration) {
|
||||
nameNode = node.name;
|
||||
} else if (node is ExtensionDeclaration) {
|
||||
|
||||
@@ -192,7 +192,10 @@ class DartSnippetRequest {
|
||||
}
|
||||
|
||||
if (node is EnumDeclaration) {
|
||||
var semicolon = node.body.semicolon;
|
||||
var semicolon = switch (node.body) {
|
||||
BlockEnumBody body => body.semicolon,
|
||||
EmptyEnumBody body => body.semicolon,
|
||||
};
|
||||
return semicolon == null || target.offset <= semicolon.offset
|
||||
? SnippetContext.inEnumConstants
|
||||
: SnippetContext.inEnumMembers;
|
||||
|
||||
@@ -180,10 +180,7 @@ extension AstNodeExtension on AstNode {
|
||||
/// Returns `null` if `this` is `null` or doesn't have an element.
|
||||
Element? getElement({bool useMockForImport = false}) {
|
||||
AstNode? node = this;
|
||||
if (node is SimpleIdentifier && node.parent is LibraryIdentifier) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node is LibraryIdentifier) {
|
||||
if (node is DottedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node is StringLiteral && node.parent is UriBasedDirective) {
|
||||
@@ -331,6 +328,13 @@ extension DirectiveExtension on Directive {
|
||||
}
|
||||
}
|
||||
|
||||
extension EnumDeclarationExtension on EnumDeclaration {
|
||||
List<ClassMember> get members2 {
|
||||
var body = this.body;
|
||||
return body is BlockEnumBody ? body.members : const [];
|
||||
}
|
||||
}
|
||||
|
||||
extension ExpressionExtension on Expression {
|
||||
/// Whether this [Expression] should be wrapped with parentheses when we want
|
||||
/// to use it as operand of a logical and-expression.
|
||||
@@ -344,6 +348,13 @@ extension ExpressionExtension on Expression {
|
||||
}
|
||||
}
|
||||
|
||||
extension ExtensionDeclarationExtension on ExtensionDeclaration {
|
||||
List<ClassMember> get members2 {
|
||||
var body = this.body;
|
||||
return body is BlockClassBody ? body.members : const [];
|
||||
}
|
||||
}
|
||||
|
||||
extension ExtensionTypeDeclarationExtension on ExtensionTypeDeclaration {
|
||||
List<ClassMember> get members2 {
|
||||
switch (body) {
|
||||
@@ -393,6 +404,13 @@ extension MethodInvocationExtension on MethodInvocation {
|
||||
}
|
||||
}
|
||||
|
||||
extension MixinDeclarationExtension on MixinDeclaration {
|
||||
List<ClassMember> get members2 {
|
||||
var body = this.body;
|
||||
return body is BlockClassBody ? body.members : const [];
|
||||
}
|
||||
}
|
||||
|
||||
extension NamedTypeExtension on NamedType {
|
||||
String get qualifiedName {
|
||||
var importPrefix = this.importPrefix;
|
||||
|
||||
@@ -495,14 +495,12 @@ int x = 0]) {}
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> test_dottedName_components() async {
|
||||
Future<void> test_dottedName_tokens() async {
|
||||
var selection = await _computeSelection('''
|
||||
library a.[!b.c!].d;
|
||||
''');
|
||||
_assertSelection(selection, r'''
|
||||
nodesInRange
|
||||
SimpleIdentifierImpl: b
|
||||
SimpleIdentifierImpl: c
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -859,17 +857,6 @@ library l;
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> test_libraryIdentifier_components() async {
|
||||
var selection = await _computeSelection('''
|
||||
library a.[!b.c!].d;
|
||||
''');
|
||||
_assertSelection(selection, r'''
|
||||
nodesInRange
|
||||
SimpleIdentifierImpl: b
|
||||
SimpleIdentifierImpl: c
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_listLiteral_elements() async {
|
||||
var selection = await _computeSelection('''
|
||||
var l = ['0', [!1, 2.0!], '3'];
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
import 'package:analyzer/src/utilities/extensions/diagnostic.dart';
|
||||
import 'package:analyzer/src/utilities/extensions/object.dart';
|
||||
import 'package:args/args.dart';
|
||||
|
||||
/// Compute and print lexical and semantic information about a package.
|
||||
@@ -431,7 +432,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
_visitChildren(node, {'components': node.components});
|
||||
_visitChildren(node, {});
|
||||
super.visitDottedName(node);
|
||||
}
|
||||
|
||||
@@ -469,7 +470,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
|
||||
'documentationComment': node.documentationComment,
|
||||
'metadata': node.metadata,
|
||||
'name': node.namePart.typeName,
|
||||
'constants': node.body.constants,
|
||||
'constants': node.body.tryCast<BlockEnumBody>()?.constants,
|
||||
});
|
||||
super.visitEnumDeclaration(node);
|
||||
}
|
||||
@@ -514,7 +515,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
|
||||
'name': node.name,
|
||||
'typeParameters': node.typeParameters,
|
||||
'onClause': node.onClause,
|
||||
'member': node.body.members,
|
||||
'member': node.body.tryCast<BlockClassBody>()?.members,
|
||||
});
|
||||
super.visitExtensionDeclaration(node);
|
||||
}
|
||||
@@ -827,12 +828,6 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
|
||||
super.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
_visitChildren(node, {'components': node.components});
|
||||
super.visitLibraryIdentifier(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
_visitChildren(node, {
|
||||
@@ -885,7 +880,7 @@ class CodeShapeDataCollector extends RecursiveAstVisitor<void> {
|
||||
'typeParameters': node.typeParameters,
|
||||
'onClause': node.onClause,
|
||||
'implementsClause': node.implementsClause,
|
||||
'members': node.body.members,
|
||||
'members': node.body.tryCast<BlockClassBody>()?.members,
|
||||
});
|
||||
super.visitMixinDeclaration(node);
|
||||
}
|
||||
|
||||
@@ -741,12 +741,14 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
node.typeParameters != null,
|
||||
);
|
||||
_recordDataForNode('ExtensionDeclaration (onClause)', node.onClause);
|
||||
for (var member in node.body.members) {
|
||||
_recordDataForNode(
|
||||
'ExtensionDeclaration (member)',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
if (node.body case BlockClassBody body) {
|
||||
for (var member in body.members) {
|
||||
_recordDataForNode(
|
||||
'ExtensionDeclaration (member)',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
}
|
||||
}
|
||||
super.visitExtensionDeclaration(node);
|
||||
inGenericContext = wasInGenericContext;
|
||||
@@ -1089,12 +1091,6 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
super.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
// There are no completions.
|
||||
super.visitLibraryIdentifier(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
for (var element in node.elements) {
|
||||
@@ -1201,13 +1197,16 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
allowedKeywords: [Keyword.IMPLEMENTS],
|
||||
);
|
||||
|
||||
for (var member in node.body.members) {
|
||||
_recordDataForNode(
|
||||
'MixinDeclaration (member)',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
if (node.body case BlockClassBody body) {
|
||||
for (var member in body.members) {
|
||||
_recordDataForNode(
|
||||
'MixinDeclaration (member)',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
super.visitMixinDeclaration(node);
|
||||
inGenericContext = wasInGenericContext;
|
||||
}
|
||||
|
||||
@@ -683,8 +683,8 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
void visitConfiguration(Configuration node) {
|
||||
// The list of valid names is short, so we don't use the relevance tables to
|
||||
// try to sort them by frequency.
|
||||
for (var id in node.name.components) {
|
||||
_identifiersAndKeywords.remove(id.token);
|
||||
for (var token in node.name.tokens) {
|
||||
_identifiersAndKeywords.remove(token);
|
||||
}
|
||||
super.visitConfiguration(node);
|
||||
}
|
||||
@@ -828,12 +828,6 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
super.visitDotShorthandPropertyAccess(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
// The components are always identifiers.
|
||||
super.visitDottedName(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDoubleLiteral(DoubleLiteral node) {
|
||||
// There are no completions.
|
||||
@@ -858,19 +852,6 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
super.visitEmptyStatement(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
// TODO(brianwilkerson): Record data for the enum constants.
|
||||
for (var member in node.members) {
|
||||
_recordDataForNode(
|
||||
'EnumDeclaration_member',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
}
|
||||
super.visitEnumBody(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
// There are no completions.
|
||||
@@ -976,12 +957,14 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
_recordDeclaration(name);
|
||||
}
|
||||
_recordDataForNode('ExtensionDeclaration_onClause', node.onClause);
|
||||
for (var member in node.body.members) {
|
||||
_recordDataForNode(
|
||||
'ExtensionDeclaration_member',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
if (node.body case BlockClassBody body) {
|
||||
for (var member in body.members) {
|
||||
_recordDataForNode(
|
||||
'ExtensionDeclaration_member',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
}
|
||||
}
|
||||
super.visitExtensionDeclaration(node);
|
||||
}
|
||||
@@ -1421,15 +1404,6 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
super.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
// There are no completions.
|
||||
for (var id in node.components) {
|
||||
_recordDeclaration(id.token);
|
||||
}
|
||||
super.visitLibraryIdentifier(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
for (var element in node.elements) {
|
||||
@@ -1550,12 +1524,14 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
|
||||
allowedKeywords: [Keyword.IMPLEMENTS],
|
||||
);
|
||||
|
||||
for (var member in node.body.members) {
|
||||
_recordDataForNode(
|
||||
'MixinDeclaration_member',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
if (node.body case BlockClassBody body) {
|
||||
for (var member in body.members) {
|
||||
_recordDataForNode(
|
||||
'MixinDeclaration_member',
|
||||
member,
|
||||
allowedKeywords: memberKeywords,
|
||||
);
|
||||
}
|
||||
}
|
||||
super.visitMixinDeclaration(node);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
## 0.3.13-dev
|
||||
|
||||
- Require version `^12.0.0-0` of the `analyzer` package.
|
||||
- Require version `0.14.7-dev` of the `analyzer_plugin` package.
|
||||
|
||||
## 0.3.12-dev
|
||||
|
||||
- Require version `11.1.0-dev` of the `analyzer` package.
|
||||
|
||||
@@ -83,6 +83,11 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
_fromList(node.members);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
_fromList(node.constants) || _fromList(node.members);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitCascadeExpression(CascadeExpression node) {
|
||||
_fromList(node.cascadeSections);
|
||||
@@ -91,9 +96,6 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
@override
|
||||
void visitClassDeclaration(ClassDeclaration node) {
|
||||
_fromList(node.metadata);
|
||||
if (node.body case BlockClassBody body) {
|
||||
_fromList(body.members);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -122,16 +124,6 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
_fromList(node.metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
_fromList(node.components);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
_fromList(node.constants) || _fromList(node.members);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
|
||||
_fromList(node.metadata);
|
||||
@@ -151,7 +143,12 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitExtensionDeclaration(ExtensionDeclaration node) {
|
||||
_fromList(node.metadata) || _fromList(node.body.members);
|
||||
_fromList(node.metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitExtensionTypeDeclaration(ExtensionTypeDeclaration node) {
|
||||
_fromList(node.metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -239,11 +236,6 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
_fromList(node.metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
_fromList(node.components);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
_fromList(node.elements);
|
||||
@@ -266,7 +258,7 @@ class _ChildrenFinder extends SimpleAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitMixinDeclaration(MixinDeclaration node) {
|
||||
_fromList(node.metadata) || _fromList(node.body.members);
|
||||
_fromList(node.metadata);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: analysis_server_plugin
|
||||
description: A framework and support code for building plugins for the analysis server.
|
||||
version: 0.3.12-dev
|
||||
version: 0.3.13-dev
|
||||
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analysis_server_plugin
|
||||
|
||||
environment:
|
||||
@@ -11,8 +11,8 @@ resolution: workspace
|
||||
dependencies:
|
||||
# See the release policy for managing this dependency at
|
||||
# pkg/analyzer/doc/implementation/releasing.md.
|
||||
analyzer: 11.1.0-dev
|
||||
analyzer_plugin: 0.14.6-dev
|
||||
analyzer: ^12.0.0-0
|
||||
analyzer_plugin: 0.14.7-dev
|
||||
meta: ^1.16.0
|
||||
yaml: ^3.1.0
|
||||
yaml_edit: ^2.2.0
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
## 11.1.0-dev
|
||||
## 12.0.0-dev
|
||||
|
||||
* Added `InstantiatedTypeAliasElement.nullabilitySuffix`.
|
||||
* Support empty bodies (`;`) in enums, extensions, and mixins, representing
|
||||
them in the AST with `EmptyEnumBody` and `EmptyClassBody`.
|
||||
* **Breaking Change:** `ClassBody` is now a `sealed class` with subclasses
|
||||
`BlockClassBody` and `EmptyClassBody`. Getters like `.members`, `.leftBracket`,
|
||||
and `.rightBracket` are available on `BlockClassBody`. This affects
|
||||
`ClassDeclaration`, `ExtensionDeclaration`, and `MixinDeclaration` bodies.
|
||||
* **Breaking Change:** `EnumBody` is now a `sealed class` with subclasses
|
||||
`BlockEnumBody` and `EmptyEnumBody`. Getters like `.members`, `.leftBracket`,
|
||||
and `.rightBracket` are available on `BlockEnumBody`.
|
||||
* **Breaking Change:** Remove `LibraryIdentifier`. `LibraryDirective.name` and
|
||||
`PartOfDirective.libraryName` now return `DottedName?`.
|
||||
* **Breaking Change:** `DottedName.components` (NodeList<SimpleIdentifier>) is
|
||||
replaced with `DottedName.tokens` (List<Token>).
|
||||
|
||||
## 11.0.0
|
||||
|
||||
|
||||
+31
-29
@@ -138,6 +138,7 @@ package:analyzer/analysis_rule/rule_visitor_registry.dart:
|
||||
addBinaryExpression (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBlock (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBlockClassBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBlockEnumBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBlockFunctionBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBooleanLiteral (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addBreakStatement (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
@@ -170,9 +171,9 @@ package:analyzer/analysis_rule/rule_visitor_registry.dart:
|
||||
addDottedName (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addDoubleLiteral (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEmptyClassBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEmptyEnumBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEmptyFunctionBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEmptyStatement (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEnumBody (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEnumConstantArguments (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEnumConstantDeclaration (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addEnumDeclaration (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
@@ -221,7 +222,6 @@ package:analyzer/analysis_rule/rule_visitor_registry.dart:
|
||||
addLabel (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addLabeledStatement (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addLibraryDirective (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addLibraryIdentifier (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addListLiteral (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addListPattern (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
addLogicalAndPattern (method: void Function(AbstractAnalysisRule, AstVisitor<dynamic>))
|
||||
@@ -659,6 +659,7 @@ package:analyzer/dart/ast/ast.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -691,9 +692,9 @@ package:analyzer/dart/ast/ast.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: R? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: R? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: R? Function(EnumDeclaration))
|
||||
@@ -742,7 +743,6 @@ package:analyzer/dart/ast/ast.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: R? Function(LogicalAndPattern))
|
||||
@@ -841,6 +841,12 @@ package:analyzer/dart/ast/ast.dart:
|
||||
leftBracket (getter: Token)
|
||||
members (getter: NodeList<ClassMember>)
|
||||
rightBracket (getter: Token)
|
||||
BlockEnumBody (class extends Object implements EnumBody, abstract, final):
|
||||
constants (getter: NodeList<EnumConstantDeclaration>)
|
||||
leftBracket (getter: Token)
|
||||
members (getter: NodeList<ClassMember>)
|
||||
rightBracket (getter: Token)
|
||||
semicolon (getter: Token?)
|
||||
BlockFunctionBody (class extends Object implements FunctionBody, abstract, final):
|
||||
block (getter: Block)
|
||||
BooleanLiteral (class extends Object implements Literal, abstract, final):
|
||||
@@ -1040,22 +1046,19 @@ package:analyzer/dart/ast/ast.dart:
|
||||
period (getter: Token)
|
||||
propertyName (getter: SimpleIdentifier)
|
||||
DottedName (class extends Object implements AstNode, abstract, final):
|
||||
components (getter: NodeList<SimpleIdentifier>)
|
||||
tokens (getter: List<Token>)
|
||||
DoubleLiteral (class extends Object implements Literal, abstract, final):
|
||||
literal (getter: Token)
|
||||
value (getter: double)
|
||||
EmptyClassBody (class extends Object implements ClassBody, sealed (immediate subtypes: EmptyClassBodyImpl)):
|
||||
semicolon (getter: Token)
|
||||
EmptyEnumBody (class extends Object implements EnumBody, abstract, final):
|
||||
semicolon (getter: Token)
|
||||
EmptyFunctionBody (class extends Object implements FunctionBody, abstract, final):
|
||||
semicolon (getter: Token)
|
||||
EmptyStatement (class extends Object implements Statement, abstract, final):
|
||||
semicolon (getter: Token)
|
||||
EnumBody (class extends Object implements AstNode, sealed (immediate subtypes: EnumBodyImpl)):
|
||||
constants (getter: NodeList<EnumConstantDeclaration>)
|
||||
leftBracket (getter: Token)
|
||||
members (getter: NodeList<ClassMember>)
|
||||
rightBracket (getter: Token)
|
||||
semicolon (getter: Token?)
|
||||
EnumBody (class extends Object implements AstNode, sealed (immediate subtypes: BlockEnumBody, EmptyEnumBody, EnumBodyImpl))
|
||||
EnumConstantArguments (class extends Object implements AstNode, abstract, final):
|
||||
argumentList (getter: ArgumentList)
|
||||
constructorSelector (getter: ConstructorSelector?)
|
||||
@@ -1100,7 +1103,7 @@ package:analyzer/dart/ast/ast.dart:
|
||||
superclass (getter: NamedType)
|
||||
ExtensionDeclaration (class extends Object implements CompilationUnitMember, abstract, final):
|
||||
augmentKeyword (getter: Token?)
|
||||
body (getter: BlockClassBody)
|
||||
body (getter: ClassBody)
|
||||
declaredFragment (getter: ExtensionFragment?)
|
||||
extensionKeyword (getter: Token)
|
||||
name (getter: Token?)
|
||||
@@ -1262,7 +1265,7 @@ package:analyzer/dart/ast/ast.dart:
|
||||
whenClause (getter: WhenClause?)
|
||||
HideCombinator (class extends Object implements Combinator, abstract, final):
|
||||
hiddenNames (getter: NodeList<SimpleIdentifier>)
|
||||
Identifier (class extends Object implements Expression, CommentReferableExpression, sealed (immediate subtypes: IdentifierImpl, LibraryIdentifier, PrefixedIdentifier, SimpleIdentifier)):
|
||||
Identifier (class extends Object implements Expression, CommentReferableExpression, sealed (immediate subtypes: IdentifierImpl, PrefixedIdentifier, SimpleIdentifier)):
|
||||
isPrivateName (static method: bool Function(String))
|
||||
element (getter: Element?)
|
||||
name (getter: String)
|
||||
@@ -1352,10 +1355,8 @@ package:analyzer/dart/ast/ast.dart:
|
||||
LibraryDirective (class extends Object implements Directive, abstract, final):
|
||||
element (getter: LibraryElement?)
|
||||
libraryKeyword (getter: Token)
|
||||
name (getter: LibraryIdentifier?)
|
||||
name (getter: DottedName?)
|
||||
semicolon (getter: Token)
|
||||
LibraryIdentifier (class extends Object implements Identifier, abstract, final):
|
||||
components (getter: NodeList<SimpleIdentifier>)
|
||||
ListLiteral (class extends Object implements TypedLiteral, abstract, final):
|
||||
elements (getter: NodeList<CollectionElement>)
|
||||
leftBracket (getter: Token)
|
||||
@@ -1422,7 +1423,7 @@ package:analyzer/dart/ast/ast.dart:
|
||||
MixinDeclaration (class extends Object implements CompilationUnitMember, abstract, final):
|
||||
augmentKeyword (getter: Token?)
|
||||
baseKeyword (getter: Token?)
|
||||
body (getter: BlockClassBody)
|
||||
body (getter: ClassBody)
|
||||
declaredFragment (getter: MixinFragment?)
|
||||
implementsClause (getter: ImplementsClause?)
|
||||
mixinKeyword (getter: Token)
|
||||
@@ -1497,7 +1498,7 @@ package:analyzer/dart/ast/ast.dart:
|
||||
partKeyword (getter: Token)
|
||||
semicolon (getter: Token)
|
||||
PartOfDirective (class extends Object implements Directive, abstract, final):
|
||||
libraryName (getter: LibraryIdentifier?)
|
||||
libraryName (getter: DottedName?)
|
||||
ofKeyword (getter: Token)
|
||||
partKeyword (getter: Token)
|
||||
semicolon (getter: Token)
|
||||
@@ -2182,6 +2183,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -2225,6 +2227,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
@@ -2285,7 +2288,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLiteral (method: R? Function(Literal))
|
||||
@@ -2399,6 +2401,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -2431,9 +2434,9 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: R? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: R? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: R? Function(EnumDeclaration))
|
||||
@@ -2482,7 +2485,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: R? Function(LogicalAndPattern))
|
||||
@@ -2582,6 +2584,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -2614,9 +2617,9 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: R? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: R? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: R? Function(EnumDeclaration))
|
||||
@@ -2665,7 +2668,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: R? Function(LogicalAndPattern))
|
||||
@@ -2765,6 +2767,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -2797,9 +2800,9 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: R? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: R? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: R? Function(EnumDeclaration))
|
||||
@@ -2848,7 +2851,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: R? Function(LogicalAndPattern))
|
||||
@@ -2949,6 +2951,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: T? Function(BinaryExpression))
|
||||
visitBlock (method: T? Function(Block))
|
||||
visitBlockClassBody (method: T? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: T? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: T? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: T? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: T? Function(BreakStatement))
|
||||
@@ -2981,9 +2984,9 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: T? Function(DottedName))
|
||||
visitDoubleLiteral (method: T? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: T? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: T? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: T? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: T? Function(EmptyStatement))
|
||||
visitEnumBody (method: T? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: T? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: T? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: T? Function(EnumDeclaration))
|
||||
@@ -3032,7 +3035,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: T? Function(Label))
|
||||
visitLabeledStatement (method: T? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: T? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: T? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: T? Function(ListLiteral))
|
||||
visitListPattern (method: T? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: T? Function(LogicalAndPattern))
|
||||
@@ -3132,6 +3134,7 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitBinaryExpression (method: R? Function(BinaryExpression))
|
||||
visitBlock (method: R? Function(Block))
|
||||
visitBlockClassBody (method: R? Function(BlockClassBody))
|
||||
visitBlockEnumBody (method: R? Function(BlockEnumBody))
|
||||
visitBlockFunctionBody (method: R? Function(BlockFunctionBody))
|
||||
visitBooleanLiteral (method: R? Function(BooleanLiteral))
|
||||
visitBreakStatement (method: R? Function(BreakStatement))
|
||||
@@ -3164,9 +3167,9 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitDottedName (method: R? Function(DottedName))
|
||||
visitDoubleLiteral (method: R? Function(DoubleLiteral))
|
||||
visitEmptyClassBody (method: R? Function(EmptyClassBody))
|
||||
visitEmptyEnumBody (method: R? Function(EmptyEnumBody))
|
||||
visitEmptyFunctionBody (method: R? Function(EmptyFunctionBody))
|
||||
visitEmptyStatement (method: R? Function(EmptyStatement))
|
||||
visitEnumBody (method: R? Function(EnumBody))
|
||||
visitEnumConstantArguments (method: R? Function(EnumConstantArguments))
|
||||
visitEnumConstantDeclaration (method: R? Function(EnumConstantDeclaration))
|
||||
visitEnumDeclaration (method: R? Function(EnumDeclaration))
|
||||
@@ -3215,7 +3218,6 @@ package:analyzer/dart/ast/visitor.dart:
|
||||
visitLabel (method: R? Function(Label))
|
||||
visitLabeledStatement (method: R? Function(LabeledStatement))
|
||||
visitLibraryDirective (method: R? Function(LibraryDirective))
|
||||
visitLibraryIdentifier (method: R? Function(LibraryIdentifier))
|
||||
visitListLiteral (method: R? Function(ListLiteral))
|
||||
visitListPattern (method: R? Function(ListPattern))
|
||||
visitLogicalAndPattern (method: R? Function(LogicalAndPattern))
|
||||
|
||||
@@ -58,6 +58,8 @@ abstract class RuleVisitorRegistry {
|
||||
|
||||
void addBlockClassBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addBlockEnumBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addBlockFunctionBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addBooleanLiteral(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
@@ -134,12 +136,12 @@ abstract class RuleVisitorRegistry {
|
||||
|
||||
void addEmptyClassBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEmptyEnumBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEmptyFunctionBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEmptyStatement(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEnumBody(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEnumConstantArguments(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addEnumConstantDeclaration(
|
||||
@@ -269,8 +271,6 @@ abstract class RuleVisitorRegistry {
|
||||
|
||||
void addLibraryDirective(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addLibraryIdentifier(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addListLiteral(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
void addListPattern(AbstractAnalysisRule rule, AstVisitor visitor);
|
||||
|
||||
@@ -57,6 +57,7 @@ export 'package:analyzer/src/dart/ast/ast.dart'
|
||||
AwaitExpression,
|
||||
BinaryExpression,
|
||||
Block,
|
||||
BlockEnumBody,
|
||||
BlockClassBody,
|
||||
BlockFunctionBody,
|
||||
BooleanLiteral,
|
||||
@@ -103,6 +104,7 @@ export 'package:analyzer/src/dart/ast/ast.dart'
|
||||
DottedName,
|
||||
DoubleLiteral,
|
||||
EmptyClassBody,
|
||||
EmptyEnumBody,
|
||||
EmptyFunctionBody,
|
||||
EmptyStatement,
|
||||
EnumBody,
|
||||
@@ -164,7 +166,6 @@ export 'package:analyzer/src/dart/ast/ast.dart'
|
||||
Label,
|
||||
LabeledStatement,
|
||||
LibraryDirective,
|
||||
LibraryIdentifier,
|
||||
ListLiteral,
|
||||
ListPattern,
|
||||
ListPatternElement,
|
||||
|
||||
@@ -88,6 +88,9 @@ class GeneralizingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitBlockClassBody(BlockClassBody node) => visitClassBody(node);
|
||||
|
||||
@override
|
||||
R? visitBlockEnumBody(BlockEnumBody node) => visitEnumBody(node);
|
||||
|
||||
@override
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node) => visitFunctionBody(node);
|
||||
|
||||
@@ -220,13 +223,15 @@ class GeneralizingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitEmptyClassBody(EmptyClassBody node) => visitClassBody(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node) => visitEnumBody(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node) => visitFunctionBody(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyStatement(EmptyStatement node) => visitStatement(node);
|
||||
|
||||
@override
|
||||
R? visitEnumBody(EnumBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
@@ -419,9 +424,6 @@ class GeneralizingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitLibraryDirective(LibraryDirective node) => visitDirective(node);
|
||||
|
||||
@override
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node) => visitIdentifier(node);
|
||||
|
||||
@override
|
||||
R? visitListLiteral(ListLiteral node) => visitTypedLiteral(node);
|
||||
|
||||
@@ -843,6 +845,12 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitBlockEnumBody(BlockEnumBody node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node) {
|
||||
node.visitChildren(this);
|
||||
@@ -1037,6 +1045,12 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node) {
|
||||
node.visitChildren(this);
|
||||
@@ -1049,12 +1063,6 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitEnumBody(EnumBody node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
node.visitChildren(this);
|
||||
@@ -1343,12 +1351,6 @@ class RecursiveAstVisitor<R> implements AstVisitor<R> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
node.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
R? visitListLiteral(ListLiteral node) {
|
||||
node.visitChildren(this);
|
||||
@@ -1907,6 +1909,9 @@ class SimpleAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitBlockClassBody(BlockClassBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitBlockEnumBody(BlockEnumBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node) => null;
|
||||
|
||||
@@ -2005,15 +2010,15 @@ class SimpleAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitEmptyClassBody(EmptyClassBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitEmptyStatement(EmptyStatement node) => null;
|
||||
|
||||
@override
|
||||
R? visitEnumBody(EnumBody node) => null;
|
||||
|
||||
@override
|
||||
R? visitEnumConstantArguments(EnumConstantArguments node) => null;
|
||||
|
||||
@@ -2161,9 +2166,6 @@ class SimpleAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitLibraryDirective(LibraryDirective node) => null;
|
||||
|
||||
@override
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node) => null;
|
||||
|
||||
@override
|
||||
R? visitListLiteral(ListLiteral node) => null;
|
||||
|
||||
@@ -2482,6 +2484,9 @@ class ThrowingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitBlockClassBody(BlockClassBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitBlockEnumBody(BlockEnumBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node) => _throw(node);
|
||||
|
||||
@@ -2582,15 +2587,15 @@ class ThrowingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitEmptyClassBody(EmptyClassBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyStatement(EmptyStatement node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitEnumBody(EnumBody node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitEnumConstantArguments(EnumConstantArguments node) => _throw(node);
|
||||
|
||||
@@ -2743,9 +2748,6 @@ class ThrowingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitLibraryDirective(LibraryDirective node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node) => _throw(node);
|
||||
|
||||
@override
|
||||
R? visitListLiteral(ListLiteral node) => _throw(node);
|
||||
|
||||
@@ -3153,6 +3155,14 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitBlockEnumBody(BlockEnumBody node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitBlockEnumBody(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitBlockFunctionBody(BlockFunctionBody node) {
|
||||
stopwatch.start();
|
||||
@@ -3411,6 +3421,14 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitEmptyEnumBody(EmptyEnumBody node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitEmptyEnumBody(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitEmptyFunctionBody(EmptyFunctionBody node) {
|
||||
stopwatch.start();
|
||||
@@ -3427,14 +3445,6 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitEnumBody(EnumBody node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitEnumBody(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
stopwatch.start();
|
||||
@@ -3819,14 +3829,6 @@ class TimedAstVisitor<T> implements AstVisitor<T> {
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
stopwatch.start();
|
||||
T? result = _baseVisitor.visitLibraryIdentifier(node);
|
||||
stopwatch.stop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
T? visitListLiteral(ListLiteral node) {
|
||||
stopwatch.start();
|
||||
@@ -4558,6 +4560,9 @@ class UnifyingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitBlockClassBody(BlockClassBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitBlockEnumBody(BlockEnumBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node) => visitNode(node);
|
||||
|
||||
@@ -4662,15 +4667,15 @@ class UnifyingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitEmptyClassBody(EmptyClassBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitEmptyStatement(EmptyStatement node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitEnumBody(EnumBody node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitEnumConstantArguments(EnumConstantArguments node) => visitNode(node);
|
||||
|
||||
@@ -4828,9 +4833,6 @@ class UnifyingAstVisitor<R> implements AstVisitor<R> {
|
||||
@override
|
||||
R? visitLibraryDirective(LibraryDirective node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node) => visitNode(node);
|
||||
|
||||
@override
|
||||
R? visitListLiteral(ListLiteral node) => visitNode(node);
|
||||
|
||||
|
||||
@@ -35,13 +35,17 @@ DefinedNames computeDefinedNames(CompilationUnit unit) {
|
||||
}
|
||||
case EnumDeclaration():
|
||||
appendName(names.topLevelNames, member.namePart.typeName);
|
||||
for (var constant in member.body.constants) {
|
||||
appendName(names.classMemberNames, constant.name);
|
||||
if (member.body case BlockEnumBody body) {
|
||||
for (var constant in body.constants) {
|
||||
appendName(names.classMemberNames, constant.name);
|
||||
}
|
||||
body.members.forEach(appendClassMemberName);
|
||||
}
|
||||
member.body.members.forEach(appendClassMemberName);
|
||||
case ExtensionDeclaration():
|
||||
appendName(names.topLevelNames, member.name);
|
||||
member.body.members.forEach(appendClassMemberName);
|
||||
if (member.body case BlockClassBody body) {
|
||||
body.members.forEach(appendClassMemberName);
|
||||
}
|
||||
case ExtensionTypeDeclaration():
|
||||
appendName(names.topLevelNames, member.primaryConstructor.typeName);
|
||||
if (member.body case BlockClassBody body) {
|
||||
@@ -51,7 +55,9 @@ DefinedNames computeDefinedNames(CompilationUnit unit) {
|
||||
appendName(names.topLevelNames, member.name);
|
||||
case MixinDeclaration():
|
||||
appendName(names.topLevelNames, member.name);
|
||||
member.body.members.forEach(appendClassMemberName);
|
||||
if (member.body case BlockClassBody body) {
|
||||
body.members.forEach(appendClassMemberName);
|
||||
}
|
||||
case TopLevelVariableDeclaration():
|
||||
for (VariableDeclaration variable in member.variables.variables) {
|
||||
appendName(names.topLevelNames, variable.name);
|
||||
|
||||
@@ -942,7 +942,7 @@ class FileState {
|
||||
} else if (directive is LibraryDirective) {
|
||||
libraryDirective = UnlinkedLibraryDirective(
|
||||
docImports: buildDocImports(directive),
|
||||
name: directive.name?.name,
|
||||
name: directive.name?.tokens.map((e) => e.lexeme).join(),
|
||||
);
|
||||
} else if (directive is PartDirective) {
|
||||
var unlinked = _serializePart(directive);
|
||||
@@ -953,7 +953,7 @@ class FileState {
|
||||
if (libraryName != null) {
|
||||
partOfNameDirective ??= UnlinkedPartOfNameDirective(
|
||||
docImports: buildDocImports(directive),
|
||||
name: libraryName.name,
|
||||
name: libraryName.tokens.map((e) => e.lexeme).join(),
|
||||
nameRange: UnlinkedSourceRange(
|
||||
offset: libraryName.offset,
|
||||
length: libraryName.length,
|
||||
@@ -1074,7 +1074,7 @@ class FileState {
|
||||
List<Configuration> configurations,
|
||||
) {
|
||||
return configurations.map((configuration) {
|
||||
var name = configuration.name.components.join('.');
|
||||
var name = configuration.name.tokens.map((e) => e.lexeme).join();
|
||||
var value = configuration.value?.stringValue ?? '';
|
||||
return UnlinkedNamespaceDirectiveConfiguration(
|
||||
name: name,
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:analyzer/src/dart/ast/extensions.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/summary/format.dart';
|
||||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:analyzer/src/utilities/extensions/object.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
Element? declaredParameterElement(SimpleIdentifier node, Element? element) {
|
||||
@@ -898,7 +899,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||
node.namePart.typeName.lexeme,
|
||||
withClause: node.withClause,
|
||||
implementsClause: node.implementsClause,
|
||||
memberNodes: node.body.members,
|
||||
memberNodes: node.body.tryCast<BlockEnumBody>()?.members ?? [],
|
||||
);
|
||||
|
||||
super.visitEnumDeclaration(node);
|
||||
@@ -994,9 +995,6 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||
super.visitIndexExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {}
|
||||
|
||||
@override
|
||||
void visitMethodInvocation(MethodInvocation node) {
|
||||
SimpleIdentifier name = node.methodName;
|
||||
@@ -1017,7 +1015,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||
}
|
||||
|
||||
@override
|
||||
void visitMixinDeclaration(MixinDeclaration node) {
|
||||
void visitMixinDeclaration(covariant MixinDeclarationImpl node) {
|
||||
_addSubtypeForMixinDeclaration(node);
|
||||
super.visitMixinDeclaration(node);
|
||||
}
|
||||
@@ -1325,7 +1323,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
||||
}
|
||||
|
||||
/// Record the given mixin as a subclass of its direct superclasses.
|
||||
void _addSubtypeForMixinDeclaration(MixinDeclaration node) {
|
||||
void _addSubtypeForMixinDeclaration(MixinDeclarationImpl node) {
|
||||
_addSubtype(
|
||||
node.name.lexeme,
|
||||
onClause: node.onClause,
|
||||
|
||||
@@ -41,9 +41,9 @@ class _UnitApiSignatureComputer {
|
||||
for (var declaration in unit.declarations) {
|
||||
if (declaration is ClassDeclarationImpl) {
|
||||
_addClass(declaration);
|
||||
} else if (declaration is EnumDeclaration) {
|
||||
} else if (declaration is EnumDeclarationImpl) {
|
||||
_addEnum(declaration);
|
||||
} else if (declaration is ExtensionDeclaration) {
|
||||
} else if (declaration is ExtensionDeclarationImpl) {
|
||||
_addExtension(declaration);
|
||||
} else if (declaration is FunctionDeclaration) {
|
||||
var functionExpression = declaration.functionExpression;
|
||||
@@ -52,7 +52,7 @@ class _UnitApiSignatureComputer {
|
||||
functionExpression.parameters?.endToken ?? declaration.name,
|
||||
);
|
||||
_addFunctionBodyModifiers(functionExpression.body);
|
||||
} else if (declaration is MixinDeclaration) {
|
||||
} else if (declaration is MixinDeclarationImpl) {
|
||||
_addMixin(declaration);
|
||||
} else if (declaration is TopLevelVariableDeclaration) {
|
||||
_topLevelVariableDeclaration(declaration);
|
||||
@@ -94,7 +94,7 @@ class _UnitApiSignatureComputer {
|
||||
_addNode(node.redirectedConstructor);
|
||||
}
|
||||
|
||||
void _addEnum(EnumDeclaration node) {
|
||||
void _addEnum(EnumDeclarationImpl node) {
|
||||
var members = node.body.members;
|
||||
|
||||
// If not enhanced, include the whole node.
|
||||
@@ -108,7 +108,7 @@ class _UnitApiSignatureComputer {
|
||||
_addClassMembers(members, true);
|
||||
}
|
||||
|
||||
void _addExtension(ExtensionDeclaration node) {
|
||||
void _addExtension(ExtensionDeclarationImpl node) {
|
||||
_addTokens(node.beginToken, node.body.beginToken);
|
||||
_addClassMembers(node.body.members, false);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class _UnitApiSignatureComputer {
|
||||
signature.addBool(node.invokesSuperSelf);
|
||||
}
|
||||
|
||||
void _addMixin(MixinDeclaration node) {
|
||||
void _addMixin(MixinDeclarationImpl node) {
|
||||
_addTokens(node.beginToken, node.body.beginToken);
|
||||
_addClassMembers(node.body.members, false);
|
||||
signature.addStringList(node.superInvokedNames);
|
||||
|
||||
@@ -12,7 +12,6 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/base/analyzer_public_api.dart';
|
||||
import 'package:_fe_analyzer_shared/src/base/syntactic_entity.dart';
|
||||
import 'package:_fe_analyzer_shared/src/scanner/string_canonicalizer.dart';
|
||||
import 'package:_fe_analyzer_shared/src/type_inference/type_analysis_result.dart';
|
||||
import 'package:_fe_analyzer_shared/src/types/shared_type.dart';
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
@@ -2627,6 +2626,144 @@ final class BlockClassBodyImpl extends ClassBodyImpl implements BlockClassBody {
|
||||
}
|
||||
}
|
||||
|
||||
/// The enum declaration body, with constants and members.
|
||||
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
|
||||
abstract final class BlockEnumBody implements EnumBody {
|
||||
/// The enumeration constants being declared.
|
||||
NodeList<EnumConstantDeclaration> get constants;
|
||||
|
||||
/// The left curly bracket.
|
||||
Token get leftBracket;
|
||||
|
||||
/// The members declared in the body.
|
||||
NodeList<ClassMember> get members;
|
||||
|
||||
/// The right curly bracket.
|
||||
Token get rightBracket;
|
||||
|
||||
/// The optional semicolon after the last constant.
|
||||
Token? get semicolon;
|
||||
}
|
||||
|
||||
@GenerateNodeImpl(
|
||||
childEntitiesOrder: [
|
||||
GenerateNodeProperty('leftBracket'),
|
||||
GenerateNodeProperty('constants'),
|
||||
GenerateNodeProperty('semicolon'),
|
||||
GenerateNodeProperty('members'),
|
||||
GenerateNodeProperty('rightBracket'),
|
||||
],
|
||||
)
|
||||
final class BlockEnumBodyImpl extends EnumBodyImpl implements BlockEnumBody {
|
||||
@generated
|
||||
@override
|
||||
final Token leftBracket;
|
||||
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<EnumConstantDeclarationImpl> constants = NodeListImpl._();
|
||||
|
||||
@generated
|
||||
@override
|
||||
final Token? semicolon;
|
||||
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<ClassMemberImpl> members = NodeListImpl._();
|
||||
|
||||
@generated
|
||||
@override
|
||||
final Token rightBracket;
|
||||
|
||||
@generated
|
||||
BlockEnumBodyImpl({
|
||||
required this.leftBracket,
|
||||
required List<EnumConstantDeclarationImpl> constants,
|
||||
required this.semicolon,
|
||||
required List<ClassMemberImpl> members,
|
||||
required this.rightBracket,
|
||||
}) {
|
||||
this.constants._initialize(this, constants);
|
||||
this.members._initialize(this, members);
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get beginToken {
|
||||
return leftBracket;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get endToken {
|
||||
return rightBracket;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
ChildEntities get _childEntities => ChildEntities()
|
||||
..addToken('leftBracket', leftBracket)
|
||||
..addNodeList('constants', constants)
|
||||
..addToken('semicolon', semicolon)
|
||||
..addNodeList('members', members)
|
||||
..addToken('rightBracket', rightBracket);
|
||||
|
||||
@generated
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitBlockEnumBody(this);
|
||||
|
||||
@generated
|
||||
@override
|
||||
bool isInValueExpressionSlot(AstNode child) {
|
||||
assert(identical(child.parent, this));
|
||||
return false;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
constants.accept(visitor);
|
||||
members.accept(visitor);
|
||||
}
|
||||
|
||||
/// Visits the children of this node.
|
||||
///
|
||||
/// If a specific hook is provided for a child, it is called instead of
|
||||
/// dispatching the [visitor] to the child. It is the responsibility of the
|
||||
/// hook to visit the child.
|
||||
@generated
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(NodeListImpl<EnumConstantDeclarationImpl>)? visitConstants,
|
||||
void Function(NodeListImpl<ClassMemberImpl>)? visitMembers,
|
||||
}) {
|
||||
if (visitConstants != null) {
|
||||
visitConstants(constants);
|
||||
} else {
|
||||
constants.accept(visitor);
|
||||
}
|
||||
if (visitMembers != null) {
|
||||
visitMembers(members);
|
||||
} else {
|
||||
members.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
AstNodeImpl? _childContainingRange(int rangeOffset, int rangeEnd) {
|
||||
if (constants._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
if (members._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A function body that consists of a block of statements.
|
||||
///
|
||||
/// blockFunctionBody ::=
|
||||
@@ -8290,43 +8427,35 @@ final class DotShorthandPropertyAccessImpl extends ExpressionImpl
|
||||
/// [SimpleIdentifier] ('.' [SimpleIdentifier])*
|
||||
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
|
||||
abstract final class DottedName implements AstNode {
|
||||
/// The components of the identifier.
|
||||
NodeList<SimpleIdentifier> get components;
|
||||
/// The tokens comprising the identifier (including periods).
|
||||
List<Token> get tokens;
|
||||
}
|
||||
|
||||
@GenerateNodeImpl(childEntitiesOrder: [GenerateNodeProperty('components')])
|
||||
@GenerateNodeImpl(childEntitiesOrder: [GenerateNodeProperty('tokens')])
|
||||
final class DottedNameImpl extends AstNodeImpl implements DottedName {
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<SimpleIdentifierImpl> components = NodeListImpl._();
|
||||
final List<Token> tokens;
|
||||
|
||||
@generated
|
||||
DottedNameImpl({required List<SimpleIdentifierImpl> components}) {
|
||||
this.components._initialize(this, components);
|
||||
}
|
||||
DottedNameImpl({required this.tokens});
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get beginToken {
|
||||
if (components.beginToken case var result?) {
|
||||
return result;
|
||||
}
|
||||
throw StateError('Expected at least one non-null');
|
||||
return tokens.first;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get endToken {
|
||||
if (components.endToken case var result?) {
|
||||
return result;
|
||||
}
|
||||
throw StateError('Expected at least one non-null');
|
||||
return tokens[tokens.length - 1];
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
ChildEntities get _childEntities =>
|
||||
ChildEntities()..addNodeList('components', components);
|
||||
ChildEntities()..addTokenList('tokens', tokens);
|
||||
|
||||
@generated
|
||||
@override
|
||||
@@ -8341,34 +8470,15 @@ final class DottedNameImpl extends AstNodeImpl implements DottedName {
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
components.accept(visitor);
|
||||
}
|
||||
void visitChildren(AstVisitor visitor) {}
|
||||
|
||||
/// Visits the children of this node.
|
||||
///
|
||||
/// If a specific hook is provided for a child, it is called instead of
|
||||
/// dispatching the [visitor] to the child. It is the responsibility of the
|
||||
/// hook to visit the child.
|
||||
@generated
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(NodeListImpl<SimpleIdentifierImpl>)? visitComponents,
|
||||
}) {
|
||||
if (visitComponents != null) {
|
||||
visitComponents(components);
|
||||
} else {
|
||||
components.accept(visitor);
|
||||
}
|
||||
}
|
||||
void visitChildrenWithHooks(AstVisitor visitor) {}
|
||||
|
||||
@generated
|
||||
@override
|
||||
AstNodeImpl? _childContainingRange(int rangeOffset, int rangeEnd) {
|
||||
if (components._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8519,6 +8629,71 @@ final class EmptyClassBodyImpl extends ClassBodyImpl implements EmptyClassBody {
|
||||
}
|
||||
}
|
||||
|
||||
/// The empty enum body.
|
||||
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
|
||||
abstract final class EmptyEnumBody implements EnumBody {
|
||||
/// The semicolon token.
|
||||
Token get semicolon;
|
||||
}
|
||||
|
||||
@GenerateNodeImpl(childEntitiesOrder: [GenerateNodeProperty('semicolon')])
|
||||
final class EmptyEnumBodyImpl extends EnumBodyImpl implements EmptyEnumBody {
|
||||
@generated
|
||||
@override
|
||||
final Token semicolon;
|
||||
|
||||
@generated
|
||||
EmptyEnumBodyImpl({required this.semicolon});
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get beginToken {
|
||||
return semicolon;
|
||||
}
|
||||
|
||||
@override
|
||||
List<EnumConstantDeclarationImpl> get constants => const [];
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get endToken {
|
||||
return semicolon;
|
||||
}
|
||||
|
||||
@override
|
||||
List<ClassMemberImpl> get members => const [];
|
||||
|
||||
@generated
|
||||
@override
|
||||
ChildEntities get _childEntities =>
|
||||
ChildEntities()..addToken('semicolon', semicolon);
|
||||
|
||||
@generated
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitEmptyEnumBody(this);
|
||||
|
||||
@generated
|
||||
@override
|
||||
bool isInValueExpressionSlot(AstNode child) {
|
||||
assert(identical(child.parent, this));
|
||||
return false;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {}
|
||||
|
||||
/// Visits the children of this node.
|
||||
@generated
|
||||
void visitChildrenWithHooks(AstVisitor visitor) {}
|
||||
|
||||
@generated
|
||||
@override
|
||||
AstNodeImpl? _childContainingRange(int rangeOffset, int rangeEnd) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// An empty function body.
|
||||
///
|
||||
/// An empty function body can only appear in constructors or abstract methods.
|
||||
@@ -8654,145 +8829,14 @@ final class EmptyStatementImpl extends StatementImpl implements EmptyStatement {
|
||||
}
|
||||
}
|
||||
|
||||
/// The enum declaration body, with constants and members.
|
||||
/// The body of an enum declaration.
|
||||
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
|
||||
sealed class EnumBody implements AstNode {
|
||||
/// The enumeration constants being declared.
|
||||
NodeList<EnumConstantDeclaration> get constants;
|
||||
sealed class EnumBody implements AstNode {}
|
||||
|
||||
/// The left curly bracket.
|
||||
Token get leftBracket;
|
||||
sealed class EnumBodyImpl extends AstNodeImpl implements EnumBody {
|
||||
List<EnumConstantDeclarationImpl> get constants;
|
||||
|
||||
/// The members declared in the body.
|
||||
NodeList<ClassMember> get members;
|
||||
|
||||
/// The right curly bracket.
|
||||
Token get rightBracket;
|
||||
|
||||
/// The optional semicolon after the last constant.
|
||||
Token? get semicolon;
|
||||
}
|
||||
|
||||
@GenerateNodeImpl(
|
||||
childEntitiesOrder: [
|
||||
GenerateNodeProperty('leftBracket'),
|
||||
GenerateNodeProperty('constants'),
|
||||
GenerateNodeProperty('semicolon'),
|
||||
GenerateNodeProperty('members'),
|
||||
GenerateNodeProperty('rightBracket'),
|
||||
],
|
||||
)
|
||||
final class EnumBodyImpl extends AstNodeImpl implements EnumBody {
|
||||
@generated
|
||||
@override
|
||||
final Token leftBracket;
|
||||
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<EnumConstantDeclarationImpl> constants = NodeListImpl._();
|
||||
|
||||
@generated
|
||||
@override
|
||||
final Token? semicolon;
|
||||
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<ClassMemberImpl> members = NodeListImpl._();
|
||||
|
||||
@generated
|
||||
@override
|
||||
final Token rightBracket;
|
||||
|
||||
@generated
|
||||
EnumBodyImpl({
|
||||
required this.leftBracket,
|
||||
required List<EnumConstantDeclarationImpl> constants,
|
||||
required this.semicolon,
|
||||
required List<ClassMemberImpl> members,
|
||||
required this.rightBracket,
|
||||
}) {
|
||||
this.constants._initialize(this, constants);
|
||||
this.members._initialize(this, members);
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get beginToken {
|
||||
return leftBracket;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get endToken {
|
||||
return rightBracket;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
ChildEntities get _childEntities => ChildEntities()
|
||||
..addToken('leftBracket', leftBracket)
|
||||
..addNodeList('constants', constants)
|
||||
..addToken('semicolon', semicolon)
|
||||
..addNodeList('members', members)
|
||||
..addToken('rightBracket', rightBracket);
|
||||
|
||||
@generated
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitEnumBody(this);
|
||||
|
||||
@generated
|
||||
@override
|
||||
bool isInValueExpressionSlot(AstNode child) {
|
||||
assert(identical(child.parent, this));
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
constants.accept(visitor);
|
||||
members.accept(visitor);
|
||||
}
|
||||
|
||||
/// Visits the children of this node.
|
||||
///
|
||||
/// If a specific hook is provided for a child, it is called instead of
|
||||
/// dispatching the [visitor] to the child. It is the responsibility of the
|
||||
/// hook to visit the child.
|
||||
@generated
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(NodeListImpl<EnumConstantDeclarationImpl>)? visitConstants,
|
||||
void Function(NodeListImpl<ClassMemberImpl>)? visitMembers,
|
||||
}) {
|
||||
if (visitConstants != null) {
|
||||
visitConstants(constants);
|
||||
} else {
|
||||
constants.accept(visitor);
|
||||
}
|
||||
if (visitMembers != null) {
|
||||
visitMembers(members);
|
||||
} else {
|
||||
members.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
AstNodeImpl? _childContainingRange(int rangeOffset, int rangeEnd) {
|
||||
if (constants._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
if (members._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
List<ClassMemberImpl> get members;
|
||||
}
|
||||
|
||||
/// The arguments part of an enum constant.
|
||||
@@ -10201,7 +10245,7 @@ abstract final class ExtensionDeclaration implements CompilationUnitMember {
|
||||
Token? get augmentKeyword;
|
||||
|
||||
/// The body of the extension declaration.
|
||||
BlockClassBody get body;
|
||||
ClassBody get body;
|
||||
|
||||
@override
|
||||
ExtensionFragment? get declaredFragment;
|
||||
@@ -10260,7 +10304,7 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
||||
ExtensionOnClauseImpl? _onClause;
|
||||
|
||||
@generated
|
||||
BlockClassBodyImpl _body;
|
||||
ClassBodyImpl _body;
|
||||
|
||||
@override
|
||||
ExtensionFragmentImpl? declaredFragment;
|
||||
@@ -10277,7 +10321,7 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
||||
required this.name,
|
||||
required TypeParameterListImpl? typeParameters,
|
||||
required ExtensionOnClauseImpl? onClause,
|
||||
required BlockClassBodyImpl body,
|
||||
required ClassBodyImpl body,
|
||||
}) : _typeParameters = typeParameters,
|
||||
_onClause = onClause,
|
||||
_body = body {
|
||||
@@ -10288,10 +10332,10 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
||||
|
||||
@generated
|
||||
@override
|
||||
BlockClassBodyImpl get body => _body;
|
||||
ClassBodyImpl get body => _body;
|
||||
|
||||
@generated
|
||||
set body(BlockClassBodyImpl body) {
|
||||
set body(ClassBodyImpl body) {
|
||||
_body = _becomeParentOf(body);
|
||||
}
|
||||
|
||||
@@ -10370,7 +10414,7 @@ final class ExtensionDeclarationImpl extends CompilationUnitMemberImpl
|
||||
AstVisitor visitor, {
|
||||
void Function(TypeParameterListImpl)? visitTypeParameters,
|
||||
void Function(ExtensionOnClauseImpl)? visitOnClause,
|
||||
void Function(BlockClassBodyImpl)? visitBody,
|
||||
void Function(ClassBodyImpl)? visitBody,
|
||||
}) {
|
||||
super.visitChildren(visitor);
|
||||
if (typeParameters case var typeParameters?) {
|
||||
@@ -17833,7 +17877,7 @@ abstract final class LibraryDirective implements Directive {
|
||||
Token get libraryKeyword;
|
||||
|
||||
/// The name of the library being defined.
|
||||
LibraryIdentifier? get name;
|
||||
DottedName? get name;
|
||||
|
||||
/// The semicolon terminating the directive.
|
||||
Token get semicolon;
|
||||
@@ -17853,7 +17897,7 @@ final class LibraryDirectiveImpl extends DirectiveImpl
|
||||
final Token libraryKeyword;
|
||||
|
||||
@generated
|
||||
LibraryIdentifierImpl? _name;
|
||||
DottedNameImpl? _name;
|
||||
|
||||
@generated
|
||||
@override
|
||||
@@ -17867,7 +17911,7 @@ final class LibraryDirectiveImpl extends DirectiveImpl
|
||||
required super.comment,
|
||||
required super.metadata,
|
||||
required this.libraryKeyword,
|
||||
required LibraryIdentifierImpl? name,
|
||||
required DottedNameImpl? name,
|
||||
required this.semicolon,
|
||||
}) : _name = name {
|
||||
_becomeParentOf(name);
|
||||
@@ -17887,10 +17931,10 @@ final class LibraryDirectiveImpl extends DirectiveImpl
|
||||
|
||||
@generated
|
||||
@override
|
||||
LibraryIdentifierImpl? get name => _name;
|
||||
DottedNameImpl? get name => _name;
|
||||
|
||||
@generated
|
||||
set name(LibraryIdentifierImpl? name) {
|
||||
set name(DottedNameImpl? name) {
|
||||
_name = _becomeParentOf(name);
|
||||
}
|
||||
|
||||
@@ -17927,7 +17971,7 @@ final class LibraryDirectiveImpl extends DirectiveImpl
|
||||
@generated
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(LibraryIdentifierImpl)? visitName,
|
||||
void Function(DottedNameImpl)? visitName,
|
||||
}) {
|
||||
super.visitChildren(visitor);
|
||||
if (name case var name?) {
|
||||
@@ -17954,125 +17998,6 @@ final class LibraryDirectiveImpl extends DirectiveImpl
|
||||
}
|
||||
}
|
||||
|
||||
/// The identifier for a library.
|
||||
///
|
||||
/// libraryIdentifier ::=
|
||||
/// [SimpleIdentifier] ('.' [SimpleIdentifier])*
|
||||
@AnalyzerPublicApi(message: 'exported by lib/dart/ast/ast.dart')
|
||||
abstract final class LibraryIdentifier implements Identifier {
|
||||
/// The components of the identifier.
|
||||
NodeList<SimpleIdentifier> get components;
|
||||
}
|
||||
|
||||
@GenerateNodeImpl(childEntitiesOrder: [GenerateNodeProperty('components')])
|
||||
final class LibraryIdentifierImpl extends IdentifierImpl
|
||||
implements LibraryIdentifier {
|
||||
@generated
|
||||
@override
|
||||
final NodeListImpl<SimpleIdentifierImpl> components = NodeListImpl._();
|
||||
|
||||
@generated
|
||||
LibraryIdentifierImpl({required List<SimpleIdentifierImpl> components}) {
|
||||
this.components._initialize(this, components);
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get beginToken {
|
||||
if (components.beginToken case var result?) {
|
||||
return result;
|
||||
}
|
||||
throw StateError('Expected at least one non-null');
|
||||
}
|
||||
|
||||
@override
|
||||
Element? get element => null;
|
||||
|
||||
@generated
|
||||
@override
|
||||
Token get endToken {
|
||||
if (components.endToken case var result?) {
|
||||
return result;
|
||||
}
|
||||
throw StateError('Expected at least one non-null');
|
||||
}
|
||||
|
||||
@override
|
||||
String get name {
|
||||
StringBuffer buffer = StringBuffer();
|
||||
bool needsPeriod = false;
|
||||
int length = components.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
SimpleIdentifier identifier = components[i];
|
||||
if (needsPeriod) {
|
||||
buffer.write(".");
|
||||
} else {
|
||||
needsPeriod = true;
|
||||
}
|
||||
buffer.write(identifier.name);
|
||||
}
|
||||
return considerCanonicalizeString(buffer.toString());
|
||||
}
|
||||
|
||||
@override
|
||||
Precedence get precedence => Precedence.postfix;
|
||||
|
||||
@generated
|
||||
@override
|
||||
ChildEntities get _childEntities =>
|
||||
ChildEntities()..addNodeList('components', components);
|
||||
|
||||
@generated
|
||||
@override
|
||||
E? accept<E>(AstVisitor<E> visitor) => visitor.visitLibraryIdentifier(this);
|
||||
|
||||
@generated
|
||||
@override
|
||||
bool isInValueExpressionSlot(AstNode child) {
|
||||
assert(identical(child.parent, this));
|
||||
return false;
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
void resolveExpression(ResolverVisitor resolver, TypeImpl contextType) {
|
||||
resolver.visitLibraryIdentifier(this, contextType: contextType);
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
components.accept(visitor);
|
||||
}
|
||||
|
||||
/// Visits the children of this node.
|
||||
///
|
||||
/// If a specific hook is provided for a child, it is called instead of
|
||||
/// dispatching the [visitor] to the child. It is the responsibility of the
|
||||
/// hook to visit the child.
|
||||
@generated
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(NodeListImpl<SimpleIdentifierImpl>)? visitComponents,
|
||||
}) {
|
||||
if (visitComponents != null) {
|
||||
visitComponents(components);
|
||||
} else {
|
||||
components.accept(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
@generated
|
||||
@override
|
||||
AstNodeImpl? _childContainingRange(int rangeOffset, int rangeEnd) {
|
||||
if (components._elementContainingRange(rangeOffset, rangeEnd)
|
||||
case var result?) {
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A list literal.
|
||||
///
|
||||
/// listLiteral ::=
|
||||
@@ -19916,7 +19841,7 @@ abstract final class MixinDeclaration implements CompilationUnitMember {
|
||||
Token? get baseKeyword;
|
||||
|
||||
/// The body of the mixin declaration.
|
||||
BlockClassBody get body;
|
||||
ClassBody get body;
|
||||
|
||||
@override
|
||||
MixinFragment? get declaredFragment;
|
||||
@@ -19981,7 +19906,7 @@ final class MixinDeclarationImpl extends CompilationUnitMemberImpl
|
||||
ImplementsClauseImpl? _implementsClause;
|
||||
|
||||
@generated
|
||||
BlockClassBodyImpl _body;
|
||||
ClassBodyImpl _body;
|
||||
|
||||
@override
|
||||
MixinFragmentImpl? declaredFragment;
|
||||
@@ -19999,7 +19924,7 @@ final class MixinDeclarationImpl extends CompilationUnitMemberImpl
|
||||
required TypeParameterListImpl? typeParameters,
|
||||
required MixinOnClauseImpl? onClause,
|
||||
required ImplementsClauseImpl? implementsClause,
|
||||
required BlockClassBodyImpl body,
|
||||
required ClassBodyImpl body,
|
||||
}) : _typeParameters = typeParameters,
|
||||
_onClause = onClause,
|
||||
_implementsClause = implementsClause,
|
||||
@@ -20012,10 +19937,10 @@ final class MixinDeclarationImpl extends CompilationUnitMemberImpl
|
||||
|
||||
@generated
|
||||
@override
|
||||
BlockClassBodyImpl get body => _body;
|
||||
ClassBodyImpl get body => _body;
|
||||
|
||||
@generated
|
||||
set body(BlockClassBodyImpl body) {
|
||||
set body(ClassBodyImpl body) {
|
||||
_body = _becomeParentOf(body);
|
||||
}
|
||||
|
||||
@@ -20108,7 +20033,7 @@ final class MixinDeclarationImpl extends CompilationUnitMemberImpl
|
||||
void Function(TypeParameterListImpl)? visitTypeParameters,
|
||||
void Function(MixinOnClauseImpl)? visitOnClause,
|
||||
void Function(ImplementsClauseImpl)? visitImplementsClause,
|
||||
void Function(BlockClassBodyImpl)? visitBody,
|
||||
void Function(ClassBodyImpl)? visitBody,
|
||||
}) {
|
||||
super.visitChildren(visitor);
|
||||
if (typeParameters case var typeParameters?) {
|
||||
@@ -22312,7 +22237,7 @@ abstract final class PartOfDirective implements Directive {
|
||||
/// The name of the library that the containing compilation unit is part of,
|
||||
/// or `null` if no name was given (typically because a library URI was
|
||||
/// provided).
|
||||
LibraryIdentifier? get libraryName;
|
||||
DottedName? get libraryName;
|
||||
|
||||
/// The token representing the `of` keyword.
|
||||
Token get ofKeyword;
|
||||
@@ -22351,7 +22276,7 @@ final class PartOfDirectiveImpl extends DirectiveImpl
|
||||
StringLiteralImpl? _uri;
|
||||
|
||||
@generated
|
||||
LibraryIdentifierImpl? _libraryName;
|
||||
DottedNameImpl? _libraryName;
|
||||
|
||||
@generated
|
||||
@override
|
||||
@@ -22364,7 +22289,7 @@ final class PartOfDirectiveImpl extends DirectiveImpl
|
||||
required this.partKeyword,
|
||||
required this.ofKeyword,
|
||||
required StringLiteralImpl? uri,
|
||||
required LibraryIdentifierImpl? libraryName,
|
||||
required DottedNameImpl? libraryName,
|
||||
required this.semicolon,
|
||||
}) : _uri = uri,
|
||||
_libraryName = libraryName {
|
||||
@@ -22386,10 +22311,10 @@ final class PartOfDirectiveImpl extends DirectiveImpl
|
||||
|
||||
@generated
|
||||
@override
|
||||
LibraryIdentifierImpl? get libraryName => _libraryName;
|
||||
DottedNameImpl? get libraryName => _libraryName;
|
||||
|
||||
@generated
|
||||
set libraryName(LibraryIdentifierImpl? libraryName) {
|
||||
set libraryName(DottedNameImpl? libraryName) {
|
||||
_libraryName = _becomeParentOf(libraryName);
|
||||
}
|
||||
|
||||
@@ -22439,7 +22364,7 @@ final class PartOfDirectiveImpl extends DirectiveImpl
|
||||
void visitChildrenWithHooks(
|
||||
AstVisitor visitor, {
|
||||
void Function(StringLiteralImpl)? visitUri,
|
||||
void Function(LibraryIdentifierImpl)? visitLibraryName,
|
||||
void Function(DottedNameImpl)? visitLibraryName,
|
||||
}) {
|
||||
super.visitChildren(visitor);
|
||||
if (uri case var uri?) {
|
||||
@@ -23943,9 +23868,6 @@ final class PrimaryConstructorDeclarationImpl extends ClassNamePartImpl
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
|
||||
|
||||
@generated
|
||||
@override
|
||||
void visitChildren(AstVisitor visitor) {
|
||||
|
||||
@@ -54,6 +54,8 @@ abstract class AstVisitor<R> {
|
||||
|
||||
R? visitBlockClassBody(BlockClassBody node);
|
||||
|
||||
R? visitBlockEnumBody(BlockEnumBody node);
|
||||
|
||||
R? visitBlockFunctionBody(BlockFunctionBody node);
|
||||
|
||||
R? visitBooleanLiteral(BooleanLiteral node);
|
||||
@@ -120,12 +122,12 @@ abstract class AstVisitor<R> {
|
||||
|
||||
R? visitEmptyClassBody(EmptyClassBody node);
|
||||
|
||||
R? visitEmptyEnumBody(EmptyEnumBody node);
|
||||
|
||||
R? visitEmptyFunctionBody(EmptyFunctionBody node);
|
||||
|
||||
R? visitEmptyStatement(EmptyStatement node);
|
||||
|
||||
R? visitEnumBody(EnumBody node);
|
||||
|
||||
R? visitEnumConstantArguments(EnumConstantArguments node);
|
||||
|
||||
R? visitEnumConstantDeclaration(EnumConstantDeclaration node);
|
||||
@@ -222,8 +224,6 @@ abstract class AstVisitor<R> {
|
||||
|
||||
R? visitLibraryDirective(LibraryDirective node);
|
||||
|
||||
R? visitLibraryIdentifier(LibraryIdentifier node);
|
||||
|
||||
R? visitListLiteral(ListLiteral node);
|
||||
|
||||
R? visitListPattern(ListPattern node);
|
||||
|
||||
@@ -106,6 +106,15 @@ class _ElementMapper2 extends GeneralizingAstVisitor<Element> {
|
||||
return node.propertyName.element;
|
||||
}
|
||||
|
||||
@override
|
||||
Element? visitDottedName(DottedName node) {
|
||||
var parent = node.parent;
|
||||
if (parent is LibraryDirective) {
|
||||
return parent.element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Element? visitEnumConstantDeclaration(EnumConstantDeclaration node) {
|
||||
return node.declaredFragment?.element;
|
||||
@@ -187,7 +196,7 @@ class _ElementMapper2 extends GeneralizingAstVisitor<Element> {
|
||||
return parent3.constructorElement;
|
||||
}
|
||||
}
|
||||
} else if (parent is LibraryIdentifier) {
|
||||
} else if (parent is DottedName) {
|
||||
var grandParent = parent.parent;
|
||||
if (grandParent is LibraryDirective) {
|
||||
return grandParent.element;
|
||||
@@ -263,7 +272,7 @@ class _ElementMapper2 extends GeneralizingAstVisitor<Element> {
|
||||
|
||||
@override
|
||||
Element? visitPartOfDirective(PartOfDirective node) {
|
||||
return node.libraryName?.element;
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -136,6 +136,15 @@ class ToSourceVisitor implements AstVisitor<void> {
|
||||
sink.write('}');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
sink.write(' {');
|
||||
_visitNodeList(node.constants, separator: ', ');
|
||||
_visitToken(node.semicolon);
|
||||
_visitNodeList(node.members, prefix: ' ', separator: ' ');
|
||||
sink.write('}');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockFunctionBody(BlockFunctionBody node) {
|
||||
var keyword = node.keyword;
|
||||
@@ -400,7 +409,9 @@ class ToSourceVisitor implements AstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
_visitNodeList(node.components, separator: '.');
|
||||
for (var token in node.tokens) {
|
||||
sink.write(token.lexeme);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -413,6 +424,11 @@ class ToSourceVisitor implements AstVisitor<void> {
|
||||
sink.write(';');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {
|
||||
sink.write(';');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEmptyFunctionBody(EmptyFunctionBody node) {
|
||||
sink.write(';');
|
||||
@@ -423,15 +439,6 @@ class ToSourceVisitor implements AstVisitor<void> {
|
||||
sink.write(';');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
sink.write(' {');
|
||||
_visitNodeList(node.constants, separator: ', ');
|
||||
_visitToken(node.semicolon);
|
||||
_visitNodeList(node.members, prefix: ' ', separator: ' ');
|
||||
sink.write('}');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
_visitNode(node.typeArguments);
|
||||
@@ -874,11 +881,6 @@ class ToSourceVisitor implements AstVisitor<void> {
|
||||
sink.write(';');
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
sink.write(node.name);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
_visitToken(node.constKeyword, suffix: ' ');
|
||||
|
||||
@@ -336,6 +336,24 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitBlockClassBody(covariant BlockClassBodyImpl node) {
|
||||
if (_replaceInList(node.members)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitBlockEnumBody(covariant BlockEnumBodyImpl node) {
|
||||
if (_replaceInList(node.constants)) {
|
||||
return true;
|
||||
} else if (_replaceInList(node.members)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitBlockFunctionBody(covariant BlockFunctionBodyImpl node) {
|
||||
if (identical(node.block, _oldNode)) {
|
||||
@@ -622,9 +640,6 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
|
||||
|
||||
@override
|
||||
bool visitDottedName(covariant DottedNameImpl node) {
|
||||
if (_replaceInList(node.components)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@@ -637,16 +652,6 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
|
||||
@override
|
||||
bool visitEmptyStatement(EmptyStatement node) => visitNode(node);
|
||||
|
||||
@override
|
||||
bool? visitEnumBody(covariant EnumBodyImpl node) {
|
||||
if (_replaceInList(node.constants)) {
|
||||
return true;
|
||||
} else if (_replaceInList(node.members)) {
|
||||
return true;
|
||||
}
|
||||
return super.visitEnumBody(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
throw UnimplementedError();
|
||||
@@ -1114,20 +1119,12 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
|
||||
@override
|
||||
bool visitLibraryDirective(covariant LibraryDirectiveImpl node) {
|
||||
if (identical(node.name, _oldNode)) {
|
||||
node.name = _newNode as LibraryIdentifierImpl;
|
||||
node.name = _newNode as DottedNameImpl;
|
||||
return true;
|
||||
}
|
||||
return visitAnnotatedNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitLibraryIdentifier(covariant LibraryIdentifierImpl node) {
|
||||
if (_replaceInList(node.components)) {
|
||||
return true;
|
||||
}
|
||||
return visitNode(node);
|
||||
}
|
||||
|
||||
@override
|
||||
bool visitListLiteral(covariant ListLiteralImpl node) {
|
||||
if (_replaceInList(node.elements)) {
|
||||
@@ -1255,7 +1252,7 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
|
||||
@override
|
||||
bool visitPartOfDirective(covariant PartOfDirectiveImpl node) {
|
||||
if (identical(node.libraryName, _oldNode)) {
|
||||
node.libraryName = _newNode as LibraryIdentifierImpl;
|
||||
node.libraryName = _newNode as DottedNameImpl;
|
||||
return true;
|
||||
}
|
||||
return visitAnnotatedNode(node);
|
||||
|
||||
@@ -18,10 +18,7 @@ Element? getElementOfNode2(AstNode? node) {
|
||||
if (node is NameWithTypeParameters) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node is SimpleIdentifier && node.parent is LibraryIdentifier) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node is LibraryIdentifier) {
|
||||
if (node is DottedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
if (node is StringLiteral && node.parent is UriBasedDirective) {
|
||||
|
||||
@@ -367,6 +367,12 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||
node.visitChildrenWithHooks(this, visitPropertyName: (_) {});
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEmptyClassBody(EmptyClassBody node) {}
|
||||
|
||||
@override
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {}
|
||||
|
||||
@override
|
||||
void visitEmptyFunctionBody(covariant EmptyFunctionBodyImpl node) {
|
||||
node.localVariableInfo = _localVariableInfo;
|
||||
@@ -653,9 +659,6 @@ class ResolutionVisitor extends RecursiveAstVisitor<void> {
|
||||
super.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {}
|
||||
|
||||
@override
|
||||
void visitMethodDeclaration(covariant MethodDeclarationImpl node) {
|
||||
_scopeContext.visitMethodDeclaration(node, visitor: this);
|
||||
|
||||
@@ -220,11 +220,13 @@ class DartdocDirectiveInfo {
|
||||
ClassDeclaration() =>
|
||||
declaration.body.tryCast<BlockClassBody>()?.members,
|
||||
EnumDeclaration() => [
|
||||
...declaration.body.constants,
|
||||
...declaration.body.members,
|
||||
...?declaration.body.tryCast<BlockEnumBody>()?.constants,
|
||||
...?declaration.body.tryCast<BlockEnumBody>()?.members,
|
||||
],
|
||||
MixinDeclaration() => declaration.body.members,
|
||||
ExtensionDeclaration() => declaration.body.members,
|
||||
MixinDeclaration() =>
|
||||
declaration.body.tryCast<BlockClassBody>()?.members,
|
||||
ExtensionDeclaration() =>
|
||||
declaration.body.tryCast<BlockClassBody>()?.members,
|
||||
ExtensionTypeDeclaration() =>
|
||||
declaration.body.tryCast<BlockClassBody>()?.members,
|
||||
_ => null,
|
||||
|
||||
@@ -483,7 +483,6 @@ class MemberDuplicateDefinitionVerifier {
|
||||
|
||||
var elementContext = _getElementContext(firstFragment);
|
||||
var instanceScope = elementContext.instanceScope;
|
||||
|
||||
for (var member in node.body.members) {
|
||||
if (member is FieldDeclarationImpl) {
|
||||
if (member.isStatic) {
|
||||
|
||||
@@ -1544,7 +1544,7 @@ class AstBuilder extends StackListener {
|
||||
Token endToken,
|
||||
) {
|
||||
assert(optional('enum', enumKeyword));
|
||||
assert(optional('{', leftBrace));
|
||||
assert(optional('{', leftBrace) || optional(';', leftBrace));
|
||||
debugEvent("Enum");
|
||||
|
||||
var builder = _classLikeBuilder as _EnumDeclarationBuilder;
|
||||
@@ -2348,7 +2348,7 @@ class AstBuilder extends StackListener {
|
||||
assert(optional(';', semicolon));
|
||||
debugEvent("LibraryName");
|
||||
|
||||
var libraryName = hasName ? pop() as List<SimpleIdentifierImpl>? : null;
|
||||
var libraryName = hasName ? pop() as List<Token>? : null;
|
||||
|
||||
if (!hasName && !enableUnnamedLibraries) {
|
||||
_reportFeatureNotEnabled(
|
||||
@@ -2356,9 +2356,10 @@ class AstBuilder extends StackListener {
|
||||
startToken: libraryKeyword,
|
||||
);
|
||||
}
|
||||
var name = libraryName == null
|
||||
? null
|
||||
: LibraryIdentifierImpl(components: libraryName);
|
||||
DottedNameImpl? name;
|
||||
if (libraryName != null) {
|
||||
name = DottedNameImpl(tokens: libraryName);
|
||||
}
|
||||
var metadata = pop() as List<AnnotationImpl>?;
|
||||
var comment = _findComment(metadata, libraryKeyword);
|
||||
directives.add(
|
||||
@@ -2732,14 +2733,13 @@ class AstBuilder extends StackListener {
|
||||
assert(optional(';', semicolon));
|
||||
debugEvent("PartOf");
|
||||
var libraryNameOrUri = pop();
|
||||
LibraryIdentifierImpl? name;
|
||||
DottedNameImpl? name;
|
||||
StringLiteralImpl? uri;
|
||||
if (libraryNameOrUri is StringLiteralImpl) {
|
||||
uri = libraryNameOrUri;
|
||||
} else {
|
||||
name = LibraryIdentifierImpl(
|
||||
components: libraryNameOrUri as List<SimpleIdentifierImpl>,
|
||||
);
|
||||
var libraryName = libraryNameOrUri as List<Token>;
|
||||
name = DottedNameImpl(tokens: libraryName);
|
||||
if (_featureSet.isEnabled(Feature.enhanced_parts)) {
|
||||
diagnosticReporter.diagnosticReporter?.report(diag.partOfName.at(name));
|
||||
}
|
||||
@@ -4051,8 +4051,21 @@ class AstBuilder extends StackListener {
|
||||
assert(firstIdentifier.isIdentifier);
|
||||
debugEvent("DottedName");
|
||||
|
||||
var components = popTypedList2<SimpleIdentifierImpl>(count);
|
||||
push(DottedNameImpl(components: components));
|
||||
var identifiers = popTypedList2<Token>(count);
|
||||
var tokens = <Token>[];
|
||||
if (identifiers.isNotEmpty) {
|
||||
// TODO(scheglov): The parser does not use [handleQualified] for
|
||||
// [handleDottedName], so no periods in [identifiers].
|
||||
// We must walk the token stream.
|
||||
var t = identifiers.first;
|
||||
var end = identifiers.last;
|
||||
while (t != end) {
|
||||
tokens.add(t);
|
||||
t = t.next!;
|
||||
}
|
||||
tokens.add(end);
|
||||
}
|
||||
push(DottedNameImpl(tokens: tokens));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -4161,7 +4174,7 @@ class AstBuilder extends StackListener {
|
||||
Token leftBrace,
|
||||
) {
|
||||
assert(optional('enum', enumKeyword));
|
||||
assert(optional('{', leftBrace));
|
||||
assert(optional('{', leftBrace) || optional(';', leftBrace));
|
||||
debugEvent("EnumHeader");
|
||||
|
||||
var implementsClause =
|
||||
@@ -4202,7 +4215,7 @@ class AstBuilder extends StackListener {
|
||||
implementsClause: implementsClause,
|
||||
leftBracket: leftBrace,
|
||||
semicolon: null,
|
||||
rightBracket: leftBrace.endGroup!,
|
||||
rightBracket: leftBrace.endGroup ?? leftBrace,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4457,7 +4470,9 @@ class AstBuilder extends StackListener {
|
||||
assert(token.isKeywordOrIdentifier);
|
||||
debugEvent("handleIdentifier");
|
||||
|
||||
if (context.inSymbol) {
|
||||
if (context.inSymbol ||
|
||||
context == IdentifierContext.dottedName ||
|
||||
context == IdentifierContext.dottedNameContinuation) {
|
||||
push(token);
|
||||
return;
|
||||
}
|
||||
@@ -4465,9 +4480,9 @@ class AstBuilder extends StackListener {
|
||||
var identifier = SimpleIdentifierImpl(token: token);
|
||||
if (context.inLibraryOrPartOfDeclaration) {
|
||||
if (!context.isContinuation) {
|
||||
push([identifier]);
|
||||
push([token]);
|
||||
} else {
|
||||
push(identifier);
|
||||
push(token);
|
||||
}
|
||||
} else if (context == IdentifierContext.enumValueDeclaration) {
|
||||
var metadata = pop() as List<AnnotationImpl>?;
|
||||
@@ -5041,6 +5056,24 @@ class AstBuilder extends StackListener {
|
||||
push(NullValues.ConstructorReferenceContinuationAfterTypeArguments);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoEnumBody(Token semicolonToken) {
|
||||
debugEvent("NoEnumBody");
|
||||
var builder = _classLikeBuilder;
|
||||
if (builder != null) {
|
||||
builder.emptyClassBodySemicolon = semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoExtensionBody(Token semicolonToken) {
|
||||
debugEvent("NoExtensionBody");
|
||||
var builder = _classLikeBuilder;
|
||||
if (builder != null) {
|
||||
builder.emptyClassBodySemicolon = semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoExtensionTypeBody(Token semicolonToken) {
|
||||
debugEvent("NoExtensionTypeBody");
|
||||
@@ -5081,6 +5114,15 @@ class AstBuilder extends StackListener {
|
||||
push(NullValues.ConstructorInitializers);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNoMixinBody(Token semicolonToken) {
|
||||
debugEvent("NoMixinBody");
|
||||
var builder = _classLikeBuilder;
|
||||
if (builder != null) {
|
||||
builder.emptyClassBodySemicolon = semicolonToken;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void handleNonNullAssertExpression(Token bang) {
|
||||
debugEvent('NonNullAssertExpression');
|
||||
@@ -5309,10 +5351,11 @@ class AstBuilder extends StackListener {
|
||||
void handleQualified(Token period) {
|
||||
assert(optional('.', period));
|
||||
|
||||
var identifier = pop() as SimpleIdentifierImpl;
|
||||
var identifier = pop();
|
||||
var prefix = pop();
|
||||
if (prefix is List) {
|
||||
// We're just accumulating components into a list.
|
||||
prefix.add(period);
|
||||
prefix.add(identifier);
|
||||
push(prefix);
|
||||
} else if (prefix is SimpleIdentifierImpl) {
|
||||
@@ -5322,7 +5365,7 @@ class AstBuilder extends StackListener {
|
||||
PrefixedIdentifierImpl(
|
||||
prefix: prefix,
|
||||
period: period,
|
||||
identifier: identifier,
|
||||
identifier: identifier as SimpleIdentifierImpl,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@@ -6020,8 +6063,6 @@ class AstBuilder extends StackListener {
|
||||
typeNameIdentifier = preliminaryName.prefix;
|
||||
period = preliminaryName.period;
|
||||
constructorNameToken = preliminaryName.identifier.token;
|
||||
default:
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
var constructor = ConstructorDeclarationImpl(
|
||||
@@ -6555,13 +6596,18 @@ class _EnumDeclarationBuilder extends _ClassLikeDeclarationBuilder {
|
||||
});
|
||||
|
||||
EnumDeclarationImpl build() {
|
||||
var body = EnumBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
constants: constants,
|
||||
semicolon: semicolon,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
EnumBodyImpl body;
|
||||
if (emptyClassBodySemicolon case var semicolon?) {
|
||||
body = EmptyEnumBodyImpl(semicolon: semicolon);
|
||||
} else {
|
||||
body = BlockEnumBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
constants: constants,
|
||||
semicolon: semicolon,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
}
|
||||
|
||||
return EnumDeclarationImpl(
|
||||
comment: comment,
|
||||
@@ -6600,11 +6646,16 @@ class _ExtensionDeclarationBuilder extends _ClassLikeDeclarationBuilder {
|
||||
required Token? typeKeyword,
|
||||
required ExtensionOnClauseImpl? onClause,
|
||||
}) {
|
||||
var body = BlockClassBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
ClassBodyImpl body;
|
||||
if (emptyClassBodySemicolon case var semicolon?) {
|
||||
body = EmptyClassBodyImpl(semicolon: semicolon);
|
||||
} else {
|
||||
body = BlockClassBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
}
|
||||
|
||||
return ExtensionDeclarationImpl(
|
||||
comment: comment,
|
||||
@@ -6699,11 +6750,16 @@ class _MixinDeclarationBuilder extends _ClassLikeDeclarationBuilder {
|
||||
});
|
||||
|
||||
MixinDeclarationImpl build() {
|
||||
var body = BlockClassBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
ClassBodyImpl body;
|
||||
if (emptyClassBodySemicolon case var semicolon?) {
|
||||
body = EmptyClassBodyImpl(semicolon: semicolon);
|
||||
} else {
|
||||
body = BlockClassBodyImpl(
|
||||
leftBracket: leftBracket,
|
||||
members: members,
|
||||
rightBracket: rightBracket,
|
||||
);
|
||||
}
|
||||
|
||||
return MixinDeclarationImpl(
|
||||
comment: comment,
|
||||
|
||||
@@ -1412,7 +1412,6 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
||||
|
||||
_enclosingClass = declaredElement;
|
||||
|
||||
List<ClassMember> members = node.body.members;
|
||||
_checkForBuiltInIdentifierAsName(
|
||||
node.name,
|
||||
diag.builtInIdentifierAsTypeName,
|
||||
@@ -1428,7 +1427,10 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
||||
}
|
||||
|
||||
_checkForConflictingClassMembers(declaredFragment);
|
||||
_checkForNotInitializedFieldDeclarations(declaredFragment, members);
|
||||
_checkForNotInitializedFieldDeclarations(
|
||||
declaredFragment,
|
||||
node.body.members,
|
||||
);
|
||||
_checkForMainFunction1(node.name, firstFragment);
|
||||
_checkForWrongTypeParameterVarianceInSuperinterfaces();
|
||||
// _checkForBadFunctionUse(node);
|
||||
|
||||
@@ -2184,6 +2184,11 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeImpl visitBlockFunctionBody(
|
||||
covariant BlockFunctionBodyImpl node, {
|
||||
@@ -2674,6 +2679,9 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
|
||||
inferenceLogWriter?.exitExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitDottedName(DottedName node) {}
|
||||
|
||||
@override
|
||||
void visitDoubleLiteral(
|
||||
DoubleLiteral node, {
|
||||
@@ -2689,6 +2697,9 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
|
||||
@override
|
||||
void visitEmptyClassBody(EmptyClassBody node) {}
|
||||
|
||||
@override
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {}
|
||||
|
||||
@override
|
||||
TypeImpl visitEmptyFunctionBody(
|
||||
EmptyFunctionBody node, {
|
||||
@@ -2705,11 +2716,6 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
checkUnreachableNode(node);
|
||||
@@ -3439,12 +3445,6 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
|
||||
elementResolver.visitLibraryDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(
|
||||
LibraryIdentifier node, {
|
||||
TypeImpl contextType = UnknownInferredType.instance,
|
||||
}) {}
|
||||
|
||||
@override
|
||||
void visitListLiteral(
|
||||
covariant ListLiteralImpl node, {
|
||||
|
||||
@@ -115,6 +115,12 @@ class AnalysisRuleVisitor implements AstVisitor<void> {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
_runSubscriptions(node, _registry._forBlockEnumBody);
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockFunctionBody(BlockFunctionBody node) {
|
||||
_runSubscriptions(node, _registry._forBlockFunctionBody);
|
||||
@@ -309,6 +315,12 @@ class AnalysisRuleVisitor implements AstVisitor<void> {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {
|
||||
_runSubscriptions(node, _registry._forEmptyEnumBody);
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEmptyFunctionBody(EmptyFunctionBody node) {
|
||||
_runSubscriptions(node, _registry._forEmptyFunctionBody);
|
||||
@@ -321,12 +333,6 @@ class AnalysisRuleVisitor implements AstVisitor<void> {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
_runSubscriptions(node, _registry._forEnumBody);
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitEnumConstantArguments(EnumConstantArguments node) {
|
||||
_runSubscriptions(node, _registry._forEnumConstantArguments);
|
||||
@@ -615,12 +621,6 @@ class AnalysisRuleVisitor implements AstVisitor<void> {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitLibraryIdentifier(LibraryIdentifier node) {
|
||||
_runSubscriptions(node, _registry._forLibraryIdentifier);
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitListLiteral(ListLiteral node) {
|
||||
_runSubscriptions(node, _registry._forListLiteral);
|
||||
@@ -1215,6 +1215,8 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
|
||||
final List<_Subscription<BlockClassBody>> _forBlockClassBody = [];
|
||||
|
||||
final List<_Subscription<BlockEnumBody>> _forBlockEnumBody = [];
|
||||
|
||||
final List<_Subscription<BlockFunctionBody>> _forBlockFunctionBody = [];
|
||||
|
||||
final List<_Subscription<Block>> _forBlock = [];
|
||||
@@ -1289,12 +1291,12 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
|
||||
final List<_Subscription<EmptyClassBody>> _forEmptyClassBody = [];
|
||||
|
||||
final List<_Subscription<EmptyEnumBody>> _forEmptyEnumBody = [];
|
||||
|
||||
final List<_Subscription<EmptyFunctionBody>> _forEmptyFunctionBody = [];
|
||||
|
||||
final List<_Subscription<EmptyStatement>> _forEmptyStatement = [];
|
||||
|
||||
final List<_Subscription<EnumBody>> _forEnumBody = [];
|
||||
|
||||
final List<_Subscription<EnumConstantArguments>> _forEnumConstantArguments =
|
||||
[];
|
||||
|
||||
@@ -1407,8 +1409,6 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
|
||||
final List<_Subscription<LibraryDirective>> _forLibraryDirective = [];
|
||||
|
||||
final List<_Subscription<LibraryIdentifier>> _forLibraryIdentifier = [];
|
||||
|
||||
final List<_Subscription<ListLiteral>> _forListLiteral = [];
|
||||
|
||||
final List<_Subscription<ListPattern>> _forListPattern = [];
|
||||
@@ -1682,6 +1682,11 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
_forBlockClassBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addBlockEnumBody(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forBlockEnumBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addBlockFunctionBody(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forBlockFunctionBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
@@ -1879,6 +1884,11 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
_forEmptyClassBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addEmptyEnumBody(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forEmptyEnumBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addEmptyFunctionBody(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forEmptyFunctionBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
@@ -1889,11 +1899,6 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
_forEmptyStatement.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addEnumBody(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forEnumBody.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addEnumConstantArguments(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forEnumConstantArguments.add(
|
||||
@@ -2205,11 +2210,6 @@ class RuleVisitorRegistryImpl implements RuleVisitorRegistry {
|
||||
_forLibraryDirective.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addLibraryIdentifier(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forLibraryIdentifier.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
}
|
||||
|
||||
@override
|
||||
void addListLiteral(AbstractAnalysisRule rule, AstVisitor visitor) {
|
||||
_forListLiteral.add(_Subscription(rule, visitor, _getTimer(rule)));
|
||||
|
||||
@@ -324,8 +324,14 @@ class AstBinaryReader {
|
||||
}
|
||||
|
||||
DottedName _readDottedName() {
|
||||
var components = _readNodeList<SimpleIdentifierImpl>();
|
||||
return DottedNameImpl(components: components);
|
||||
var count = _readUint32();
|
||||
var tokens = <Token>[];
|
||||
for (var i = 0; i < count; i++) {
|
||||
var lexeme = _readStringReference();
|
||||
var type = lexeme == '.' ? TokenType.PERIOD : TokenType.IDENTIFIER;
|
||||
tokens.add(TokenFactory.tokenFromTypeAndString(type, lexeme));
|
||||
}
|
||||
return DottedNameImpl(tokens: tokens);
|
||||
}
|
||||
|
||||
DoubleLiteral _readDoubleLiteral() {
|
||||
|
||||
@@ -240,7 +240,10 @@ class AstBinaryWriter extends ThrowingAstVisitor<void> {
|
||||
@override
|
||||
void visitDottedName(DottedName node) {
|
||||
_writeByte(Tag.DottedName);
|
||||
_writeNodeList(node.components);
|
||||
_writeUint32(node.tokens.length);
|
||||
for (var i = 0; i < node.tokens.length; i++) {
|
||||
_writeStringReference(node.tokens[i].lexeme);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1171,11 +1171,9 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
|
||||
var holder = _EnclosingContext(fragment: fragment);
|
||||
_withEnclosing(holder, () {
|
||||
// Build fields for all enum constants.
|
||||
var constants = node.body.constants;
|
||||
var valuesElements = <SimpleIdentifierImpl>[];
|
||||
var valuesNames = <String>{};
|
||||
for (var i = 0; i < constants.length; ++i) {
|
||||
var constant = constants[i];
|
||||
for (var constant in node.body.constants) {
|
||||
var nameToken = constant.name;
|
||||
var name = nameToken.lexeme;
|
||||
var field = FieldFragmentImpl(name: _getFragmentName(nameToken))
|
||||
@@ -1208,13 +1206,13 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
|
||||
)
|
||||
: null,
|
||||
),
|
||||
argumentList: constantArguments != null
|
||||
? constantArguments.argumentList
|
||||
: ArgumentListImpl(
|
||||
leftParenthesis: Tokens.openParenthesis(),
|
||||
arguments: [],
|
||||
rightParenthesis: Tokens.closeParenthesis(),
|
||||
),
|
||||
argumentList:
|
||||
constantArguments?.argumentList ??
|
||||
ArgumentListImpl(
|
||||
leftParenthesis: Tokens.openParenthesis(),
|
||||
arguments: [],
|
||||
rightParenthesis: Tokens.closeParenthesis(),
|
||||
),
|
||||
typeArguments: null,
|
||||
);
|
||||
|
||||
@@ -1310,7 +1308,9 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
|
||||
);
|
||||
|
||||
node.namePart.accept(this);
|
||||
node.body.members.accept(this);
|
||||
for (var member in node.body.members) {
|
||||
member.accept(this);
|
||||
}
|
||||
});
|
||||
|
||||
fragment.typeParameters = holder.typeParameters;
|
||||
@@ -1346,7 +1346,9 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
|
||||
var holder = _EnclosingContext(fragment: fragment);
|
||||
_withEnclosing(holder, () {
|
||||
node.typeParameters?.accept(this);
|
||||
node.body.members.accept(this);
|
||||
for (var member in node.body.members) {
|
||||
member.accept(this);
|
||||
}
|
||||
});
|
||||
fragment.typeParameters = holder.typeParameters;
|
||||
|
||||
@@ -1751,7 +1753,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
|
||||
var holder = _EnclosingContext(fragment: fragment);
|
||||
_withEnclosing(holder, () {
|
||||
node.typeParameters?.accept(this);
|
||||
node.body.members.accept(this);
|
||||
node.body.accept(this);
|
||||
});
|
||||
fragment.typeParameters = holder.typeParameters;
|
||||
|
||||
|
||||
@@ -582,13 +582,13 @@ class _InfoBuilder {
|
||||
classDeclarations.add(_buildClass(declaration));
|
||||
} else if (declaration is ClassTypeAlias) {
|
||||
classTypeAliases.add(_buildClassTypeAlias(declaration));
|
||||
} else if (declaration is EnumDeclaration) {
|
||||
} else if (declaration is EnumDeclarationImpl) {
|
||||
enums.add(_buildEnum(declaration));
|
||||
} else if (declaration is ExtensionDeclaration) {
|
||||
extensions.add(_buildExtension(declaration));
|
||||
} else if (declaration is ExtensionTypeDeclaration) {
|
||||
extensionTypes.add(_buildExtensionType(declaration));
|
||||
} else if (declaration is MixinDeclaration) {
|
||||
} else if (declaration is MixinDeclarationImpl) {
|
||||
mixinDeclarations.add(_buildMixin(declaration));
|
||||
} else if (declaration is FunctionDeclaration) {
|
||||
if (declaration.isGetter) {
|
||||
@@ -789,7 +789,7 @@ class _InfoBuilder {
|
||||
);
|
||||
}
|
||||
|
||||
_InfoEnumDeclaration _buildEnum(EnumDeclaration node) {
|
||||
_InfoEnumDeclaration _buildEnum(EnumDeclarationImpl node) {
|
||||
return _InfoEnumDeclaration(
|
||||
data: _buildInterfaceData(
|
||||
node,
|
||||
@@ -836,7 +836,7 @@ class _InfoBuilder {
|
||||
node,
|
||||
name: node.name,
|
||||
typeParameters: node.typeParameters,
|
||||
members: node.body.members,
|
||||
members: node.body.tryCast<BlockClassBody>()?.members ?? [],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1066,7 +1066,7 @@ class _InfoBuilder {
|
||||
);
|
||||
}
|
||||
|
||||
_InfoMixinDeclaration _buildMixin(MixinDeclaration node) {
|
||||
_InfoMixinDeclaration _buildMixin(MixinDeclarationImpl node) {
|
||||
return _InfoMixinDeclaration(
|
||||
data: _buildInterfaceData(
|
||||
node,
|
||||
|
||||
@@ -771,7 +771,7 @@ class LibraryBuilder {
|
||||
if (directive is ast.LibraryDirectiveImpl) {
|
||||
var nameIdentifier = directive.name;
|
||||
if (nameIdentifier != null) {
|
||||
name = nameIdentifier.components.map((e) => e.name).join('.');
|
||||
name = nameIdentifier.tokens.map((e) => e.lexeme).join();
|
||||
nameOffset = nameIdentifier.offset;
|
||||
nameLength = nameIdentifier.length;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,12 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||
|
||||
@override
|
||||
void visitBlockClassBody(BlockClassBody node) {
|
||||
node.members.accept(this);
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
node.visitChildren(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -86,6 +91,9 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||
@override
|
||||
void visitEmptyClassBody(EmptyClassBody node) {}
|
||||
|
||||
@override
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {}
|
||||
|
||||
@override
|
||||
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {
|
||||
node.metadata.accept(this);
|
||||
@@ -102,8 +110,7 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||
.tryCast<PrimaryConstructorDeclaration>()
|
||||
?.formalParameters
|
||||
.accept(this);
|
||||
node.body.constants.accept(this);
|
||||
node.body.members.accept(this);
|
||||
node.body.accept(this);
|
||||
} finally {
|
||||
_scope = _containerScope;
|
||||
}
|
||||
@@ -126,7 +133,7 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||
|
||||
_scope = node.bodyScope!;
|
||||
try {
|
||||
node.body.members.accept(this);
|
||||
node.body.accept(this);
|
||||
} finally {
|
||||
_scope = _containerScope;
|
||||
}
|
||||
@@ -230,7 +237,7 @@ class MetadataResolver extends ThrowingAstVisitor<void> {
|
||||
|
||||
_scope = node.bodyScope!;
|
||||
try {
|
||||
node.body.members.accept(this);
|
||||
node.body.accept(this);
|
||||
} finally {
|
||||
_scope = _containerScope;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,12 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
|
||||
node.members.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockEnumBody(BlockEnumBody node) {
|
||||
node.constants.accept(this);
|
||||
node.members.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitBlockFunctionBody(BlockFunctionBody node) {}
|
||||
|
||||
@@ -119,13 +125,10 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
|
||||
void visitEmptyClassBody(EmptyClassBody node) {}
|
||||
|
||||
@override
|
||||
void visitEmptyFunctionBody(EmptyFunctionBody node) {}
|
||||
void visitEmptyEnumBody(EmptyEnumBody node) {}
|
||||
|
||||
@override
|
||||
void visitEnumBody(EnumBody node) {
|
||||
node.constants.accept(this);
|
||||
node.members.accept(this);
|
||||
}
|
||||
void visitEmptyFunctionBody(EmptyFunctionBody node) {}
|
||||
|
||||
@override
|
||||
void visitEnumConstantDeclaration(EnumConstantDeclaration node) {}
|
||||
|
||||
@@ -72,6 +72,8 @@ class FindNode {
|
||||
|
||||
DotShorthandPropertyAccess get singleDotShorthandPropertyAccess => _single();
|
||||
|
||||
DottedName get singleDottedName => _single();
|
||||
|
||||
EnumDeclaration get singleEnumDeclaration => _single();
|
||||
|
||||
ExportDirective get singleExportDirective => _single();
|
||||
@@ -391,6 +393,10 @@ class FindNode {
|
||||
return _node(search, (n) => n is DotShorthandPropertyAccess);
|
||||
}
|
||||
|
||||
DottedName dottedName(String search) {
|
||||
return _node(search, (n) => n is DottedName);
|
||||
}
|
||||
|
||||
DoubleLiteral doubleLiteral(String search) {
|
||||
return _node(search, (n) => n is DoubleLiteral);
|
||||
}
|
||||
@@ -602,10 +608,6 @@ class FindNode {
|
||||
return _node(search, (n) => n is LibraryDirective);
|
||||
}
|
||||
|
||||
LibraryIdentifier libraryIdentifier(String search) {
|
||||
return _node(search, (n) => n is LibraryIdentifier);
|
||||
}
|
||||
|
||||
ListLiteral listLiteral(String search) {
|
||||
return _node(search, (n) => n is ListLiteral);
|
||||
}
|
||||
|
||||
@@ -124,12 +124,13 @@ extension AstNodeNullableExtension on AstNode? {
|
||||
var self = this;
|
||||
return switch (self) {
|
||||
BlockClassBody() => self.members,
|
||||
BlockEnumBody() => self.members,
|
||||
ClassDeclarationImpl() => self.body.members,
|
||||
EnumBody() => self.members,
|
||||
EnumDeclaration() => self.body.members,
|
||||
ExtensionDeclaration() => self.body.members,
|
||||
EnumDeclaration() => self.body.tryCast<BlockEnumBody>()?.members ?? [],
|
||||
ExtensionDeclaration() =>
|
||||
self.body.tryCast<BlockClassBody>()?.members ?? [],
|
||||
ExtensionTypeDeclarationImpl() => self.body.members,
|
||||
MixinDeclaration() => self.body.members,
|
||||
MixinDeclaration() => self.body.tryCast<BlockClassBody>()?.members ?? [],
|
||||
_ => throw UnimplementedError('(${self.runtimeType}) $self'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: analyzer
|
||||
version: 11.1.0-dev
|
||||
version: 12.0.0-dev
|
||||
description: >-
|
||||
This package provides a library that performs static analysis of Dart code.
|
||||
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
|
||||
|
||||
@@ -2,7 +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:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/diagnostic/diagnostic.dart' as diag;
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
@@ -2370,16 +2370,6 @@ a;
|
||||
parseResult.assertErrors([error(diag.missingConstFinalVarOrType, 0, 1)]);
|
||||
}
|
||||
|
||||
void test_missingEnumBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E;
|
||||
''');
|
||||
parseResult.assertErrors([
|
||||
error(diag.missingEnumBody, 6, 1),
|
||||
error(diag.unexpectedToken, 6, 1),
|
||||
]);
|
||||
}
|
||||
|
||||
void test_missingEnumComma() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {one two}
|
||||
|
||||
@@ -1195,11 +1195,10 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'c.dart'
|
||||
@@ -1218,9 +1217,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
tokens
|
||||
a
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'b.dart'
|
||||
@@ -1239,11 +1237,10 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
equalToken: ==
|
||||
value: SimpleStringLiteral
|
||||
literal: 'c'
|
||||
@@ -1265,9 +1262,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
tokens
|
||||
a
|
||||
equalToken: ==
|
||||
value: SimpleStringLiteral
|
||||
literal: 'b'
|
||||
@@ -1989,10 +1985,9 @@ library $name;
|
||||
assertParsedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: $name
|
||||
name: DottedName
|
||||
tokens
|
||||
$name
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2035,10 +2030,9 @@ library $name;
|
||||
assertParsedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: $name
|
||||
name: DottedName
|
||||
tokens
|
||||
$name
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2052,10 +2046,9 @@ library $name;
|
||||
assertParsedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: $name
|
||||
name: DottedName
|
||||
tokens
|
||||
$name
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2069,10 +2062,9 @@ library $name;
|
||||
assertParsedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: $name
|
||||
name: DottedName
|
||||
tokens
|
||||
$name
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -1076,10 +1076,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
PartDirective
|
||||
partKeyword: part
|
||||
@@ -1100,10 +1099,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2457,10 +2455,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2476,10 +2473,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
name: DottedName
|
||||
tokens
|
||||
a
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2495,12 +2491,11 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
name: DottedName
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2516,14 +2511,13 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
SimpleIdentifier
|
||||
token: c
|
||||
name: DottedName
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
.
|
||||
c
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2545,10 +2539,9 @@ CompilationUnit
|
||||
name: SimpleIdentifier
|
||||
token: A
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2570,10 +2563,9 @@ CompilationUnit
|
||||
name: SimpleIdentifier
|
||||
token: A
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2608,10 +2600,9 @@ CompilationUnit
|
||||
tokens
|
||||
/// Doc
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2645,10 +2636,9 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
a
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2665,12 +2655,11 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2687,14 +2676,13 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
SimpleIdentifier
|
||||
token: c
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
.
|
||||
c
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2715,10 +2703,9 @@ CompilationUnit
|
||||
/// Doc
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
a
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2756,10 +2743,9 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2784,10 +2770,9 @@ CompilationUnit
|
||||
name: SimpleIdentifier
|
||||
token: A
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
ImportDirective
|
||||
metadata
|
||||
@@ -2819,10 +2804,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
declarations
|
||||
ClassDeclaration
|
||||
@@ -2857,10 +2841,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
PartDirective
|
||||
partKeyword: part
|
||||
@@ -2891,10 +2874,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
PartDirective
|
||||
partKeyword: part
|
||||
@@ -2928,10 +2910,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -2968,7 +2949,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2990,7 +2971,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3012,7 +2993,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3040,7 +3021,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3065,7 +3046,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3094,7 +3075,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3129,9 +3110,8 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
tokens
|
||||
a
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'b.dart'
|
||||
@@ -3140,9 +3120,8 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: c
|
||||
tokens
|
||||
c
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'd.dart'
|
||||
@@ -3169,11 +3148,10 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
equalToken: ==
|
||||
value: SimpleStringLiteral
|
||||
literal: 'c.dart'
|
||||
@@ -4041,9 +4019,8 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
tokens
|
||||
a
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'b.dart'
|
||||
@@ -4052,9 +4029,8 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: c
|
||||
tokens
|
||||
c
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'd.dart'
|
||||
@@ -4081,11 +4057,10 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: a
|
||||
SimpleIdentifier
|
||||
token: b
|
||||
tokens
|
||||
a
|
||||
.
|
||||
b
|
||||
equalToken: ==
|
||||
value: SimpleStringLiteral
|
||||
literal: 'c.dart'
|
||||
@@ -4278,10 +4253,9 @@ CompilationUnit
|
||||
directives
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -4607,10 +4581,9 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// 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:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/source/line_info.dart';
|
||||
import 'package:analyzer/source/source_range.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/dart/ast/utilities.dart';
|
||||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:analyzer/src/test_utilities/find_node.dart';
|
||||
@@ -1123,18 +1123,6 @@ library foo;
|
||||
);
|
||||
}
|
||||
|
||||
void test_libraryIdentifier() {
|
||||
var findNode = _parseStringToFindNode(r'''
|
||||
library foo.bar;
|
||||
''');
|
||||
var node = findNode.libraryIdentifier('foo');
|
||||
_assertReplaceInList(
|
||||
destination: node,
|
||||
child: node.components[0],
|
||||
replacement: node.components[1],
|
||||
);
|
||||
}
|
||||
|
||||
void test_listLiteral() {
|
||||
var findNode = _parseStringToFindNode(r'''
|
||||
void f() {
|
||||
|
||||
@@ -38,6 +38,14 @@ class B {
|
||||
);
|
||||
}
|
||||
|
||||
test_classMemberNames_enum_empty() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
enum E;
|
||||
''');
|
||||
expect(names.topLevelNames, unorderedEquals(['E']));
|
||||
expect(names.classMemberNames, isEmpty);
|
||||
}
|
||||
|
||||
test_classMemberNames_extension() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
extension E on int {
|
||||
@@ -51,6 +59,14 @@ extension E on int {
|
||||
expect(names.classMemberNames, unorderedEquals(['a', 'b', 'c', 'd']));
|
||||
}
|
||||
|
||||
test_classMemberNames_extension_empty() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
extension E on int;
|
||||
''');
|
||||
expect(names.topLevelNames, unorderedEquals(['E']));
|
||||
expect(names.classMemberNames, isEmpty);
|
||||
}
|
||||
|
||||
test_classMemberNames_extensionType() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
extension type A.named(int it) {
|
||||
@@ -91,6 +107,14 @@ mixin B {
|
||||
);
|
||||
}
|
||||
|
||||
test_classMemberNames_mixin_empty() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
mixin M;
|
||||
''');
|
||||
expect(names.topLevelNames, unorderedEquals(['M']));
|
||||
expect(names.classMemberNames, isEmpty);
|
||||
}
|
||||
|
||||
test_topLevelNames() {
|
||||
DefinedNames names = _computeDefinedNames('''
|
||||
class A {}
|
||||
|
||||
@@ -59,6 +59,13 @@ class IndexTest extends PubPackageResolutionTest with _IndexMixin {
|
||||
expect(actual, expected);
|
||||
}
|
||||
|
||||
test_ClassElement_emptyBody() async {
|
||||
await _indexTestUnit(r'''
|
||||
class C;
|
||||
''');
|
||||
assertErrorsInResult([]);
|
||||
}
|
||||
|
||||
test_ClassElement_hierarchy_class_extends() async {
|
||||
await _indexTestUnit(r'''
|
||||
import 'test.dart' as p;
|
||||
@@ -1438,6 +1445,13 @@ dynamic f() {}
|
||||
expect(index.usedElementOffsets, isEmpty);
|
||||
}
|
||||
|
||||
test_EnumElement_emptyBody() async {
|
||||
await _indexTestUnit(r'''
|
||||
enum E;
|
||||
''');
|
||||
assertErrorsInResult([error(diag.enumWithoutConstants, 5, 1)]);
|
||||
}
|
||||
|
||||
test_EnumElement_reference_annotation() async {
|
||||
await _indexTestUnit(r'''
|
||||
import 'test.dart' as p;
|
||||
@@ -1568,6 +1582,13 @@ Prefixes: (unprefixed),p
|
||||
''');
|
||||
}
|
||||
|
||||
test_ExtensionElement_emptyBody() async {
|
||||
await _indexTestUnit(r'''
|
||||
extension E on int;
|
||||
''');
|
||||
assertErrorsInResult([]);
|
||||
}
|
||||
|
||||
test_ExtensionElement_reference_memberAccess() async {
|
||||
await _indexTestUnit(r'''
|
||||
import 'test.dart' as p;
|
||||
@@ -3793,6 +3814,13 @@ void useOperator(M m) {
|
||||
''');
|
||||
}
|
||||
|
||||
test_MixinElement_emptyBody() async {
|
||||
await _indexTestUnit(r'''
|
||||
mixin M;
|
||||
''');
|
||||
assertErrorsInResult([]);
|
||||
}
|
||||
|
||||
test_MixinElement_hierarchy_class_implements() async {
|
||||
await _indexTestUnit(r'''
|
||||
mixin A {}
|
||||
@@ -4924,7 +4952,7 @@ class _NameIndexAssert {
|
||||
test._assertUsedName(
|
||||
name,
|
||||
kind,
|
||||
test._expectedLocation(search, false),
|
||||
test._expectedLocation(search, false, length: name.length),
|
||||
true,
|
||||
);
|
||||
}
|
||||
@@ -4933,7 +4961,7 @@ class _NameIndexAssert {
|
||||
test._assertUsedName(
|
||||
name,
|
||||
kind,
|
||||
test._expectedLocation(search, true),
|
||||
test._expectedLocation(search, true, length: name.length),
|
||||
true,
|
||||
);
|
||||
}
|
||||
@@ -4942,7 +4970,7 @@ class _NameIndexAssert {
|
||||
test._assertUsedName(
|
||||
name,
|
||||
kind,
|
||||
test._expectedLocation(search, false),
|
||||
test._expectedLocation(search, false, length: name.length),
|
||||
false,
|
||||
);
|
||||
}
|
||||
@@ -4951,7 +4979,7 @@ class _NameIndexAssert {
|
||||
test._assertUsedName(
|
||||
name,
|
||||
kind,
|
||||
test._expectedLocation(search, true),
|
||||
test._expectedLocation(search, true, length: name.length),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -280,6 +280,17 @@ class C {}
|
||||
);
|
||||
}
|
||||
|
||||
test_class_emptyBody() {
|
||||
_assertSameSignature(
|
||||
r'''
|
||||
class C;
|
||||
''',
|
||||
r'''
|
||||
class C;
|
||||
''',
|
||||
);
|
||||
}
|
||||
|
||||
test_class_extends() {
|
||||
_assertNotSameSignature(
|
||||
r'''
|
||||
@@ -969,6 +980,17 @@ class A {}
|
||||
);
|
||||
}
|
||||
|
||||
test_enum_emptyBody() {
|
||||
_assertSameSignature(
|
||||
r'''
|
||||
enum E;
|
||||
''',
|
||||
r'''
|
||||
enum E;
|
||||
''',
|
||||
);
|
||||
}
|
||||
|
||||
test_enum_enumConstants_add() {
|
||||
_assertNotSameSignature(
|
||||
r'''
|
||||
@@ -1569,6 +1591,17 @@ void foo<U>() {}
|
||||
);
|
||||
}
|
||||
|
||||
test_extension_emptyBody() {
|
||||
_assertSameSignature(
|
||||
r'''
|
||||
extension E on int;
|
||||
''',
|
||||
r'''
|
||||
extension E on int;
|
||||
''',
|
||||
);
|
||||
}
|
||||
|
||||
test_extension_on() {
|
||||
_assertNotSameSignature(
|
||||
r'''
|
||||
@@ -1663,6 +1696,17 @@ Future<List<int>> bar(int x) {}
|
||||
);
|
||||
}
|
||||
|
||||
test_mixin_emptyBody() {
|
||||
_assertSameSignature(
|
||||
r'''
|
||||
mixin M;
|
||||
''',
|
||||
r'''
|
||||
mixin M;
|
||||
''',
|
||||
);
|
||||
}
|
||||
|
||||
test_mixin_field_withoutType() {
|
||||
_assertNotSameSignature(
|
||||
r'''
|
||||
@@ -2043,8 +2087,8 @@ typedef F = void Function(double);
|
||||
_assertSignature(oldCode, newCode, same: true);
|
||||
}
|
||||
|
||||
void _assertSameSignature_classLike(String oldCode, String newCode) {
|
||||
_assertSignature_classLike(oldCode, newCode, same: true);
|
||||
void _assertSameSignature_classLike(String code1, String code2) {
|
||||
_assertSignature_classLike(code1, code2, same: true);
|
||||
}
|
||||
|
||||
void _assertSameSignature_executable(String oldCode, String newCode) {
|
||||
|
||||
@@ -187,6 +187,15 @@ void main() {
|
||||
''');
|
||||
}
|
||||
|
||||
test_locate_DottedName_libraryDirective() async {
|
||||
await resolveTestCode('library foo.bar;');
|
||||
var node = findNode.singleDottedName;
|
||||
var element = ElementLocator.locate(node);
|
||||
_assertElement(element, r'''
|
||||
<testLibrary>
|
||||
''');
|
||||
}
|
||||
|
||||
test_locate_EnumConstantDeclaration() async {
|
||||
await resolveTestCode(r'''
|
||||
enum E {
|
||||
@@ -351,15 +360,6 @@ void f(int a) {
|
||||
''');
|
||||
}
|
||||
|
||||
test_locate_Identifier_libraryDirective() async {
|
||||
await resolveTestCode('library foo.bar;');
|
||||
var node = findNode.simple('foo');
|
||||
var element = ElementLocator.locate(node);
|
||||
_assertElement(element, r'''
|
||||
<testLibrary>
|
||||
''');
|
||||
}
|
||||
|
||||
test_locate_Identifier_propertyAccess() async {
|
||||
await resolveTestCode(r'''
|
||||
void main() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/dart/ast/ast.dart';
|
||||
import 'package:analyzer/src/dart/ast/to_source_visitor.dart';
|
||||
import 'package:analyzer/src/test_utilities/find_node.dart';
|
||||
import 'package:test/test.dart';
|
||||
@@ -68,6 +68,12 @@ class ToSourceVisitorTest extends ParserDiagnosticsTest {
|
||||
_assertSource(code, findNode.classDeclaration(code));
|
||||
}
|
||||
|
||||
test_enum_emptyBody() {
|
||||
var code = 'enum E;';
|
||||
var findNode = _parseStringToFindNode(code);
|
||||
_assertSource(code, findNode.enumDeclaration(code));
|
||||
}
|
||||
|
||||
test_enum_primaryConstructor_named() {
|
||||
var code = 'enum const E<T>.named(final int a) {}';
|
||||
var findNode = _parseStringToFindNode(code);
|
||||
@@ -80,6 +86,12 @@ class ToSourceVisitorTest extends ParserDiagnosticsTest {
|
||||
_assertSource(code, findNode.enumDeclaration(code));
|
||||
}
|
||||
|
||||
test_extension_emptyBody() {
|
||||
var code = 'extension E on C;';
|
||||
var findNode = _parseStringToFindNode(code);
|
||||
_assertSource(code, findNode.extensionDeclaration(code));
|
||||
}
|
||||
|
||||
test_extensionType_emptyBody() {
|
||||
var code = 'extension type A(int it);';
|
||||
var findNode = _parseStringToFindNode(code);
|
||||
@@ -98,6 +110,12 @@ class ToSourceVisitorTest extends ParserDiagnosticsTest {
|
||||
_assertSource(code, findNode.extensionTypeDeclaration(code));
|
||||
}
|
||||
|
||||
test_mixin_emptyBody() {
|
||||
var code = 'mixin M;';
|
||||
var findNode = _parseStringToFindNode(code);
|
||||
_assertSource(code, findNode.mixinDeclaration(code));
|
||||
}
|
||||
|
||||
void test_visitAdjacentStrings() {
|
||||
var findNode = _parseStringToFindNode(r'''
|
||||
var v = 'a' 'b';
|
||||
@@ -1080,6 +1098,22 @@ void f () {
|
||||
_assertSource(code, findNode.doStatement(code));
|
||||
}
|
||||
|
||||
void test_visitDottedName_multiple() {
|
||||
var code = 'a.b.c';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
library $code;
|
||||
''');
|
||||
_assertSource(code, findNode.singleDottedName);
|
||||
}
|
||||
|
||||
void test_visitDottedName_single() {
|
||||
var code = 'my';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
library $code;
|
||||
''');
|
||||
_assertSource(code, findNode.singleDottedName);
|
||||
}
|
||||
|
||||
void test_visitDoubleLiteral() {
|
||||
var code = '3.14';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
@@ -2342,22 +2376,6 @@ $code
|
||||
_assertSource(code, findNode.library(code));
|
||||
}
|
||||
|
||||
void test_visitLibraryIdentifier_multiple() {
|
||||
var code = 'a.b.c';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
library $code;
|
||||
''');
|
||||
_assertSource(code, findNode.libraryIdentifier(code));
|
||||
}
|
||||
|
||||
void test_visitLibraryIdentifier_single() {
|
||||
var code = 'my';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
library $code;
|
||||
''');
|
||||
_assertSource(code, findNode.libraryIdentifier(code));
|
||||
}
|
||||
|
||||
void test_visitListLiteral_complex() {
|
||||
var code = '<int>[0, for (e in []) 0, if (b) 1, ...[0]]';
|
||||
var findNode = _parseStringToFindNode('''
|
||||
|
||||
@@ -30,7 +30,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -54,7 +54,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -79,7 +79,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -112,7 +112,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
semicolon: ;
|
||||
members
|
||||
@@ -131,6 +131,24 @@ EnumDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_empty() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {}
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
var node = parseResult.findNode.singleEnumDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
}
|
||||
|
||||
test_constructor_factoryHead_named() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {
|
||||
@@ -417,24 +435,6 @@ ConstructorDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_declaration_empty() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {}
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
var node = parseResult.findNode.singleEnumDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
}
|
||||
|
||||
test_declaration_noConstants_semicolon() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E {;}
|
||||
@@ -447,7 +447,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
semicolon: ;
|
||||
rightBracket: }
|
||||
@@ -468,7 +468,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
semicolon: ;
|
||||
members
|
||||
@@ -487,6 +487,43 @@ EnumDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E;
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
var node = parseResult.findNode.singleEnumDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EmptyEnumBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
// @dart = 3.10
|
||||
enum E;
|
||||
''');
|
||||
parseResult.assertErrors([
|
||||
error(diag.experimentNotEnabledOffByDefault, 22, 1),
|
||||
]);
|
||||
|
||||
var node = parseResult.findNode.singleEnumDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EmptyEnumBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
test_nameWithTypeParameters_hasTypeParameters() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
enum E<T, U> {v}
|
||||
@@ -507,7 +544,7 @@ EnumDeclaration
|
||||
TypeParameter
|
||||
name: U
|
||||
rightBracket: >
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -528,7 +565,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -564,7 +601,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -597,7 +634,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -625,7 +662,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -650,7 +687,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -673,7 +710,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -710,7 +747,7 @@ EnumDeclaration
|
||||
literal: 0
|
||||
rightDelimiter: }
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -753,7 +790,7 @@ EnumDeclaration
|
||||
literal: 0
|
||||
rightDelimiter: }
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -796,7 +833,7 @@ EnumDeclaration
|
||||
name: x
|
||||
rightParenthesis: )
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -826,7 +863,7 @@ EnumDeclaration
|
||||
name: int
|
||||
name: a
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -862,7 +899,7 @@ EnumDeclaration
|
||||
name: int
|
||||
name: a
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -893,7 +930,7 @@ EnumDeclaration
|
||||
name: int
|
||||
name: it
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -932,7 +969,7 @@ EnumDeclaration
|
||||
name: int
|
||||
name: it
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -969,7 +1006,7 @@ EnumDeclaration
|
||||
name: int
|
||||
name: it
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1011,7 +1048,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1043,7 +1080,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1070,7 +1107,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1094,7 +1131,7 @@ EnumDeclaration
|
||||
formalParameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
|
||||
@@ -69,13 +69,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'foo_html.dart'
|
||||
|
||||
@@ -185,6 +185,49 @@ ExtensionDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_declaration_emptyBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
extension E on int;
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
var node = parseResult.findNode.singleExtensionDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
// @dart = 3.10
|
||||
extension E on int;
|
||||
''');
|
||||
parseResult.assertErrors([
|
||||
error(diag.experimentNotEnabledOffByDefault, 34, 1),
|
||||
]);
|
||||
|
||||
var node = parseResult.findNode.singleExtensionDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
test_primaryConstructorBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
extension A on int {
|
||||
|
||||
@@ -69,13 +69,12 @@ ImportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'foo_html.dart'
|
||||
|
||||
@@ -15,7 +15,28 @@ main() {
|
||||
|
||||
@reflectiveTest
|
||||
class MixinDeclarationParserTest extends ParserDiagnosticsTest {
|
||||
test_body_field() {
|
||||
test_blockBody_constructor_named() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin A {
|
||||
A.named();
|
||||
}
|
||||
''');
|
||||
parseResult.assertErrors([error(diag.mixinDeclaresConstructor, 12, 1)]);
|
||||
|
||||
// Mixins cannot have constructors.
|
||||
// So, we don't put them into AST at all.
|
||||
var node = parseResult.findNode.singleMixinDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: A
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_field() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin M {
|
||||
static final int F = 0;
|
||||
@@ -47,7 +68,7 @@ MixinDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_body_getter() {
|
||||
test_blockBody_getter() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin M {
|
||||
int get foo => 0;
|
||||
@@ -76,7 +97,7 @@ MixinDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_body_method() {
|
||||
test_blockBody_method() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin M {
|
||||
void foo() {}
|
||||
@@ -106,7 +127,31 @@ MixinDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_body_setter() {
|
||||
test_blockBody_primaryConstructorBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin A {
|
||||
this;
|
||||
}
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
var node = parseResult.findNode.singleMixinDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: A
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
PrimaryConstructorBody
|
||||
thisKeyword: this
|
||||
body: EmptyFunctionBody
|
||||
semicolon: ;
|
||||
rightBracket: }
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_setter() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin M {
|
||||
set foo(int _) {}
|
||||
@@ -139,32 +184,9 @@ MixinDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_constructor_named() {
|
||||
test_emptyBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin A {
|
||||
A.named();
|
||||
}
|
||||
''');
|
||||
parseResult.assertErrors([error(diag.mixinDeclaresConstructor, 12, 1)]);
|
||||
|
||||
// Mixins cannot have constructors.
|
||||
// So, we don't put them into AST at all.
|
||||
var node = parseResult.findNode.singleMixinDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: A
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
}
|
||||
|
||||
test_primaryConstructorBody() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
mixin A {
|
||||
this;
|
||||
}
|
||||
mixin M;
|
||||
''');
|
||||
parseResult.assertNoErrors();
|
||||
|
||||
@@ -172,15 +194,28 @@ mixin A {
|
||||
assertParsedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: A
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
PrimaryConstructorBody
|
||||
thisKeyword: this
|
||||
body: EmptyFunctionBody
|
||||
semicolon: ;
|
||||
rightBracket: }
|
||||
name: M
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() {
|
||||
var parseResult = parseStringWithErrors(r'''
|
||||
// @dart = 3.10
|
||||
mixin M;
|
||||
''');
|
||||
parseResult.assertErrors([
|
||||
error(diag.experimentNotEnabledOffByDefault, 23, 1),
|
||||
]);
|
||||
|
||||
var node = parseResult.findNode.singleMixinDeclaration;
|
||||
assertParsedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: M
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,11 @@ part of my.library;
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: my
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
my
|
||||
.
|
||||
library
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -48,12 +47,11 @@ part of my.library;
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: my
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
my
|
||||
.
|
||||
library
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -323,6 +323,49 @@ EnumConstantDeclaration
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody() async {
|
||||
await assertErrorsInCode(
|
||||
r'''
|
||||
enum E;
|
||||
''',
|
||||
[error(diag.enumWithoutConstants, 5, 1)],
|
||||
);
|
||||
|
||||
var node = findNode.singleEnumDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EmptyEnumBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> E@5
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() async {
|
||||
var code = r'''
|
||||
// @dart = 3.10
|
||||
enum E;
|
||||
''';
|
||||
|
||||
await assertErrorsInCode(code, [
|
||||
error(diag.enumWithoutConstants, 21, 1),
|
||||
error(diag.experimentNotEnabledOffByDefault, 22, 1),
|
||||
]);
|
||||
|
||||
var node = findNode.singleEnumDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EmptyEnumBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> E@21
|
||||
''');
|
||||
}
|
||||
|
||||
test_field() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
enum E {
|
||||
@@ -592,7 +635,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> T@7
|
||||
defaultType: int
|
||||
rightBracket: >
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -619,7 +662,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: A
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -670,7 +713,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function({int a})
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -734,7 +777,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function({required int a})
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -803,7 +846,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function(int Function(String))
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -853,7 +896,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function(int)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -906,7 +949,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function(int)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1051,7 +1094,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> named@10
|
||||
element: <testLibrary>::@enum::A::@constructor::named
|
||||
type: A<T> Function(T)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1116,7 +1159,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A<T> Function(T)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1170,7 +1213,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> named@7
|
||||
element: <testLibrary>::@enum::A::@constructor::named
|
||||
type: A Function(int)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1223,7 +1266,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function(int)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1419,7 +1462,7 @@ EnumDeclaration
|
||||
declaredFragment: <testLibraryFragment> new@null
|
||||
element: <testLibrary>::@enum::A::@constructor::new
|
||||
type: A Function(bool, bool)
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:analyzer/src/diagnostic/diagnostic.dart' as diag;
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import 'context_collection_resolution.dart';
|
||||
import 'node_text_expectations.dart';
|
||||
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(ExtensionDeclarationResolutionTest);
|
||||
defineReflectiveTests(UpdateNodeTextExpectations);
|
||||
});
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class ExtensionDeclarationResolutionTest extends PubPackageResolutionTest {
|
||||
test_blockBody_empty() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int {}
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_field() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int {
|
||||
static int f = 0;
|
||||
}
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
FieldDeclaration
|
||||
staticKeyword: static
|
||||
fields: VariableDeclarationList
|
||||
type: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
variables
|
||||
VariableDeclaration
|
||||
name: f
|
||||
equals: =
|
||||
initializer: IntegerLiteral
|
||||
literal: 0
|
||||
staticType: int
|
||||
declaredFragment: <testLibraryFragment> f@34
|
||||
semicolon: ;
|
||||
declaredFragment: <null>
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_getter() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int {
|
||||
int get g => 0;
|
||||
}
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
MethodDeclaration
|
||||
returnType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
propertyKeyword: get
|
||||
name: g
|
||||
body: ExpressionFunctionBody
|
||||
functionDefinition: =>
|
||||
expression: IntegerLiteral
|
||||
literal: 0
|
||||
staticType: int
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> g@31
|
||||
element: <testLibrary>::@extension::E::@getter::g
|
||||
type: int Function()
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_method() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int {
|
||||
void m() {}
|
||||
}
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
MethodDeclaration
|
||||
returnType: NamedType
|
||||
name: void
|
||||
element: <null>
|
||||
type: void
|
||||
name: m
|
||||
parameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
rightParenthesis: )
|
||||
body: BlockFunctionBody
|
||||
block: Block
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> m@28
|
||||
element: <testLibrary>::@extension::E::@method::m
|
||||
type: void Function()
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_blockBody_setter() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int {
|
||||
set s(int v) {}
|
||||
}
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: BlockClassBody
|
||||
leftBracket: {
|
||||
members
|
||||
MethodDeclaration
|
||||
propertyKeyword: set
|
||||
name: s
|
||||
parameters: FormalParameterList
|
||||
leftParenthesis: (
|
||||
parameter: SimpleFormalParameter
|
||||
type: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
name: v
|
||||
declaredFragment: <testLibraryFragment> v@33
|
||||
element: isPublic
|
||||
type: int
|
||||
rightParenthesis: )
|
||||
body: BlockFunctionBody
|
||||
block: Block
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> s@27
|
||||
element: <testLibrary>::@extension::E::@setter::s
|
||||
type: void Function(int)
|
||||
rightBracket: }
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
extension E on int;
|
||||
''');
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> E@10
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() async {
|
||||
await assertErrorsInCode(
|
||||
r'''
|
||||
// @dart = 3.10
|
||||
extension E on int;
|
||||
''',
|
||||
[error(diag.experimentNotEnabledOffByDefault, 34, 1)],
|
||||
);
|
||||
|
||||
var node = findNode.singleExtensionDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
ExtensionDeclaration
|
||||
extensionKeyword: extension
|
||||
name: E
|
||||
onClause: ExtensionOnClause
|
||||
onKeyword: on
|
||||
extendedType: NamedType
|
||||
name: int
|
||||
element: dart:core::@class::int
|
||||
type: int
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> E@26
|
||||
''');
|
||||
}
|
||||
}
|
||||
@@ -23,18 +23,11 @@ library foo.bar;
|
||||
assertResolvedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: foo
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: bar
|
||||
element: <null>
|
||||
staticType: null
|
||||
element: <null>
|
||||
staticType: null
|
||||
name: DottedName
|
||||
tokens
|
||||
foo
|
||||
.
|
||||
bar
|
||||
semicolon: ;
|
||||
element: <testLibrary>
|
||||
''');
|
||||
|
||||
@@ -153,19 +153,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -175,19 +168,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
@@ -227,19 +213,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -249,19 +228,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
@@ -301,19 +273,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -323,19 +288,12 @@ ExportDirective
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
|
||||
@@ -165,19 +165,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -187,19 +180,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
@@ -265,19 +251,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -287,19 +266,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
@@ -349,11 +321,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: x
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
x
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: ':net'
|
||||
@@ -377,11 +346,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: x
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
x
|
||||
rightParenthesis: )
|
||||
uri: StringInterpolation
|
||||
elements
|
||||
@@ -415,11 +381,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: x
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
x
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'foo:bar'
|
||||
@@ -443,11 +406,8 @@ Configuration
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: x
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
x
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a.dart'
|
||||
@@ -487,19 +447,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: html
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
html
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_html.dart'
|
||||
@@ -509,19 +462,12 @@ CompilationUnit
|
||||
ifKeyword: if
|
||||
leftParenthesis: (
|
||||
name: DottedName
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: dart
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: library
|
||||
element: <null>
|
||||
staticType: null
|
||||
SimpleIdentifier
|
||||
token: io
|
||||
element: <null>
|
||||
staticType: null
|
||||
tokens
|
||||
dart
|
||||
.
|
||||
library
|
||||
.
|
||||
io
|
||||
rightParenthesis: )
|
||||
uri: SimpleStringLiteral
|
||||
literal: 'a_io.dart'
|
||||
|
||||
@@ -69,6 +69,43 @@ CommentReference
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
mixin M;
|
||||
''');
|
||||
|
||||
var node = findNode.singleMixinDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: M
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> M@6
|
||||
''');
|
||||
}
|
||||
|
||||
test_emptyBody_language310() async {
|
||||
var code = r'''
|
||||
// @dart = 3.10
|
||||
mixin M;
|
||||
''';
|
||||
|
||||
await assertErrorsInCode(code, [
|
||||
error(diag.experimentNotEnabledOffByDefault, 23, 1),
|
||||
]);
|
||||
|
||||
var node = findNode.singleMixinDeclaration;
|
||||
assertResolvedNodeText(node, r'''
|
||||
MixinDeclaration
|
||||
mixinKeyword: mixin
|
||||
name: M
|
||||
body: EmptyClassBody
|
||||
semicolon: ;
|
||||
declaredFragment: <testLibraryFragment> M@22
|
||||
''');
|
||||
}
|
||||
|
||||
test_field() async {
|
||||
await assertNoErrorsInCode(r'''
|
||||
mixin M<T> {
|
||||
|
||||
@@ -33,6 +33,7 @@ import 'dot_shorthand_property_access_test.dart'
|
||||
import 'enum_test.dart' as enum_resolution;
|
||||
import 'extension_method_test.dart' as extension_method;
|
||||
import 'extension_override_test.dart' as extension_override;
|
||||
import 'extension_test.dart' as extension_resolution;
|
||||
import 'extension_type_test.dart' as extension_type;
|
||||
import 'field_formal_parameter_test.dart' as field_formal_parameter;
|
||||
import 'field_promotion_test.dart' as field_promotion;
|
||||
@@ -149,6 +150,7 @@ main() {
|
||||
enum_resolution.main();
|
||||
extension_method.main();
|
||||
extension_override.main();
|
||||
extension_resolution.main();
|
||||
extension_type.main();
|
||||
field_formal_parameter.main();
|
||||
field_promotion.main();
|
||||
|
||||
@@ -129,8 +129,7 @@ ClassDeclaration
|
||||
expression: SimpleIdentifier
|
||||
token: String @5
|
||||
tokens
|
||||
/** [String] */
|
||||
offset: 0
|
||||
/** [String] */ @0
|
||||
abstractKeyword: abstract @16
|
||||
classKeyword: class @25
|
||||
namePart: NameWithTypeParameters
|
||||
@@ -165,10 +164,8 @@ ClassDeclaration
|
||||
expression: SimpleIdentifier
|
||||
token: Object @36
|
||||
tokens
|
||||
/// See [int] and [String]
|
||||
offset: 0
|
||||
/// and [Object].
|
||||
offset: 27
|
||||
/// See [int] and [String] @0
|
||||
/// and [Object]. @27
|
||||
metadata
|
||||
Annotation
|
||||
atSign: @ @45
|
||||
@@ -217,18 +214,12 @@ ClassDeclaration
|
||||
expression: SimpleIdentifier
|
||||
token: Object @240
|
||||
tokens
|
||||
/// This dartdoc comment is [included].
|
||||
offset: 57
|
||||
/// See [int] and [String] but `not [a]`
|
||||
offset: 134
|
||||
/// ```
|
||||
offset: 175
|
||||
/// This [code] block should be ignored
|
||||
offset: 183
|
||||
/// ```
|
||||
offset: 223
|
||||
/// and [Object].
|
||||
offset: 231
|
||||
/// This dartdoc comment is [included]. @57
|
||||
/// See [int] and [String] but `not [a]` @134
|
||||
/// ``` @175
|
||||
/// This [code] block should be ignored @183
|
||||
/// ``` @223
|
||||
/// and [Object]. @231
|
||||
codeBlocks
|
||||
MdCodeBlock
|
||||
infoString: <empty>
|
||||
@@ -947,7 +938,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1132,7 +1123,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1153,7 +1144,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1174,7 +1165,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1197,7 +1188,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1220,7 +1211,7 @@ EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1290,14 +1281,13 @@ library name.and.dots;
|
||||
assertParsedNodeText(node, r'''
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: name
|
||||
SimpleIdentifier
|
||||
token: and
|
||||
SimpleIdentifier
|
||||
token: dots
|
||||
name: DottedName
|
||||
tokens
|
||||
name
|
||||
.
|
||||
and
|
||||
.
|
||||
dots
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -420,10 +420,9 @@ CompilationUnit
|
||||
PartOfDirective
|
||||
partKeyword: part
|
||||
ofKeyword: of
|
||||
libraryName: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: foo
|
||||
libraryName: DottedName
|
||||
tokens
|
||||
foo
|
||||
semicolon: ;
|
||||
declarations
|
||||
ClassDeclaration
|
||||
@@ -453,10 +452,9 @@ CompilationUnit
|
||||
semicolon: ;
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -478,10 +476,9 @@ CompilationUnit
|
||||
semicolon: ;
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
@@ -503,10 +500,9 @@ CompilationUnit
|
||||
semicolon: ;
|
||||
LibraryDirective
|
||||
libraryKeyword: library
|
||||
name: LibraryIdentifier
|
||||
components
|
||||
SimpleIdentifier
|
||||
token: l
|
||||
name: DottedName
|
||||
tokens
|
||||
l
|
||||
semicolon: ;
|
||||
''');
|
||||
}
|
||||
|
||||
@@ -2163,7 +2163,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
|
||||
@@ -119,7 +119,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -541,7 +541,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -975,7 +975,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1415,7 +1415,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1845,7 +1845,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2268,7 +2268,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2669,7 +2669,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3070,7 +3070,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3513,7 +3513,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3974,7 +3974,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -4435,7 +4435,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -4893,7 +4893,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -5369,7 +5369,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -5890,7 +5890,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -6388,7 +6388,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -6837,7 +6837,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -7250,7 +7250,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -7669,7 +7669,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -8106,7 +8106,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -8521,7 +8521,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -8882,7 +8882,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -9250,7 +9250,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
|
||||
@@ -34,7 +34,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -69,7 +69,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -107,7 +107,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -119,7 +119,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -144,7 +144,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -170,7 +170,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -207,7 +207,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -245,7 +245,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -284,7 +284,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -321,7 +321,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -358,7 +358,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -400,7 +400,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -449,7 +449,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -480,7 +480,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -509,7 +509,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -541,7 +541,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -551,7 +551,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -573,7 +573,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -595,7 +595,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -627,7 +627,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -661,7 +661,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -695,7 +695,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -728,7 +728,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -756,7 +756,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -791,7 +791,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -831,7 +831,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -863,7 +863,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -897,7 +897,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -934,7 +934,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -946,7 +946,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -971,7 +971,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -998,7 +998,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1035,7 +1035,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1074,7 +1074,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1113,7 +1113,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1151,7 +1151,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1184,7 +1184,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1224,7 +1224,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1269,7 +1269,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1300,7 +1300,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1331,7 +1331,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1365,7 +1365,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1377,7 +1377,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1399,7 +1399,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1423,7 +1423,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1457,7 +1457,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1493,7 +1493,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1529,7 +1529,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1564,7 +1564,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1594,7 +1594,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1631,7 +1631,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1673,7 +1673,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1707,7 +1707,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
ClassDeclaration
|
||||
@@ -1739,7 +1739,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: a
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
''');
|
||||
@@ -1761,14 +1761,14 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1793,7 +1793,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
''');
|
||||
@@ -1815,7 +1815,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
TopLevelVariableDeclaration
|
||||
@@ -1844,7 +1844,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: int
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
@@ -1866,7 +1866,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -1897,7 +1897,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: int
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -1928,7 +1928,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
MixinDeclaration
|
||||
@@ -1956,7 +1956,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -1991,7 +1991,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
GenericTypeAlias
|
||||
@@ -2031,7 +2031,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2060,7 +2060,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2092,7 +2092,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2127,7 +2127,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2137,7 +2137,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2159,7 +2159,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: } <synthetic>
|
||||
''');
|
||||
@@ -2181,7 +2181,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2213,7 +2213,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2248,7 +2248,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2282,7 +2282,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2316,7 +2316,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2348,7 +2348,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2387,7 +2387,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2433,7 +2433,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2462,7 +2462,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
ClassDeclaration
|
||||
@@ -2488,7 +2488,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2517,14 +2517,14 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2546,7 +2546,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
''');
|
||||
@@ -2565,7 +2565,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2594,7 +2594,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
FunctionDeclaration
|
||||
@@ -2625,7 +2625,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
FunctionDeclaration
|
||||
@@ -2656,7 +2656,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
FunctionDeclaration
|
||||
@@ -2686,7 +2686,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
MixinDeclaration
|
||||
@@ -2711,7 +2711,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
FunctionDeclaration
|
||||
@@ -2743,7 +2743,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
GenericTypeAlias
|
||||
@@ -2780,7 +2780,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: <empty> <synthetic>
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: }
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2806,7 +2806,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
ClassDeclaration
|
||||
@@ -2832,7 +2832,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2861,14 +2861,14 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
EnumDeclaration
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2890,7 +2890,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
''');
|
||||
@@ -2909,7 +2909,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
TopLevelVariableDeclaration
|
||||
@@ -2938,7 +2938,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -2969,7 +2969,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -3000,7 +3000,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -3030,7 +3030,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
MixinDeclaration
|
||||
@@ -3055,7 +3055,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
FunctionDeclaration
|
||||
@@ -3087,7 +3087,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
GenericTypeAlias
|
||||
@@ -3124,7 +3124,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: { <synthetic>
|
||||
rightBracket: } <synthetic>
|
||||
TopLevelVariableDeclaration
|
||||
@@ -3150,7 +3150,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3179,7 +3179,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3211,7 +3211,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3221,7 +3221,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3243,7 +3243,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3265,7 +3265,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3297,7 +3297,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3331,7 +3331,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3365,7 +3365,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3398,7 +3398,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3426,7 +3426,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3461,7 +3461,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3501,7 +3501,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3533,7 +3533,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3555,7 +3555,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
rightBracket: } <synthetic>
|
||||
''');
|
||||
|
||||
@@ -89,7 +89,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -513,7 +513,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1041,7 +1041,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -1584,7 +1584,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2095,7 +2095,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -2606,7 +2606,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3170,7 +3170,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -3630,7 +3630,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -4158,7 +4158,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -4701,7 +4701,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -5236,7 +5236,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -5809,7 +5809,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
@@ -6278,7 +6278,7 @@ CompilationUnit
|
||||
enumKeyword: enum
|
||||
namePart: NameWithTypeParameters
|
||||
typeName: E
|
||||
body: EnumBody
|
||||
body: BlockEnumBody
|
||||
leftBracket: {
|
||||
constants
|
||||
EnumConstantDeclaration
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user