-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
dart-lang/dart-syntax-highlight
#87Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.
Milestone
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.