[dart2js] Remove ImpactTransformer.

Removing the indirection now that there is only one ImpactTransformer.

Change-Id: I20644113d4fce046138df4adc4b1f836d81c2523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232964
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This commit is contained in:
Joshua Litt
2022-02-17 23:11:16 +00:00
committed by Commit Bot
parent 621ea99c80
commit fee5309e61
3 changed files with 12 additions and 29 deletions
@@ -1,22 +0,0 @@
// Copyright (c) 2012, 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.
library dart2js.backend_api;
import '../common/resolution.dart' show ResolutionImpact;
import '../universe/world_impact.dart' show WorldImpact;
/// Target-specific transformation for resolution world impacts.
///
/// This processes target-agnostic [ResolutionImpact]s and creates [WorldImpact]
/// in which backend/target specific impact data is added, for example: if
/// certain feature is used that requires some helper code from the backend
/// libraries, this will be included by the impact transformer.
class ImpactTransformer {
/// Transform the [ResolutionImpact] into a [WorldImpact] adding the
/// backend dependencies for features used in [worldImpact].
WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) {
return worldImpact;
}
}
@@ -8,7 +8,6 @@ import '../universe/class_hierarchy.dart' show ClassHierarchyBuilder;
import '../common.dart';
import '../common/elements.dart';
import '../common/backend_api.dart' show ImpactTransformer;
import '../common/codegen.dart' show CodegenImpact;
import '../common/resolution.dart' show ResolutionImpact;
import '../constants/values.dart';
@@ -34,7 +33,13 @@ import 'native_data.dart';
import 'runtime_types.dart';
import 'runtime_types_resolution.dart';
class JavaScriptImpactTransformer extends ImpactTransformer {
/// JavaScript specific transformation for resolution world impacts.
///
/// This processes target-agnostic [ResolutionImpact]s and creates [WorldImpact]
/// in which JavaScript specific impact data is added, for example: if
/// a certain feature is used that requires some helper code from the backend
/// libraries, this will be included by the impact transformer.
class JavaScriptImpactTransformer {
final ElementEnvironment _elementEnvironment;
final CommonElements _commonElements;
final BackendImpacts _impacts;
@@ -60,7 +65,8 @@ class JavaScriptImpactTransformer extends ImpactTransformer {
DartTypes get _dartTypes => _commonElements.dartTypes;
@override
/// Transform the [ResolutionImpact] into a [WorldImpact] adding the
/// backend dependencies for features used in [worldImpact].
WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) {
TransformedWorldImpact transformed = TransformedWorldImpact(worldImpact);
@@ -7,7 +7,6 @@ library dart2js.kernel.frontend_strategy;
import 'package:kernel/ast.dart' as ir;
import '../common.dart';
import '../common/backend_api.dart';
import '../common/elements.dart';
import '../common/names.dart' show Uris;
import '../common/resolution.dart';
@@ -159,7 +158,7 @@ class KernelFrontendStrategy {
// before creating the resolution enqueuer.
AnnotationsData annotationsData = AnnotationsDataImpl(
compiler.options, annotationsDataBuilder.pragmaAnnotations);
ImpactTransformer impactTransformer = JavaScriptImpactTransformer(
final impactTransformer = JavaScriptImpactTransformer(
elementEnvironment,
commonElements,
impacts,
@@ -303,7 +302,7 @@ class KernelFrontendStrategy {
class KernelWorkItemBuilder implements WorkItemBuilder {
final CompilerTask _compilerTask;
final KernelToElementMapImpl _elementMap;
final ImpactTransformer _impactTransformer;
final JavaScriptImpactTransformer _impactTransformer;
final NativeMemberResolver _nativeMemberResolver;
final AnnotationsDataBuilder _annotationsDataBuilder;
final Map<MemberEntity, ClosureScopeModel> _closureModels;
@@ -347,7 +346,7 @@ class KernelWorkItemBuilder implements WorkItemBuilder {
class KernelWorkItem implements WorkItem {
final CompilerTask _compilerTask;
final KernelToElementMapImpl _elementMap;
final ImpactTransformer _impactTransformer;
final JavaScriptImpactTransformer _impactTransformer;
final NativeMemberResolver _nativeMemberResolver;
final AnnotationsDataBuilder _annotationsDataBuilder;
@override