We may as well do this at the same time as #5918. Primary Constructors mean that new and factory show up in more places in different contexts. We should try to get the grammar to match the semantic tokens as closely as possible. Currently they are very different.
class NewWithoutType { const new(); const new named(); } class NewWithType { const NewWithType.named(); const NewWithType.new(); } class FactoryWithoutType { FactoryWithoutType._(); factory() => FactoryWithoutType._(); factory named() => FactoryWithoutType._(); void factory() => ''; // Method } class FactoryWithType { FactoryWithType._(); factory() => FactoryWithType._(); factory named() => FactoryWithType._(); void factory() => ''; // Method } class PrimaryWithoutName(final int a) { this {} } class PrimaryWithName.named(final int a) { this {} } void f() { var _ = NewWithType.new(); var _ = NewWithType.named(); var _ = new NewWithType.new(); var _ = new NewWithType.named(); var _ = const NewWithType.new(); var _ = const NewWithType.named(); var _ = NewWithType.new; var _ = NewWithType.named; var _ = FactoryWithType.named().factory(); }
D:\Dev\Test Projects\primary_constructors\lib\colors\semantic_tokens.dart
