-
Notifications
You must be signed in to change notification settings - Fork 222
Open
Labels
Description
The current syntax in the proposal here does not allow for <metadata>
in any location which is obviously concerned with the primary constructor. For example:
@metadata /* Not on the primary constructor. */
class C(final int x, final int y) extends B {}
// Noisy, not supported in the current grammar.
extension type @metadata const E._(List<X> xs) {}
// This is supported in the proposed grammar, and it's definitely on the primary constructor.
class D(super.x, super.y) extends C {
@metadata
this: assert(x != y);
}
@dart-lang/language-team, WDYT? Should we carve out a way to have metadata on a primary constructor, or are we just going to ask developers to use an in-body constructor or put it on the in-body part of the primary constructor? Presumably it can be quite minimal: @metadata this;
.
RohitSaily, FMorschel and albertms10