4ee6a66270
The change in [0] increased the language version of pkg/dart2wasm. That in return changes how the package is formatted by the autoformatter. This CL runs now the formatter to re-format the code. Unfortunately this makes blame lists worse. But not doing it will make us have to disable auto-formatting before saving files which is very annoying. [0] https://dart-review.googlesource.com/c/sdk/+/487944 Change-Id: I6953fe0d6a824b2b79a26bbadb0bb977cec70b7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490821 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
42 lines
1.5 KiB
Dart
42 lines
1.5 KiB
Dart
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:kernel/core_types.dart';
|
|
import 'package:kernel/kernel.dart';
|
|
|
|
import 'list_factory_specializer.dart';
|
|
import 'map_factory_specializer.dart';
|
|
import 'set_factory_specializer.dart';
|
|
|
|
typedef SpecializerTransformer = TreeNode Function(StaticInvocation node);
|
|
|
|
abstract class BaseSpecializer {
|
|
// Populated in constructors of subclasses.
|
|
final Map<Member, SpecializerTransformer> transformers = {};
|
|
}
|
|
|
|
class FactorySpecializer extends BaseSpecializer {
|
|
final ListFactorySpecializer _listFactorySpecializer;
|
|
final SetFactorySpecializer _setFactorySpecializer;
|
|
final MapFactorySpecializer _mapFactorySpecializer;
|
|
|
|
FactorySpecializer(CoreTypes coreTypes)
|
|
: _listFactorySpecializer = ListFactorySpecializer(coreTypes),
|
|
_setFactorySpecializer = SetFactorySpecializer(coreTypes),
|
|
_mapFactorySpecializer = MapFactorySpecializer(coreTypes) {
|
|
transformers.addAll(_listFactorySpecializer.transformers);
|
|
transformers.addAll(_setFactorySpecializer.transformers);
|
|
transformers.addAll(_mapFactorySpecializer.transformers);
|
|
}
|
|
|
|
TreeNode transformStaticInvocation(StaticInvocation invocation) {
|
|
final target = invocation.target;
|
|
final transformer = transformers[target];
|
|
if (transformer != null) {
|
|
return transformer(invocation);
|
|
}
|
|
return invocation;
|
|
}
|
|
}
|