| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
final AstNode /* ConstructorDeclaration | PrimaryConstructorDeclaration */Consider moving this into an `assert` in the constructor and possibly documenting it in the field's docs.
enum const _E(final String code) {Do we want to remove the `const` here?
The proposal reads "The proposal allows an `enum` declaration to include the modifier `const` just before the name of the declaration when it has a primary constructor, but it also allows this keyword to be omitted."
I'm guessing that we'll have a lint or dead code warning to encourage people to omit it since it's useless to have it there, so maybe we should just remove it as part of the assist?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
final AstNode /* ConstructorDeclaration | PrimaryConstructorDeclaration */Consider moving this into an `assert` in the constructor and possibly documenting it in the field's docs.
Done
Do we want to remove the `const` here?
The proposal reads "The proposal allows an `enum` declaration to include the modifier `const` just before the name of the declaration when it has a primary constructor, but it also allows this keyword to be omitted."
I'm guessing that we'll have a lint or dead code warning to encourage people to omit it since it's useless to have it there, so maybe we should just remove it as part of the assist?
Sounds good to me. Removing 'const' can be a follow-up CL.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: pkg/analysis_server/lib/src/services/correction/dart/convert_class_to_enum.dart
Insertions: 8, Deletions: 4.
@@ -124,9 +124,9 @@
/// Information about a single constructor (regular or primary) in the class
/// being converted.
class _Constructor {
- /// The declaration of the constructor.
- final AstNode /* ConstructorDeclaration | PrimaryConstructorDeclaration */
- declaration;
+ /// The declaration of the constructor, either a [ConstructorDeclaration] or a
+ /// [PrimaryConstructorDeclaration].
+ final AstNode declaration;
/// The parameter list for this constructor.
final FormalParameterList parameters;
@@ -134,7 +134,11 @@
/// The element representing the constructor.
final ConstructorElement element;
- _Constructor(this.declaration, this.parameters, this.element);
+ _Constructor(this.declaration, this.parameters, this.element)
+ : assert(
+ declaration is ConstructorDeclaration ||
+ declaration is PrimaryConstructorDeclaration,
+ );
}
/// A description of how to convert the class to an enum.
```
DAS: Support many primary constructor use cases in ConvertClassToEnum
Work towards https://github.com/dart-lang/sdk/issues/62274
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |