[front_end] Update CFE code generators to use new constructor decl syntax.

(Part of https://github.com/dart-lang/sdk/issues/63288)

This change makes the code generators in the front_end package emit
code that uses the new constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This avoids the need for `ignore_for_file:` comments and gives us a
bit more testing of the new feature.

Change-Id: Ica5c13018a286cd274dba2cf946304446a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry
2026-06-03 07:27:41 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 7cc5515a6a
commit 189f25b873
10 changed files with 463 additions and 793 deletions
+2 -4
View File
@@ -6,8 +6,6 @@
//
// Run 'dart pkg/front_end/tool/generate_ast_equivalence.dart' to update.
// ignore_for_file: unnecessary_type_name_in_constructor
import 'package:kernel/ast.dart';
import 'package:kernel/src/printer.dart';
import 'union_find.dart';
@@ -25,7 +23,7 @@ part 'equivalence_helpers.dart';
class EquivalenceVisitor implements Visitor1<bool, Node> {
final EquivalenceStrategy strategy;
EquivalenceVisitor({this.strategy = const EquivalenceStrategy()});
new({this.strategy = const EquivalenceStrategy()});
@override
bool visitAuxiliaryConstant(AuxiliaryConstant node, Node other) {
@@ -1574,7 +1572,7 @@ EquivalenceResult checkEquivalence(
/// Custom strategies can be made by extending this strategy and override
/// methods where exceptions to the structural equivalence are needed.
class EquivalenceStrategy {
const EquivalenceStrategy();
const new();
bool checkAuxiliaryConstant(
EquivalenceVisitor visitor,