Skip to content

Commit b963721

Browse files
scheglovCommit Queue
authored andcommitted
DeCo. Support for primary constructor in enums.
Bug: #61701 Change-Id: I1cccda0cc688087fe8f9b72d185a7a07c5f134ce Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459383 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent 59fe9d7 commit b963721

File tree

3 files changed

+1551
-4
lines changed

3 files changed

+1551
-4
lines changed

pkg/analyzer/lib/src/summary2/element_builder.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
13241324
);
13251325

13261326
if (useDeclaringConstructorsAst) {
1327-
node.namePart.typeParameters?.accept(this);
1327+
node.namePart.accept(this);
13281328
node.body.members.accept(this);
13291329
} else {
13301330
node.typeParameters?.accept(this);
@@ -1828,7 +1828,8 @@ class FragmentBuilder extends ThrowingAstVisitor<void> {
18281828
}
18291829

18301830
var fragment = ConstructorFragmentImpl(name: fragmentName);
1831-
fragment.isConst = node.constKeyword != null;
1831+
fragment.isConst =
1832+
node.constKeyword != null || node.parent is EnumDeclarationImpl;
18321833
fragment.typeName = node.typeName.lexeme;
18331834
_linker.elementNodes[fragment] = node;
18341835

pkg/analyzer/lib/src/summary2/reference_resolver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class ReferenceResolver extends ThrowingAstVisitor<void> {
173173

174174
node.metadata.accept(this);
175175
if (useDeclaringConstructorsAst) {
176-
node.namePart.typeParameters?.accept(this);
176+
node.namePart.accept(this);
177177
} else {
178178
node.typeParameters?.accept(this);
179179
}

0 commit comments

Comments
 (0)