Skip to content

Commit 48d4f71

Browse files
stereotype441Commit Queue
authored andcommitted
[messages] Remove GeneratedDiagnosticFile.shouldUseExplicitNewOrConst.
Now that scanner errors are generated to `package:analyzer` rather than `package:_fe_analyzer_shared` (see https://dart-review.googlesource.com/c/sdk/+/455263), there is no `GeneratedDiagnosticFile` for which this value is `true`, so it can safely be hardcoded to `false`. Change-Id: I6a6a6964c6d9f683bb0627719b90076eb041f74c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461142 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
1 parent 95b2e0d commit 48d4f71

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

pkg/analyzer_utilities/lib/analyzer_messages.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,10 @@ mixin MessageWithAnalyzerCode on Message {
588588
var templateParameters =
589589
'<LocatableDiagnostic Function({$withArgumentsParams})>';
590590
staticType = 'DiagnosticWithArguments$templateParameters';
591-
var newIfNeeded = diagnosticClassInfo.file.shouldUseExplicitNewOrConst
592-
? 'new '
593-
: '';
594591
memberAccumulator.staticMethods[withArgumentsName] =
595592
'''
596593
static LocatableDiagnostic $withArgumentsName({$withArgumentsParams}) {
597-
return ${newIfNeeded}LocatableDiagnosticImpl(
594+
return LocatableDiagnosticImpl(
598595
${diagnosticClassInfo.name}.$constantName, [$argumentNames]);
599596
}''';
600597
} else {
@@ -606,9 +603,6 @@ static LocatableDiagnostic $withArgumentsName({$withArgumentsParams}) {
606603
var constant = StringBuffer();
607604
outputConstantHeader(constant);
608605
constant.writeln(' static const $staticType $constantName =');
609-
if (diagnosticClassInfo.file.shouldUseExplicitNewOrConst) {
610-
constant.writeln('const ');
611-
}
612606
constant.writeln('$concreteClassName(');
613607
constant.writeln(
614608
'name: ${sharedNameReference ?? "'${sharedName ?? diagnosticCode}'"},',

pkg/analyzer_utilities/lib/messages.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,11 @@ class GeneratedDiagnosticFile {
516516
/// The URI of the library that the generated file will be a part of.
517517
final String parentLibrary;
518518

519-
/// Whether the generated file should use the `new` and `const` keywords when
520-
/// generating constructor invocations.
521-
final bool shouldUseExplicitNewOrConst;
522-
523519
final bool shouldIgnorePreferSingleQuotes;
524520

525521
const GeneratedDiagnosticFile({
526522
required this.path,
527523
required this.parentLibrary,
528-
this.shouldUseExplicitNewOrConst = false,
529524
this.shouldIgnorePreferSingleQuotes = false,
530525
});
531526
}

0 commit comments

Comments
 (0)