Remove generics where only ir.Node is used
Change-Id: I500b237a871ee21aca1a800806cdc95828713b5c
Reviewed-on: https://dart-review.googlesource.com/63944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 18cfdc3..3247c80 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -2,6 +2,7 @@
// 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/ast.dart' as ir;
import 'common/tasks.dart' show CompilerTask, Measurer;
import 'common.dart';
import 'elements/entities.dart';
@@ -9,8 +10,8 @@
// TODO(johnniwinther,efortuna): Split [ClosureConversionTask] from
// [ClosureDataLookup].
-abstract class ClosureConversionTask<T> extends CompilerTask
- implements ClosureDataLookup<T> {
+abstract class ClosureConversionTask extends CompilerTask
+ implements ClosureDataLookup {
ClosureConversionTask(Measurer measurer) : super(measurer);
}
@@ -18,16 +19,16 @@
/// to preserve Dart semantics when compiled to JavaScript. Given a particular
/// node to look up, it returns a information about the internal representation
/// of how closure conversion is implemented. T is an ir.Node or Node.
-abstract class ClosureDataLookup<T> {
+abstract class ClosureDataLookup {
/// Look up information about the variables that have been mutated and are
/// used inside the scope of [node].
ScopeInfo getScopeInfo(MemberEntity member);
- ClosureRepresentationInfo getClosureInfo(T localFunction);
+ ClosureRepresentationInfo getClosureInfo(ir.Node localFunction);
/// Look up information about a loop, in case any variables it declares need
/// to be boxed/snapshotted.
- CapturedLoopScope getCapturedLoopScope(T loopNode);
+ CapturedLoopScope getCapturedLoopScope(ir.Node loopNode);
/// Accessor to the information about scopes that closures capture. Used by
/// the SSA builder.
diff --git a/pkg/compiler/lib/src/elements/jumps.dart b/pkg/compiler/lib/src/elements/jumps.dart
index b179daa..05a25e7 100644
--- a/pkg/compiler/lib/src/elements/jumps.dart
+++ b/pkg/compiler/lib/src/elements/jumps.dart
@@ -7,9 +7,9 @@
import 'entities.dart';
/// The label entity defined by a labeled statement.
-abstract class LabelDefinition<T> extends Entity {
+abstract class LabelDefinition extends Entity {
String get labelName;
- JumpTarget<T> get target;
+ JumpTarget get target;
bool get isTarget => isBreakTarget || isContinueTarget;
@@ -19,20 +19,19 @@
/// A jump target is the reference point of a statement or switch-case,
/// either by label or as the default target of a break or continue.
-abstract class JumpTarget<T> extends Local {
+abstract class JumpTarget extends Local {
String get name => 'target';
bool get isTarget => isBreakTarget || isContinueTarget;
- T get statement;
int get nestingLevel;
- List<LabelDefinition<T>> get labels;
+ List<LabelDefinition> get labels;
bool get isBreakTarget;
bool get isContinueTarget;
bool get isSwitch;
bool get isSwitchCase;
- LabelDefinition<T> addLabel(covariant T label, String labelName,
+ LabelDefinition addLabel(String labelName,
{bool isBreakTarget: false, bool isContinueTarget: false});
}
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index c028b90..7fbd876 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -41,22 +41,22 @@
class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
final CompilerOptions _options;
final JClosedWorld _closedWorld;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
- final InferrerEngine<ir.Node> _inferrer;
- final TypeSystem<ir.Node> _types;
+ final ClosureDataLookup _closureDataLookup;
+ final InferrerEngine _inferrer;
+ final TypeSystem _types;
final MemberEntity _analyzedMember;
final ir.Node _analyzedNode;
final KernelToElementMapForBuilding _elementMap;
final KernelToLocalsMap _localsMap;
- final GlobalTypeInferenceElementData<ir.Node> _memberData;
+ final GlobalTypeInferenceElementData _memberData;
final bool _inGenerativeConstructor;
- LocalsHandler<ir.Node> _locals;
+ LocalsHandler _locals;
final SideEffectsBuilder _sideEffectsBuilder;
- final Map<JumpTarget, List<LocalsHandler<ir.Node>>> _breaksFor =
- <JumpTarget, List<LocalsHandler<ir.Node>>>{};
- final Map<JumpTarget, List<LocalsHandler<ir.Node>>> _continuesFor =
- <JumpTarget, List<LocalsHandler<ir.Node>>>{};
+ final Map<JumpTarget, List<LocalsHandler>> _breaksFor =
+ <JumpTarget, List<LocalsHandler>>{};
+ final Map<JumpTarget, List<LocalsHandler>> _continuesFor =
+ <JumpTarget, List<LocalsHandler>>{};
TypeInformation _returnType;
final Set<Local> _capturedVariables = new Set<Local>();
@@ -91,9 +91,9 @@
this._inGenerativeConstructor = _analyzedNode is ir.Constructor {
if (_locals != null) return;
- FieldInitializationScope<ir.Node> fieldScope =
+ FieldInitializationScope fieldScope =
_inGenerativeConstructor ? new FieldInitializationScope(_types) : null;
- _locals = new LocalsHandler<ir.Node>(
+ _locals = new LocalsHandler(
_inferrer, _types, _options, _analyzedNode, fieldScope);
}
@@ -529,7 +529,7 @@
continueTargets.forEach(_clearBreaksAndContinues);
} else {
LocalsHandler saved = _locals;
- List<LocalsHandler<ir.Node>> localsToMerge = <LocalsHandler<ir.Node>>[];
+ List<LocalsHandler> localsToMerge = <LocalsHandler>[];
bool hasDefaultCase = false;
for (ir.SwitchCase switchCase in node.cases) {
@@ -965,10 +965,10 @@
void _setupBreaksAndContinues(JumpTarget target) {
if (target == null) return;
if (target.isContinueTarget) {
- _continuesFor[target] = <LocalsHandler<ir.Node>>[];
+ _continuesFor[target] = <LocalsHandler>[];
}
if (target.isBreakTarget) {
- _breaksFor[target] = <LocalsHandler<ir.Node>>[];
+ _breaksFor[target] = <LocalsHandler>[];
}
}
@@ -977,15 +977,15 @@
_breaksFor.remove(element);
}
- List<LocalsHandler<ir.Node>> _getBreaks(JumpTarget target) {
- List<LocalsHandler<ir.Node>> list = <LocalsHandler<ir.Node>>[_locals];
+ List<LocalsHandler> _getBreaks(JumpTarget target) {
+ List<LocalsHandler> list = <LocalsHandler>[_locals];
if (target == null) return list;
if (!target.isBreakTarget) return list;
return list..addAll(_breaksFor[target]);
}
- List<LocalsHandler<ir.Node>> _getLoopBackEdges(JumpTarget target) {
- List<LocalsHandler<ir.Node>> list = <LocalsHandler<ir.Node>>[_locals];
+ List<LocalsHandler> _getLoopBackEdges(JumpTarget target) {
+ List<LocalsHandler> list = <LocalsHandler>[_locals];
if (target == null) return list;
if (!target.isContinueTarget) return list;
return list..addAll(_continuesFor[target]);
@@ -1507,7 +1507,7 @@
// We don't put the closure in the work queue of the
// inferrer, because it will share information with its enclosing
// method, like for example the types of local variables.
- LocalsHandler<ir.Node> closureLocals =
+ LocalsHandler closureLocals =
new LocalsHandler.from(_locals, node, useOtherTryBlock: false);
KernelTypeGraphBuilder visitor = new KernelTypeGraphBuilder(
_options,
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
index 74e9360..03be5ac 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -38,7 +38,7 @@
/// An inferencing engine that computes a call graph of [TypeInformation] nodes
/// by visiting the AST of the application, and then does the inferencing on the
/// graph.
-abstract class InferrerEngine<T> {
+abstract class InferrerEngine {
/// A set of selector names that [List] implements, that we know return their
/// element type.
final Set<Selector> returnsListElementTypeSet =
@@ -64,8 +64,8 @@
// [ClosureWorldRefiner].
NoSuchMethodData get noSuchMethodData => closedWorld.noSuchMethodData;
- TypeSystem<T> get types;
- Map<T, TypeInformation> get concreteTypes;
+ TypeSystem get types;
+ Map<ir.Node, TypeInformation> get concreteTypes;
InferredDataBuilder get inferredDataBuilder;
FunctionEntity get mainElement;
@@ -115,9 +115,9 @@
Iterable<MemberEntity> getCallersOfForTesting(MemberEntity element);
// TODO(johnniwinther): Make this private again.
- GlobalTypeInferenceElementData<T> dataOfMember(MemberEntity element);
+ GlobalTypeInferenceElementData dataOfMember(MemberEntity element);
- GlobalTypeInferenceElementData<T> lookupDataOfMember(MemberEntity element);
+ GlobalTypeInferenceElementData lookupDataOfMember(MemberEntity element);
bool checkIfExposesThis(ConstructorEntity element);
@@ -131,11 +131,11 @@
/// Registers a call to await with an expression of type [argumentType] as
/// argument.
- TypeInformation registerAwait(T node, TypeInformation argument);
+ TypeInformation registerAwait(ir.Node node, TypeInformation argument);
/// Registers a call to yield with an expression of type [argumentType] as
/// argument.
- TypeInformation registerYield(T node, TypeInformation argument);
+ TypeInformation registerYield(ir.Node node, TypeInformation argument);
/// Registers that [caller] calls [closure] with [arguments].
///
@@ -144,7 +144,7 @@
///
/// [inLoop] tells whether the call happens in a loop.
TypeInformation registerCalledClosure(
- T node,
+ ir.Node node,
Selector selector,
AbstractValue mask,
TypeInformation closure,
@@ -180,7 +180,7 @@
/// [inLoop] tells whether the call happens in a loop.
TypeInformation registerCalledSelector(
CallType callType,
- T node,
+ ir.Node node,
Selector selector,
AbstractValue mask,
TypeInformation receiverType,
@@ -197,8 +197,8 @@
ArgumentsTypes arguments, Selector selector, AbstractValue mask,
{bool remove, bool addToQueue: true});
- void updateSelectorInMember(MemberEntity owner, CallType callType, T node,
- Selector selector, AbstractValue mask);
+ void updateSelectorInMember(MemberEntity owner, CallType callType,
+ ir.Node node, Selector selector, AbstractValue mask);
/// Returns the return type of [element].
TypeInformation returnTypeOfMember(MemberEntity element);
@@ -246,7 +246,7 @@
bool assumeDynamic(MemberEntity member);
}
-abstract class InferrerEngineImpl<T> extends InferrerEngine<T> {
+abstract class InferrerEngineImpl extends InferrerEngine {
static bool retainDataForTesting = false;
final Map<Local, TypeInformation> defaultTypeOfParameter =
@@ -272,8 +272,9 @@
final JClosedWorld closedWorld;
final InferredDataBuilder inferredDataBuilder;
- final TypeSystem<T> types;
- final Map<T, TypeInformation> concreteTypes = new Map<T, TypeInformation>();
+ final TypeSystem types;
+ final Map<ir.Node, TypeInformation> concreteTypes =
+ new Map<ir.Node, TypeInformation>();
final Map<ir.Node, TypeInformation> concreteKernelTypes =
new Map<ir.Node, TypeInformation>();
@@ -299,8 +300,8 @@
this.mainElement,
this.sorter,
this.inferredDataBuilder,
- TypeSystemStrategy<T> typeSystemStrategy)
- : this.types = new TypeSystem<T>(closedWorld, typeSystemStrategy);
+ TypeSystemStrategy typeSystemStrategy)
+ : this.types = new TypeSystem(closedWorld, typeSystemStrategy);
void forEachElementMatching(
Selector selector, AbstractValue mask, bool f(MemberEntity element)) {
@@ -310,13 +311,13 @@
}
}
- GlobalTypeInferenceElementData<T> createElementData();
+ GlobalTypeInferenceElementData createElementData();
// TODO(johnniwinther): Make this private again.
- GlobalTypeInferenceElementData<T> dataOfMember(MemberEntity element) =>
+ GlobalTypeInferenceElementData dataOfMember(MemberEntity element) =>
_memberData.putIfAbsent(element, createElementData);
- GlobalTypeInferenceElementData<T> lookupDataOfMember(MemberEntity element) =>
+ GlobalTypeInferenceElementData lookupDataOfMember(MemberEntity element) =>
_memberData[element];
/**
@@ -389,8 +390,8 @@
return returnType;
}
- void updateSelectorInMember(MemberEntity owner, CallType callType, T node,
- Selector selector, AbstractValue mask) {
+ void updateSelectorInMember(MemberEntity owner, CallType callType,
+ ir.Node node, Selector selector, AbstractValue mask) {
GlobalTypeInferenceElementData data = dataOfMember(owner);
assert(validCallType(callType, node));
switch (callType) {
@@ -535,7 +536,7 @@
if (debug.VERBOSE) {
print("traced closure $element as "
"${inferredDataBuilder
- .getCurrentlyKnownMightBePassedToApply(element)}");
+ .getCurrentlyKnownMightBePassedToApply(element)}");
}
});
}
@@ -673,7 +674,7 @@
int computeMemberSize(MemberEntity member);
/// Returns the body node for [member].
- T computeMemberBody(MemberEntity member);
+ ir.Node computeMemberBody(MemberEntity member);
/// Returns the `call` method on [cls] or the `noSuchMethod` if [cls] doesn't
/// implement `call`.
@@ -683,7 +684,7 @@
if (analyzedElements.contains(element)) return;
analyzedElements.add(element);
- T body = computeMemberBody(element);
+ ir.Node body = computeMemberBody(element);
TypeInformation type;
reporter.withCurrentElement(element, () {
@@ -745,11 +746,13 @@
}
/// Visits [body] to compute the [TypeInformation] node for [member].
- TypeInformation computeMemberTypeInformation(MemberEntity member, T body);
+ TypeInformation computeMemberTypeInformation(
+ MemberEntity member, ir.Node body);
/// Returns `true` if the [initializer] of the non-const static or top-level
/// [field] is potentially `null`.
- bool isFieldInitializerPotentiallyNull(FieldEntity field, T initializer);
+ bool isFieldInitializerPotentiallyNull(
+ FieldEntity field, ir.Node initializer);
/// Returns the [ConstantValue] for the initial value of [field], or
/// `null` if the initializer is not a constant value.
@@ -1002,7 +1005,7 @@
TypeInformation registerCalledSelector(
CallType callType,
- T node,
+ ir.Node node,
Selector selector,
AbstractValue mask,
TypeInformation receiverType,
@@ -1042,16 +1045,16 @@
return info;
}
- TypeInformation registerAwait(T node, TypeInformation argument) {
- AwaitTypeInformation info = new AwaitTypeInformation<T>(
+ TypeInformation registerAwait(ir.Node node, TypeInformation argument) {
+ AwaitTypeInformation info = new AwaitTypeInformation(
abstractValueDomain, types.currentMember, node);
info.addAssignment(argument);
types.allocatedTypes.add(info);
return info;
}
- TypeInformation registerYield(T node, TypeInformation argument) {
- YieldTypeInformation info = new YieldTypeInformation<T>(
+ TypeInformation registerYield(ir.Node node, TypeInformation argument) {
+ YieldTypeInformation info = new YieldTypeInformation(
abstractValueDomain, types.currentMember, node);
info.addAssignment(argument);
types.allocatedTypes.add(info);
@@ -1059,7 +1062,7 @@
}
TypeInformation registerCalledClosure(
- T node,
+ ir.Node node,
Selector selector,
AbstractValue mask,
TypeInformation closure,
diff --git a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
index 07d745f..00c111e 100644
--- a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
@@ -28,11 +28,11 @@
import 'type_graph_nodes.dart';
import 'type_system.dart';
-class KernelTypeGraphInferrer extends TypeGraphInferrer<ir.Node> {
+class KernelTypeGraphInferrer extends TypeGraphInferrer {
final Compiler _compiler;
final KernelToElementMapForBuilding _elementMap;
final GlobalLocalsMap _globalLocalsMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
final InferredDataBuilder _inferredDataBuilder;
KernelTypeGraphInferrer(
@@ -46,7 +46,7 @@
: super(closedWorld, disableTypeInference: disableTypeInference);
@override
- InferrerEngine<ir.Node> createInferrerEngineFor(FunctionEntity main) {
+ InferrerEngine createInferrerEngineFor(FunctionEntity main) {
return new KernelInferrerEngine(
_compiler.options,
_compiler.progress,
@@ -68,16 +68,15 @@
}
}
-class KernelGlobalTypeInferenceResults
- extends GlobalTypeInferenceResults<ir.Node> {
+class KernelGlobalTypeInferenceResults extends GlobalTypeInferenceResults {
KernelGlobalTypeInferenceResults(
- TypesInferrer<ir.Node> inferrer, JClosedWorld closedWorld)
+ TypesInferrer inferrer, JClosedWorld closedWorld)
: super(inferrer, closedWorld);
- GlobalTypeInferenceMemberResult<ir.Node> createMemberResult(
- TypeGraphInferrer<ir.Node> inferrer, MemberEntity member,
+ GlobalTypeInferenceMemberResult createMemberResult(
+ TypeGraphInferrer inferrer, MemberEntity member,
{bool isJsInterop: false}) {
- return new GlobalTypeInferenceMemberResultImpl<ir.Node>(
+ return new GlobalTypeInferenceMemberResultImpl(
member,
// We store data in the context of the enclosing method, even
// for closure elements.
@@ -86,17 +85,16 @@
isJsInterop);
}
- GlobalTypeInferenceParameterResult<ir.Node> createParameterResult(
- TypeGraphInferrer<ir.Node> inferrer, Local parameter) {
- return new GlobalTypeInferenceParameterResultImpl<ir.Node>(
- parameter, inferrer);
+ GlobalTypeInferenceParameterResult createParameterResult(
+ TypeGraphInferrer inferrer, Local parameter) {
+ return new GlobalTypeInferenceParameterResultImpl(parameter, inferrer);
}
}
-class KernelInferrerEngine extends InferrerEngineImpl<ir.Node> {
+class KernelInferrerEngine extends InferrerEngineImpl {
final KernelToElementMapForBuilding _elementMap;
final GlobalLocalsMap _globalLocalsMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
KernelInferrerEngine(
CompilerOptions options,
@@ -225,7 +223,7 @@
}
@override
- GlobalTypeInferenceElementData<ir.Node> createElementData() {
+ GlobalTypeInferenceElementData createElementData() {
return new KernelGlobalTypeInferenceElementData();
}
@@ -237,10 +235,10 @@
}
}
-class KernelTypeSystemStrategy implements TypeSystemStrategy<ir.Node> {
+class KernelTypeSystemStrategy implements TypeSystemStrategy {
KernelToElementMapForBuilding _elementMap;
GlobalLocalsMap _globalLocalsMap;
- ClosureDataLookup<ir.Node> _closureDataLookup;
+ ClosureDataLookup _closureDataLookup;
KernelTypeSystemStrategy(
this._elementMap, this._globalLocalsMap, this._closureDataLookup);
@@ -271,7 +269,7 @@
ParameterTypeInformation createParameterTypeInformation(
AbstractValueDomain abstractValueDomain,
covariant JLocal parameter,
- TypeSystem<ir.Node> types) {
+ TypeSystem types) {
MemberEntity context = parameter.memberContext;
KernelToLocalsMap localsMap = _globalLocalsMap.getLocalsMap(context);
ir.FunctionNode functionNode =
@@ -340,7 +338,7 @@
}
class KernelGlobalTypeInferenceElementData
- extends GlobalTypeInferenceElementData<ir.Node> {
+ extends GlobalTypeInferenceElementData {
// TODO(johnniwinther): Rename this together with [typeOfSend].
Map<ir.Node, AbstractValue> _sendMap;
diff --git a/pkg/compiler/lib/src/inferrer/locals_handler.dart b/pkg/compiler/lib/src/inferrer/locals_handler.dart
index 26b41c7..ae92797 100644
--- a/pkg/compiler/lib/src/inferrer/locals_handler.dart
+++ b/pkg/compiler/lib/src/inferrer/locals_handler.dart
@@ -21,14 +21,14 @@
* The inferrer makes sure updates get merged into the parent scope,
* once the control flow block has been visited.
*/
-class VariableScope<T> {
+class VariableScope {
Map<Local, TypeInformation> variables;
/// The parent of this scope. Null for the root scope.
final VariableScope parent;
- /// The [Node] that created this scope.
- final T block;
+ /// The [ir.Node] that created this scope.
+ final ir.Node block;
/// `true` if this scope is for a try block.
final bool isTry;
@@ -40,7 +40,7 @@
"Unexpected block $block for isTry=$isTry");
}
- VariableScope.deepCopyOf(VariableScope<T> other)
+ VariableScope.deepCopyOf(VariableScope other)
: variables = other.variables == null
? null
: new Map<Local, TypeInformation>.from(other.variables),
@@ -50,7 +50,7 @@
? null
: new VariableScope.deepCopyOf(other.parent);
- VariableScope.topLevelCopyOf(VariableScope<T> other)
+ VariableScope.topLevelCopyOf(VariableScope other)
: variables = other.variables == null
? null
: new Map<Local, TypeInformation>.from(other.variables),
@@ -80,7 +80,7 @@
}
void forEachLocalUntilNode(
- T node, void f(Local variable, TypeInformation type),
+ ir.Node node, void f(Local variable, TypeInformation type),
[Setlet<Local> seenLocals]) {
if (seenLocals == null) seenLocals = new Setlet<Local>();
if (variables != null) {
@@ -110,8 +110,8 @@
}
/// Tracks initializers via initializations and assignments.
-class FieldInitializationScope<T> {
- final TypeSystem<T> types;
+class FieldInitializationScope {
+ final TypeSystem types;
Map<FieldEntity, TypeInformation> fields;
bool isThisExposed;
@@ -123,14 +123,14 @@
: isThisExposed = false,
isIndefinite = false;
- FieldInitializationScope.internalFrom(FieldInitializationScope<T> other)
+ FieldInitializationScope.internalFrom(FieldInitializationScope other)
: types = other.types,
isThisExposed = other.isThisExposed,
isIndefinite = other.isIndefinite;
- factory FieldInitializationScope.from(FieldInitializationScope<T> other) {
+ factory FieldInitializationScope.from(FieldInitializationScope other) {
if (other == null) return null;
- return new FieldInitializationScope<T>.internalFrom(other);
+ return new FieldInitializationScope.internalFrom(other);
}
void updateField(FieldEntity field, TypeInformation type) {
@@ -148,14 +148,14 @@
fields?.forEach(f);
}
- void mergeDiamondFlow(FieldInitializationScope<T> thenScope,
- FieldInitializationScope<T> elseScope) {
+ void mergeDiamondFlow(
+ FieldInitializationScope thenScope, FieldInitializationScope elseScope) {
// Quick bailout check. If [isThisExposed] or [isIndefinite] is true, we
// know the code following won'TypeInformation do anything.
if (isThisExposed) return;
if (isIndefinite) return;
- FieldInitializationScope<T> otherScope =
+ FieldInitializationScope otherScope =
(elseScope == null || elseScope.fields == null) ? this : elseScope;
thenScope.forEach((FieldEntity field, TypeInformation type) {
@@ -248,14 +248,14 @@
/**
* Placeholder for inferred types of local variables.
*/
-class LocalsHandler<T> {
+class LocalsHandler {
final CompilerOptions options;
- final TypeSystem<T> types;
- final InferrerEngine<T> inferrer;
- final VariableScope<T> locals;
+ final TypeSystem types;
+ final InferrerEngine inferrer;
+ final VariableScope locals;
final Map<Local, FieldEntity> _capturedAndBoxed;
- final FieldInitializationScope<T> fieldScope;
- LocalsHandler<T> tryBlock;
+ final FieldInitializationScope fieldScope;
+ LocalsHandler tryBlock;
bool seenReturnOrThrow = false;
bool seenBreakOrContinue = false;
@@ -265,17 +265,16 @@
bool get inTryBlock => tryBlock != null;
- LocalsHandler(this.inferrer, this.types, this.options, T block,
+ LocalsHandler(this.inferrer, this.types, this.options, ir.Node block,
[this.fieldScope])
- : locals = new VariableScope<T>(block, isTry: false),
+ : locals = new VariableScope(block, isTry: false),
_capturedAndBoxed = new Map<Local, FieldEntity>(),
tryBlock = null;
- LocalsHandler.from(LocalsHandler<T> other, T block,
+ LocalsHandler.from(LocalsHandler other, ir.Node block,
{bool isTry: false, bool useOtherTryBlock: true})
- : locals =
- new VariableScope<T>(block, isTry: isTry, parent: other.locals),
- fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
+ : locals = new VariableScope(block, isTry: isTry, parent: other.locals),
+ fieldScope = new FieldInitializationScope.from(other.fieldScope),
_capturedAndBoxed = other._capturedAndBoxed,
types = other.types,
inferrer = other.inferrer,
@@ -283,18 +282,18 @@
tryBlock = useOtherTryBlock ? other.tryBlock : this;
}
- LocalsHandler.deepCopyOf(LocalsHandler<T> other)
- : locals = new VariableScope<T>.deepCopyOf(other.locals),
- fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
+ LocalsHandler.deepCopyOf(LocalsHandler other)
+ : locals = new VariableScope.deepCopyOf(other.locals),
+ fieldScope = new FieldInitializationScope.from(other.fieldScope),
_capturedAndBoxed = other._capturedAndBoxed,
tryBlock = other.tryBlock,
types = other.types,
inferrer = other.inferrer,
options = other.options;
- LocalsHandler.topLevelCopyOf(LocalsHandler<T> other)
- : locals = new VariableScope<T>.topLevelCopyOf(other.locals),
- fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
+ LocalsHandler.topLevelCopyOf(LocalsHandler other)
+ : locals = new VariableScope.topLevelCopyOf(other.locals),
+ fieldScope = new FieldInitializationScope.from(other.fieldScope),
_capturedAndBoxed = other._capturedAndBoxed,
tryBlock = other.tryBlock,
types = other.types,
@@ -310,7 +309,8 @@
}
}
- void update(Local local, TypeInformation type, T node, DartType staticType,
+ void update(
+ Local local, TypeInformation type, ir.Node node, DartType staticType,
{bool isSetIfNull: false}) {
assert(type != null);
if (!options.assignmentCheckPolicy.isIgnored) {
@@ -356,7 +356,8 @@
}
}
- void narrow(Local local, DartType type, T node, {bool isSetIfNull: false}) {
+ void narrow(Local local, DartType type, ir.Node node,
+ {bool isSetIfNull: false}) {
TypeInformation existing = use(local);
TypeInformation newType =
types.narrowType(existing, type, isNullable: false);
@@ -367,8 +368,7 @@
_capturedAndBoxed[local] = field;
}
- void mergeDiamondFlow(
- LocalsHandler<T> thenBranch, LocalsHandler<T> elseBranch) {
+ void mergeDiamondFlow(LocalsHandler thenBranch, LocalsHandler elseBranch) {
if (fieldScope != null && elseBranch != null) {
fieldScope.mergeDiamondFlow(thenBranch.fieldScope, elseBranch.fieldScope);
}
@@ -380,7 +380,7 @@
elseBranch.seenBreakOrContinue;
if (aborts) return;
- void mergeOneBranch(LocalsHandler<T> other) {
+ void mergeOneBranch(LocalsHandler other) {
other.locals.forEachOwnLocal((Local local, TypeInformation type) {
TypeInformation myType = locals[local];
if (myType == null) return; // Variable is only defined in [other].
@@ -389,7 +389,7 @@
});
}
- void inPlaceUpdateOneBranch(LocalsHandler<T> other) {
+ void inPlaceUpdateOneBranch(LocalsHandler other) {
other.locals.forEachOwnLocal((Local local, TypeInformation type) {
TypeInformation myType = locals[local];
if (myType == null) return; // Variable is only defined in [other].
@@ -459,18 +459,18 @@
* where [:this:] is the [LocalsHandler] for the paths through the
* labeled statement that do not break out.
*/
- void mergeAfterBreaks(List<LocalsHandler<T>> handlers,
+ void mergeAfterBreaks(List<LocalsHandler> handlers,
{bool keepOwnLocals: true}) {
- T level = locals.block;
+ ir.Node level = locals.block;
// Use a separate locals handler to perform the merge in, so that Phi
// creation does not invalidate previous type knowledge while we might
// still look it up.
- LocalsHandler<T> merged =
- new LocalsHandler<T>.from(this, level, isTry: locals.isTry);
+ LocalsHandler merged =
+ new LocalsHandler.from(this, level, isTry: locals.isTry);
Set<Local> seenLocals = new Setlet<Local>();
bool allBranchesAbort = true;
// Merge all other handlers.
- for (LocalsHandler<T> handler in handlers) {
+ for (LocalsHandler handler in handlers) {
allBranchesAbort = allBranchesAbort && handler.seenReturnOrThrow;
merged.mergeHandler(handler, seenLocals);
}
@@ -500,7 +500,7 @@
* unless the local is already present in the set [seen]. This effectively
* overwrites the current type knowledge in this handler.
*/
- bool mergeHandler(LocalsHandler<T> other, [Set<Local> seen]) {
+ bool mergeHandler(LocalsHandler other, [Set<Local> seen]) {
if (other.seenReturnOrThrow) return false;
bool changed = false;
other.locals.forEachLocalUntilNode(locals.block, (local, otherType) {
@@ -535,7 +535,7 @@
return changed;
}
- void startLoop(T loop) {
+ void startLoop(ir.Node loop) {
locals.forEachLocal((Local variable, TypeInformation type) {
TypeInformation newType =
types.allocateLoopPhi(loop, variable, type, isTry: false);
@@ -545,7 +545,7 @@
});
}
- void endLoop(T loop) {
+ void endLoop(ir.Node loop) {
locals.forEachLocal((Local variable, TypeInformation type) {
TypeInformation newType = types.simplifyPhi(loop, variable, type);
if (newType != type) {
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index e07ddc6..ca3860a 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -6,6 +6,7 @@
import 'dart:collection' show Queue;
+import 'package:kernel/ast.dart' as ir;
import '../elements/entities.dart';
import '../types/abstract_value_domain.dart';
import '../types/types.dart';
@@ -45,8 +46,8 @@
int get length => queue.length;
}
-abstract class TypeGraphInferrer<T> implements TypesInferrer<T> {
- InferrerEngine<T> inferrer;
+abstract class TypeGraphInferrer implements TypesInferrer {
+ InferrerEngine inferrer;
final bool _disableTypeInference;
final JClosedWorld closedWorld;
@@ -66,7 +67,7 @@
inferrer.runOverAllElements();
}
- InferrerEngine<T> createInferrerEngineFor(FunctionEntity main);
+ InferrerEngine createInferrerEngineFor(FunctionEntity main);
AbstractValue getReturnTypeOfMember(MemberEntity element) {
if (_disableTypeInference) return _dynamicType;
@@ -95,12 +96,12 @@
return inferrer.types.getInferredTypeOfParameter(element).type;
}
- AbstractValue getTypeForNewList(T node) {
+ AbstractValue getTypeForNewList(ir.Node node) {
if (_disableTypeInference) return _dynamicType;
return inferrer.types.allocatedLists[node].type;
}
- bool isFixedArrayCheckedForGrowable(T node) {
+ bool isFixedArrayCheckedForGrowable(ir.Node node) {
if (_disableTypeInference) return true;
ListTypeInformation info = inferrer.types.allocatedLists[node];
return info.checksGrowable;
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index dc903fc..fa962df 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -1844,8 +1844,8 @@
* A [PhiElementTypeInformation] is an union of
* [ElementTypeInformation], that is local to a method.
*/
-class PhiElementTypeInformation<T> extends TypeInformation {
- final T branchNode;
+class PhiElementTypeInformation extends TypeInformation {
+ final ir.Node branchNode;
final Local variable;
final bool isTry;
@@ -1949,8 +1949,8 @@
}
}
-class AwaitTypeInformation<T> extends TypeInformation {
- final T _node;
+class AwaitTypeInformation extends TypeInformation {
+ final ir.Node _node;
AwaitTypeInformation(AbstractValueDomain abstractValueDomain,
MemberTypeInformation context, this._node)
@@ -1968,8 +1968,8 @@
}
}
-class YieldTypeInformation<T> extends TypeInformation {
- final T _node;
+class YieldTypeInformation extends TypeInformation {
+ final ir.Node _node;
YieldTypeInformation(AbstractValueDomain abstractValueDomain,
MemberTypeInformation context, this._node)
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index d761d3f..75e4ee3 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -2,6 +2,7 @@
// 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/ast.dart' as ir;
import '../common.dart';
import '../elements/entities.dart';
import '../elements/types.dart';
@@ -12,7 +13,7 @@
/// Strategy for creating type information from members and parameters and type
/// information for nodes.
-abstract class TypeSystemStrategy<T> {
+abstract class TypeSystemStrategy {
/// Creates [MemberTypeInformation] for [member].
MemberTypeInformation createMemberTypeInformation(
AbstractValueDomain abstractValueDomain, MemberEntity member);
@@ -21,22 +22,22 @@
ParameterTypeInformation createParameterTypeInformation(
AbstractValueDomain abstractValueDomain,
Local parameter,
- TypeSystem<T> types);
+ TypeSystem types);
/// Calls [f] for each parameter in [function].
void forEachParameter(FunctionEntity function, void f(Local parameter));
/// Returns whether [node] is valid as a general phi node.
- bool checkPhiNode(T node);
+ bool checkPhiNode(ir.Node node);
/// Returns whether [node] is valid as a loop phi node.
- bool checkLoopPhiNode(T node);
+ bool checkLoopPhiNode(ir.Node node);
/// Returns whether [node] is valid as a list allocation node.
- bool checkListNode(T node);
+ bool checkListNode(ir.Node node);
/// Returns whether [node] is valid as a map allocation node.
- bool checkMapNode(T node);
+ bool checkMapNode(ir.Node node);
/// Returns whether [cls] is valid as a type mask base class.
bool checkClassEntity(ClassEntity cls);
@@ -45,9 +46,9 @@
/**
* The class [SimpleInferrerVisitor] will use when working on types.
*/
-class TypeSystem<T> {
+class TypeSystem {
final JClosedWorld _closedWorld;
- final TypeSystemStrategy<T> strategy;
+ final TypeSystemStrategy strategy;
/// [parameterTypeInformations] and [memberTypeInformations] ordered by
/// creation time. This is used as the inference enqueueing order.
@@ -62,10 +63,12 @@
new Map<MemberEntity, TypeInformation>();
/// [ListTypeInformation] for allocated lists.
- final Map<T, TypeInformation> allocatedLists = new Map<T, TypeInformation>();
+ final Map<ir.Node, TypeInformation> allocatedLists =
+ new Map<ir.Node, TypeInformation>();
/// [MapTypeInformation] for allocated Maps.
- final Map<T, TypeInformation> allocatedMaps = new Map<T, TypeInformation>();
+ final Map<ir.Node, TypeInformation> allocatedMaps =
+ new Map<ir.Node, TypeInformation>();
/// Closures found during the analysis.
final Set<TypeInformation> allocatedClosures = new Set<TypeInformation>();
@@ -453,7 +456,7 @@
}
TypeInformation allocateList(
- TypeInformation type, T node, MemberEntity enclosing,
+ TypeInformation type, ir.Node node, MemberEntity enclosing,
[TypeInformation elementType, int length]) {
assert(strategy.checkListNode(node));
ClassEntity typedDataClass = _closedWorld.commonElements.typedDataClass;
@@ -492,7 +495,7 @@
}
TypeInformation allocateMap(
- ConcreteTypeInformation type, T node, MemberEntity element,
+ ConcreteTypeInformation type, ir.Node node, MemberEntity element,
[List<TypeInformation> keyTypes, List<TypeInformation> valueTypes]) {
assert(strategy.checkMapNode(node));
assert(keyTypes.length == valueTypes.length);
@@ -546,7 +549,7 @@
*/
TypeInformation allocateDiamondPhi(
TypeInformation firstInput, TypeInformation secondInput) {
- PhiElementTypeInformation<T> result = new PhiElementTypeInformation<T>(
+ PhiElementTypeInformation result = new PhiElementTypeInformation(
_abstractValueDomain, currentMember, null, null,
isTry: false);
result.addAssignment(firstInput);
@@ -555,9 +558,9 @@
return result;
}
- PhiElementTypeInformation<T> _addPhi(
- T node, Local variable, TypeInformation inputType, bool isTry) {
- PhiElementTypeInformation<T> result = new PhiElementTypeInformation<T>(
+ PhiElementTypeInformation _addPhi(
+ ir.Node node, Local variable, TypeInformation inputType, bool isTry) {
+ PhiElementTypeInformation result = new PhiElementTypeInformation(
_abstractValueDomain, currentMember, node, variable,
isTry: isTry);
allocatedTypes.add(result);
@@ -569,8 +572,8 @@
* Returns a new type for holding the potential types of [element].
* [inputType] is the first incoming type of the phi.
*/
- PhiElementTypeInformation<T> allocatePhi(
- T node, Local variable, TypeInformation inputType,
+ PhiElementTypeInformation allocatePhi(
+ ir.Node node, Local variable, TypeInformation inputType,
{bool isTry}) {
assert(strategy.checkPhiNode(node));
// Check if [inputType] is a phi for a local updated in
@@ -591,8 +594,8 @@
* implementation of [TypeSystem] to differentiate Phi nodes due to loops
* from other merging uses.
*/
- PhiElementTypeInformation<T> allocateLoopPhi(
- T node, Local variable, TypeInformation inputType,
+ PhiElementTypeInformation allocateLoopPhi(
+ ir.Node node, Local variable, TypeInformation inputType,
{bool isTry}) {
assert(strategy.checkLoopPhiNode(node));
return _addPhi(node, variable, inputType, isTry);
@@ -605,7 +608,7 @@
* input type.
*/
TypeInformation simplifyPhi(
- T node, Local variable, PhiElementTypeInformation<T> phiType) {
+ ir.Node node, Local variable, PhiElementTypeInformation phiType) {
assert(phiType.branchNode == node);
if (phiType.assignments.length == 1) return phiType.assignments.first;
return phiType;
@@ -614,8 +617,8 @@
/**
* Adds [newType] as an input of [phiType].
*/
- PhiElementTypeInformation<T> addPhiInput(Local variable,
- PhiElementTypeInformation<T> phiType, TypeInformation newType) {
+ PhiElementTypeInformation addPhiInput(Local variable,
+ PhiElementTypeInformation phiType, TypeInformation newType) {
phiType.addAssignment(newType);
return phiType;
}
diff --git a/pkg/compiler/lib/src/io/kernel_source_information.dart b/pkg/compiler/lib/src/io/kernel_source_information.dart
index 1b85861..6a7addf 100644
--- a/pkg/compiler/lib/src/io/kernel_source_information.dart
+++ b/pkg/compiler/lib/src/io/kernel_source_information.dart
@@ -16,14 +16,13 @@
import 'position_information.dart';
class KernelSourceInformationStrategy
- extends AbstractPositionSourceInformationStrategy<ir.Node> {
+ extends AbstractPositionSourceInformationStrategy {
final JsBackendStrategy _backendStrategy;
const KernelSourceInformationStrategy(this._backendStrategy);
@override
- SourceInformationBuilder<ir.Node> createBuilderForContext(
- MemberEntity member) {
+ SourceInformationBuilder createBuilderForContext(MemberEntity member) {
return new KernelSourceInformationBuilder(
_backendStrategy.elementMap, member);
}
@@ -70,8 +69,7 @@
/// [SourceInformationBuilder] that generates [PositionSourceInformation] from
/// Kernel nodes.
-class KernelSourceInformationBuilder
- implements SourceInformationBuilder<ir.Node> {
+class KernelSourceInformationBuilder implements SourceInformationBuilder {
final KernelToElementMapForBuilding _elementMap;
final MemberEntity _member;
final String _name;
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index 939c1c3..2356a8b 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -92,8 +92,8 @@
}
}
-abstract class AbstractPositionSourceInformationStrategy<T>
- implements JavaScriptSourceInformationStrategy<T> {
+abstract class AbstractPositionSourceInformationStrategy
+ implements JavaScriptSourceInformationStrategy {
const AbstractPositionSourceInformationStrategy();
@override
diff --git a/pkg/compiler/lib/src/io/source_information.dart b/pkg/compiler/lib/src/io/source_information.dart
index 59e9b2e..5520b6d 100644
--- a/pkg/compiler/lib/src/io/source_information.dart
+++ b/pkg/compiler/lib/src/io/source_information.dart
@@ -4,7 +4,7 @@
library dart2js.source_information;
-import 'package:kernel/ast.dart' show Location;
+import 'package:kernel/ast.dart' as ir;
import '../common.dart';
import '../elements/entities.dart';
import '../js/js.dart' show JavaScriptNodeSourceInformation;
@@ -37,13 +37,13 @@
}
/// Strategy for creating, processing and applying [SourceInformation].
-class SourceInformationStrategy<T> {
+class SourceInformationStrategy {
const SourceInformationStrategy();
/// Create a [SourceInformationBuilder] for [member].
- SourceInformationBuilder<T> createBuilderForContext(
+ SourceInformationBuilder createBuilderForContext(
covariant MemberEntity member) {
- return new SourceInformationBuilder<T>();
+ return new SourceInformationBuilder();
}
/// Generate [SourceInformation] marker for non-preamble code.
@@ -54,7 +54,7 @@
}
/// Interface for generating [SourceInformation].
-class SourceInformationBuilder<T> {
+class SourceInformationBuilder {
const SourceInformationBuilder();
/// Create a [SourceInformationBuilder] for [member].
@@ -70,51 +70,51 @@
/// Generate [SourceInformation] for the generic [node].
@deprecated
- SourceInformation buildGeneric(T node) => null;
+ SourceInformation buildGeneric(ir.Node node) => null;
/// Generate [SourceInformation] for an instantiation of a class using [node]
/// for the source position.
- SourceInformation buildCreate(T node) => null;
+ SourceInformation buildCreate(ir.Node node) => null;
/// Generate [SourceInformation] for the return [node].
- SourceInformation buildReturn(T node) => null;
+ SourceInformation buildReturn(ir.Node node) => null;
/// Generate [SourceInformation] for an implicit return in [element].
SourceInformation buildImplicitReturn(covariant MemberEntity element) => null;
/// Generate [SourceInformation] for the loop [node].
- SourceInformation buildLoop(T node) => null;
+ SourceInformation buildLoop(ir.Node node) => null;
/// Generate [SourceInformation] for a read access like `a.b` where in
/// [receiver] points to the left-most part of the access, `a` in the example,
/// and [property] points to the 'name' of accessed property, `b` in the
/// example.
- SourceInformation buildGet(T node) => null;
+ SourceInformation buildGet(ir.Node node) => null;
/// Generate [SourceInformation] for the read access in [node].
- SourceInformation buildCall(T receiver, T call) => null;
+ SourceInformation buildCall(ir.Node receiver, ir.Node call) => null;
/// Generate [SourceInformation] for the if statement in [node].
- SourceInformation buildIf(T node) => null;
+ SourceInformation buildIf(ir.Node node) => null;
/// Generate [SourceInformation] for the constructor invocation in [node].
- SourceInformation buildNew(T node) => null;
+ SourceInformation buildNew(ir.Node node) => null;
/// Generate [SourceInformation] for the throw in [node].
- SourceInformation buildThrow(T node) => null;
+ SourceInformation buildThrow(ir.Node node) => null;
/// Generate [SourceInformation] for the assignment in [node].
- SourceInformation buildAssignment(T node) => null;
+ SourceInformation buildAssignment(ir.Node node) => null;
/// Generate [SourceInformation] for the variable declaration inserted as
/// first statement of a function.
SourceInformation buildVariableDeclaration() => null;
/// Generate [SourceInformation] for the await [node].
- SourceInformation buildAwait(T node) => null;
+ SourceInformation buildAwait(ir.Node node) => null;
/// Generate [SourceInformation] for the yield or yield* [node].
- SourceInformation buildYield(T node) => null;
+ SourceInformation buildYield(ir.Node node) => null;
/// Generate [SourceInformation] for async/await boiler plate code.
SourceInformation buildAsyncBody() => null;
@@ -123,58 +123,58 @@
SourceInformation buildAsyncExit() => null;
/// Generate [SourceInformation] for an invocation of a foreign method.
- SourceInformation buildForeignCode(T node) => null;
+ SourceInformation buildForeignCode(ir.Node node) => null;
/// Generate [SourceInformation] for a string interpolation of [node].
- SourceInformation buildStringInterpolation(T node) => null;
+ SourceInformation buildStringInterpolation(ir.Node node) => null;
/// Generate [SourceInformation] for the for-in `iterator` access in [node].
- SourceInformation buildForInIterator(T node) => null;
+ SourceInformation buildForInIterator(ir.Node node) => null;
/// Generate [SourceInformation] for the for-in `moveNext` call in [node].
- SourceInformation buildForInMoveNext(T node) => null;
+ SourceInformation buildForInMoveNext(ir.Node node) => null;
/// Generate [SourceInformation] for the for-in `current` access in [node].
- SourceInformation buildForInCurrent(T node) => null;
+ SourceInformation buildForInCurrent(ir.Node node) => null;
/// Generate [SourceInformation] for the for-in variable assignment in [node].
- SourceInformation buildForInSet(T node) => null;
+ SourceInformation buildForInSet(ir.Node node) => null;
/// Generate [SourceInformation] for the operator `[]` access in [node].
- SourceInformation buildIndex(T node) => null;
+ SourceInformation buildIndex(ir.Node node) => null;
/// Generate [SourceInformation] for the operator `[]=` assignment in [node].
- SourceInformation buildIndexSet(T node) => null;
+ SourceInformation buildIndexSet(ir.Node node) => null;
/// Generate [SourceInformation] for the binary operation in [node].
- SourceInformation buildBinary(T node) => null;
+ SourceInformation buildBinary(ir.Node node) => null;
/// Generate [SourceInformation] for the unary operation in [node].
- SourceInformation buildUnary(T node) => null;
+ SourceInformation buildUnary(ir.Node node) => null;
/// Generate [SourceInformation] for the try statement in [node].
- SourceInformation buildTry(T node) => null;
+ SourceInformation buildTry(ir.Node node) => null;
/// Generate [SourceInformation] for the unary operator in [node].
- SourceInformation buildCatch(T node) => null;
+ SourceInformation buildCatch(ir.Node node) => null;
/// Generate [SourceInformation] for the is-test in [node].
- SourceInformation buildIs(T node) => null;
+ SourceInformation buildIs(ir.Node node) => null;
/// Generate [SourceInformation] for the as-cast in [node].
- SourceInformation buildAs(T node) => null;
+ SourceInformation buildAs(ir.Node node) => null;
/// Generate [SourceInformation] for the switch statement [node].
- SourceInformation buildSwitch(T node) => null;
+ SourceInformation buildSwitch(ir.Node node) => null;
/// Generate [SourceInformation] for the switch case in [node].
- SourceInformation buildSwitchCase(T node) => null;
+ SourceInformation buildSwitchCase(ir.Node node) => null;
/// Generate [SourceInformation] for the list literal in [node].
- SourceInformation buildListLiteral(T node) => null;
+ SourceInformation buildListLiteral(ir.Node node) => null;
/// Generate [SourceInformation] for the break/continue in [node].
- SourceInformation buildGoto(T node) => null;
+ SourceInformation buildGoto(ir.Node node) => null;
}
/// A location in a source file.
@@ -221,7 +221,7 @@
/// A location in a source file.
abstract class AbstractSourceLocation extends SourceLocation {
final SourceFile _sourceFile;
- Location _location;
+ ir.Location _location;
AbstractSourceLocation(this._sourceFile) {
assert(
diff --git a/pkg/compiler/lib/src/js/js_source_mapping.dart b/pkg/compiler/lib/src/js/js_source_mapping.dart
index 4293efe..bef8c19 100644
--- a/pkg/compiler/lib/src/js/js_source_mapping.dart
+++ b/pkg/compiler/lib/src/js/js_source_mapping.dart
@@ -12,8 +12,7 @@
/// [SourceInformationStrategy] that can associate source information with
/// JavaScript output.
-class JavaScriptSourceInformationStrategy<T>
- extends SourceInformationStrategy<T> {
+class JavaScriptSourceInformationStrategy extends SourceInformationStrategy {
const JavaScriptSourceInformationStrategy();
/// Creates a processor that can associate source information on [Node] with
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
index e6cd967..f4d37d7 100644
--- a/pkg/compiler/lib/src/js_model/closure.dart
+++ b/pkg/compiler/lib/src/js_model/closure.dart
@@ -74,7 +74,7 @@
// TODO(efortuna): Change inheritance hierarchy so that the
// ClosureConversionTask doesn't inherit from ClosureTask because it's just a
// glorified timer.
-class KernelClosureConversionTask extends ClosureConversionTask<ir.Node> {
+class KernelClosureConversionTask extends ClosureConversionTask {
final KernelToElementMapForBuilding _elementMap;
final GlobalLocalsMap _globalLocalsMap;
final CompilerOptions _options;
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index b0387d4..9179c63 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -181,7 +181,7 @@
@override
SourceInformationStrategy get sourceInformationStrategy {
if (!_compiler.options.generateSourceMap) {
- return const JavaScriptSourceInformationStrategy<ir.Node>();
+ return const JavaScriptSourceInformationStrategy();
}
return new KernelSourceInformationStrategy(this);
}
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 1c1d2f6..efd2e7f 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -194,9 +194,9 @@
});
}
- JLabelDefinition _getOrCreateLabel(JJumpTarget target, ir.Node node) {
+ JLabelDefinition _getOrCreateLabel(JJumpTarget target) {
if (target.labels.isEmpty) {
- return target.addLabel(node, 'label${labelIndex++}');
+ return target.addLabel('label${labelIndex++}');
} else {
return target.labels.single;
}
@@ -268,7 +268,7 @@
search = search.parent;
}
if (needsLabel) {
- JLabelDefinition label = _getOrCreateLabel(target, node.target);
+ JLabelDefinition label = _getOrCreateLabel(target);
label.isBreakTarget = true;
}
} else if (canBeContinueTarget(parent)) {
@@ -292,7 +292,7 @@
search = search.parent;
}
if (needsLabel) {
- JLabelDefinition label = _getOrCreateLabel(target, node.target);
+ JLabelDefinition label = _getOrCreateLabel(target);
label.isContinueTarget = true;
}
} else {
@@ -305,7 +305,7 @@
// and label is therefore always needed.
target = _getJumpTarget(node.target);
target.isBreakTarget = true;
- JLabelDefinition label = _getOrCreateLabel(target, node.target);
+ JLabelDefinition label = _getOrCreateLabel(target);
label.isBreakTarget = true;
}
jumpTargetMap[node] = target;
@@ -317,7 +317,7 @@
JJumpTarget target = _getJumpTarget(node.target);
target.isContinueTarget = true;
jumpTargetMap[node] = target;
- JLabelDefinition label = _getOrCreateLabel(target, node.target);
+ JLabelDefinition label = _getOrCreateLabel(target);
label.isContinueTarget = true;
super.visitContinueSwitchStatement(node);
}
@@ -335,10 +335,10 @@
}
}
-class JJumpTarget extends JumpTarget<ir.Node> {
+class JJumpTarget extends JumpTarget {
final MemberEntity memberContext;
final int nestingLevel;
- List<LabelDefinition<ir.Node>> _labels;
+ List<LabelDefinition> _labels;
final bool isSwitch;
final bool isSwitchCase;
@@ -349,24 +349,18 @@
bool isContinueTarget = false;
@override
- LabelDefinition<ir.Node> addLabel(ir.Node label, String labelName,
+ LabelDefinition addLabel(String labelName,
{bool isBreakTarget: false, bool isContinueTarget: false}) {
- _labels ??= <LabelDefinition<ir.Node>>[];
- LabelDefinition<ir.Node> labelDefinition = new JLabelDefinition(
- this, labelName,
+ _labels ??= <LabelDefinition>[];
+ LabelDefinition labelDefinition = new JLabelDefinition(this, labelName,
isBreakTarget: isBreakTarget, isContinueTarget: isContinueTarget);
_labels.add(labelDefinition);
return labelDefinition;
}
@override
- List<LabelDefinition<ir.Node>> get labels {
- return _labels ?? const <LabelDefinition<ir.Node>>[];
- }
-
- @override
- ir.Node get statement {
- throw new UnimplementedError('JJumpTarget.statement');
+ List<LabelDefinition> get labels {
+ return _labels ?? const <LabelDefinition>[];
}
String toString() {
@@ -389,8 +383,8 @@
}
}
-class JLabelDefinition extends LabelDefinition<ir.Node> {
- final JumpTarget<ir.Node> target;
+class JLabelDefinition extends LabelDefinition {
+ final JumpTarget target;
final String labelName;
bool isBreakTarget;
bool isContinueTarget;
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index a91f8ec..82c06b1 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -62,7 +62,7 @@
final AsyncMarker asyncMarker;
final KernelToLocalsMap localsMap;
final KernelToTypeInferenceMap typeInferenceMap;
- final SourceInformationBuilder<ir.Node> sourceInformationBuilder;
+ final SourceInformationBuilder sourceInformationBuilder;
StackFrame(this.parent, this.member, this.asyncMarker, this.localsMap,
this.typeInferenceMap, this.sourceInformationBuilder);
@@ -98,11 +98,11 @@
@override
JavaScriptBackend get backend => compiler.backend;
- final SourceInformationStrategy<ir.Node> _sourceInformationStrategy;
+ final SourceInformationStrategy _sourceInformationStrategy;
final KernelToElementMapForBuilding _elementMap;
final GlobalTypeInferenceResults globalInferenceResults;
final GlobalLocalsMap _globalLocalsMap;
- LoopHandler<ir.Node> loopHandler;
+ LoopHandler loopHandler;
TypeBuilder typeBuilder;
final NativeEmitter nativeEmitter;
@@ -2009,8 +2009,7 @@
// to the body.
SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
JumpTarget target = localsMap.getJumpTargetForDo(node);
- LabelDefinition label =
- target.addLabel(null, 'loop', isBreakTarget: true);
+ LabelDefinition label = target.addLabel('loop', isBreakTarget: true);
HLabeledBlockInformation info = new HLabeledBlockInformation(
new HSubGraphBlockInformation(bodyGraph), <LabelDefinition>[label]);
loopEntryBlock.setBlockFlow(info, current);
diff --git a/pkg/compiler/lib/src/ssa/loop_handler.dart b/pkg/compiler/lib/src/ssa/loop_handler.dart
index 77c2882..be4fb554 100644
--- a/pkg/compiler/lib/src/ssa/loop_handler.dart
+++ b/pkg/compiler/lib/src/ssa/loop_handler.dart
@@ -15,7 +15,7 @@
import 'nodes.dart';
/// Builds the SSA graph for loop nodes.
-abstract class LoopHandler<T> {
+abstract class LoopHandler {
final GraphBuilder builder;
LoopHandler(this.builder);
@@ -26,7 +26,7 @@
/// The [condition] function must return a boolean result.
/// None of the functions must leave anything on the stack.
void handleLoop(
- T loop,
+ ir.Node loop,
CapturedLoopScope loopClosureInfo,
JumpTarget jumpTarget,
void initialize(),
@@ -201,7 +201,7 @@
// if block.
if (jumpHandler.hasAnyBreak()) {
LabelDefinition label =
- jumpTarget.addLabel(null, 'loop', isBreakTarget: true);
+ jumpTarget.addLabel('loop', isBreakTarget: true);
SubGraph labelGraph = new SubGraph(conditionBlock, builder.current);
HLabeledBlockInformation labelInfo = new HLabeledBlockInformation(
new HSubGraphBlockInformation(labelGraph),
@@ -224,7 +224,7 @@
/// Creates a new loop-header block. The previous [current] block
/// is closed with an [HGoto] and replaced by the newly created block.
/// Also notifies the locals handler that we're entering a loop.
- JumpHandler beginLoopHeader(T node, JumpTarget jumpTarget) {
+ JumpHandler beginLoopHeader(ir.TreeNode node, JumpTarget jumpTarget) {
assert(!builder.isAborted());
HBasicBlock previousBlock =
builder.close(new HGoto(builder.abstractValueDomain));
@@ -297,7 +297,7 @@
/// Determine what kind of loop [node] represents.
///
/// The result is one of the kinds defined in [HLoopBlockInformation].
- int loopKind(T node);
+ int loopKind(ir.TreeNode node);
/// Creates a [JumpHandler] for a statement. The node must be a jump
/// target. If there are no breaks or continues targeting the statement,
@@ -306,13 +306,13 @@
/// [isLoopJump] is [:true:] when the jump handler is for a loop. This is used
/// to distinguish the synthesized loop created for a switch statement with
/// continue statements from simple switch statements.
- JumpHandler createJumpHandler(T node, JumpTarget jumpTarget,
+ JumpHandler createJumpHandler(ir.TreeNode node, JumpTarget jumpTarget,
{bool isLoopJump});
}
// TODO(het): Since kernel simplifies loop breaks and continues, we should
// rewrite the loop handler from scratch to account for the simplified structure
-class KernelLoopHandler extends LoopHandler<ir.TreeNode> {
+class KernelLoopHandler extends LoopHandler {
final KernelSsaGraphBuilder builder;
KernelLoopHandler(KernelSsaGraphBuilder builder)
diff --git a/pkg/compiler/lib/src/types/types.dart b/pkg/compiler/lib/src/types/types.dart
index 98ad9a2..4780546 100644
--- a/pkg/compiler/lib/src/types/types.dart
+++ b/pkg/compiler/lib/src/types/types.dart
@@ -4,6 +4,7 @@
library types;
+import 'package:kernel/ast.dart' as ir;
import '../common.dart' show failedAt;
import '../common/tasks.dart' show CompilerTask;
import '../compiler.dart' show Compiler;
@@ -24,7 +25,7 @@
/// implementation would return false on all boolean properties (giving no
/// guarantees) and the `subclass of Object or null` type mask for the type
/// based queries (the runtime value could be anything).
-abstract class GlobalTypeInferenceElementResult<T> {
+abstract class GlobalTypeInferenceElementResult {
/// Whether the method element associated with this result always throws.
bool get throwsAlways;
@@ -36,46 +37,46 @@
AbstractValue get returnType;
/// Returns the type of a list new expression [node].
- AbstractValue typeOfNewList(T node);
+ AbstractValue typeOfNewList(ir.Node node);
/// Returns the type of a list literal [node].
- AbstractValue typeOfListLiteral(T node);
+ AbstractValue typeOfListLiteral(ir.Node node);
/// Returns the type of a send [node].
// TODO(johnniwinther): Rename this.
- AbstractValue typeOfSend(T node);
+ AbstractValue typeOfSend(ir.Node node);
/// Returns the type of the getter in a complex send-set [node], for example,
/// the type of the `a.f` getter in `a.f += b`.
- AbstractValue typeOfGetter(T node);
+ AbstractValue typeOfGetter(ir.Node node);
/// Returns the type of the iterator in a [loop].
- AbstractValue typeOfIterator(T node);
+ AbstractValue typeOfIterator(ir.Node node);
/// Returns the type of the `moveNext` call of an iterator in a [loop].
- AbstractValue typeOfIteratorMoveNext(T node);
+ AbstractValue typeOfIteratorMoveNext(ir.Node node);
/// Returns the type of the `current` getter of an iterator in a [loop].
- AbstractValue typeOfIteratorCurrent(T node);
+ AbstractValue typeOfIteratorCurrent(ir.Node node);
}
-abstract class GlobalTypeInferenceMemberResult<T>
- extends GlobalTypeInferenceElementResult<T> {
+abstract class GlobalTypeInferenceMemberResult
+ extends GlobalTypeInferenceElementResult {
/// Whether the member associated with this result is only called once in one
/// location in the entire program.
bool get isCalledOnce;
}
-abstract class GlobalTypeInferenceParameterResult<T>
- extends GlobalTypeInferenceElementResult<T> {}
+abstract class GlobalTypeInferenceParameterResult
+ extends GlobalTypeInferenceElementResult {}
-abstract class GlobalTypeInferenceElementResultImpl<T>
- implements GlobalTypeInferenceElementResult<T> {
+abstract class GlobalTypeInferenceElementResultImpl
+ implements GlobalTypeInferenceElementResult {
// TODO(sigmund): split - stop using _data after inference is done.
- final GlobalTypeInferenceElementData<T> _data;
+ final GlobalTypeInferenceElementData _data;
// TODO(sigmund): store relevant data & drop reference to inference engine.
- final TypesInferrer<T> _inferrer;
+ final TypesInferrer _inferrer;
final bool _isJsInterop;
GlobalTypeInferenceElementResultImpl(
@@ -87,22 +88,24 @@
return mask != null && _inferrer.abstractValueDomain.isEmpty(mask);
}
- AbstractValue typeOfNewList(T node) => _inferrer.getTypeForNewList(node);
+ AbstractValue typeOfNewList(ir.Node node) =>
+ _inferrer.getTypeForNewList(node);
- AbstractValue typeOfListLiteral(T node) => _inferrer.getTypeForNewList(node);
+ AbstractValue typeOfListLiteral(ir.Node node) =>
+ _inferrer.getTypeForNewList(node);
- AbstractValue typeOfSend(T node) => _data?.typeOfSend(node);
- AbstractValue typeOfGetter(T node) => _data?.typeOfGetter(node);
- AbstractValue typeOfIterator(T node) => _data?.typeOfIterator(node);
- AbstractValue typeOfIteratorMoveNext(T node) =>
+ AbstractValue typeOfSend(ir.Node node) => _data?.typeOfSend(node);
+ AbstractValue typeOfGetter(ir.Node node) => _data?.typeOfGetter(node);
+ AbstractValue typeOfIterator(ir.Node node) => _data?.typeOfIterator(node);
+ AbstractValue typeOfIteratorMoveNext(ir.Node node) =>
_data?.typeOfIteratorMoveNext(node);
- AbstractValue typeOfIteratorCurrent(T node) =>
+ AbstractValue typeOfIteratorCurrent(ir.Node node) =>
_data?.typeOfIteratorCurrent(node);
}
-class GlobalTypeInferenceMemberResultImpl<T>
- extends GlobalTypeInferenceElementResultImpl<T>
- implements GlobalTypeInferenceMemberResult<T> {
+class GlobalTypeInferenceMemberResultImpl
+ extends GlobalTypeInferenceElementResultImpl
+ implements GlobalTypeInferenceMemberResult {
// TODO(sigmund): delete, store data directly here.
final MemberEntity _owner;
@@ -124,9 +127,9 @@
: _inferrer.getTypeOfMember(_owner);
}
-class GlobalTypeInferenceParameterResultImpl<T>
- extends GlobalTypeInferenceElementResultImpl<T>
- implements GlobalTypeInferenceParameterResult<T> {
+class GlobalTypeInferenceParameterResultImpl
+ extends GlobalTypeInferenceElementResultImpl
+ implements GlobalTypeInferenceParameterResult {
// TODO(sigmund): delete, store data directly here.
final Local _owner;
@@ -144,39 +147,39 @@
/// Internal data used during type-inference to store intermediate results about
/// a single element.
-abstract class GlobalTypeInferenceElementData<T> {
+abstract class GlobalTypeInferenceElementData {
// TODO(johnniwinther): Remove this. Maybe split by access/invoke.
- AbstractValue typeOfSend(T node);
- AbstractValue typeOfGetter(T node);
+ AbstractValue typeOfSend(ir.Node node);
+ AbstractValue typeOfGetter(ir.Node node);
- void setTypeMask(T node, AbstractValue mask);
+ void setTypeMask(ir.Node node, AbstractValue mask);
- AbstractValue typeOfIterator(T node);
+ AbstractValue typeOfIterator(ir.Node node);
- AbstractValue typeOfIteratorMoveNext(T node);
+ AbstractValue typeOfIteratorMoveNext(ir.Node node);
- AbstractValue typeOfIteratorCurrent(T node);
+ AbstractValue typeOfIteratorCurrent(ir.Node node);
- void setIteratorTypeMask(T node, AbstractValue mask);
+ void setIteratorTypeMask(ir.Node node, AbstractValue mask);
- void setMoveNextTypeMask(T node, AbstractValue mask);
+ void setMoveNextTypeMask(ir.Node node, AbstractValue mask);
- void setCurrentTypeMask(T node, AbstractValue mask);
+ void setCurrentTypeMask(ir.Node node, AbstractValue mask);
}
/// API to interact with the global type-inference engine.
-abstract class TypesInferrer<T> {
+abstract class TypesInferrer {
AbstractValueDomain get abstractValueDomain;
void analyzeMain(FunctionEntity element);
AbstractValue getReturnTypeOfMember(MemberEntity element);
AbstractValue getReturnTypeOfParameter(Local element);
AbstractValue getTypeOfMember(MemberEntity element);
AbstractValue getTypeOfParameter(Local element);
- AbstractValue getTypeForNewList(T node);
+ AbstractValue getTypeForNewList(ir.Node node);
AbstractValue getTypeOfSelector(Selector selector, AbstractValue receiver);
void clear();
bool isMemberCalledOnce(MemberEntity element);
- bool isFixedArrayCheckedForGrowable(T node);
+ bool isFixedArrayCheckedForGrowable(ir.Node node);
GlobalTypeInferenceResults createResults();
}
@@ -186,29 +189,29 @@
/// closed-world semantics. Any [TypeMask] for an element or node that we return
/// was inferred to be a "guaranteed type", that means, it is a type that we
/// can prove to be correct for all executions of the program.
-abstract class GlobalTypeInferenceResults<T> {
+abstract class GlobalTypeInferenceResults {
// TODO(sigmund): store relevant data & drop reference to inference engine.
- final TypeGraphInferrer<T> _inferrer;
+ final TypeGraphInferrer _inferrer;
final JClosedWorld closedWorld;
- final Map<MemberEntity, GlobalTypeInferenceMemberResult<T>> _memberResults =
- <MemberEntity, GlobalTypeInferenceMemberResult<T>>{};
- final Map<Local, GlobalTypeInferenceParameterResult<T>> _parameterResults =
- <Local, GlobalTypeInferenceParameterResult<T>>{};
+ final Map<MemberEntity, GlobalTypeInferenceMemberResult> _memberResults =
+ <MemberEntity, GlobalTypeInferenceMemberResult>{};
+ final Map<Local, GlobalTypeInferenceParameterResult> _parameterResults =
+ <Local, GlobalTypeInferenceParameterResult>{};
GlobalTypeInferenceResults(this._inferrer, this.closedWorld);
/// Create the [GlobalTypeInferenceMemberResult] object for [member].
- GlobalTypeInferenceMemberResult<T> createMemberResult(
- TypeGraphInferrer<T> inferrer, MemberEntity member,
+ GlobalTypeInferenceMemberResult createMemberResult(
+ TypeGraphInferrer inferrer, MemberEntity member,
{bool isJsInterop: false});
/// Create the [GlobalTypeInferenceParameterResult] object for [parameter].
- GlobalTypeInferenceParameterResult<T> createParameterResult(
- TypeGraphInferrer<T> inferrer, Local parameter);
+ GlobalTypeInferenceParameterResult createParameterResult(
+ TypeGraphInferrer inferrer, Local parameter);
// TODO(sigmund,johnniwinther): compute result objects eagerly and make it an
// error to query for results that don't exist.
- GlobalTypeInferenceMemberResult<T> resultOfMember(MemberEntity member) {
+ GlobalTypeInferenceMemberResult resultOfMember(MemberEntity member) {
assert(
member is! ConstructorBodyEntity,
failedAt(
@@ -223,7 +226,7 @@
// TODO(sigmund,johnniwinther): compute result objects eagerly and make it an
// error to query for results that don't exist.
- GlobalTypeInferenceElementResult<T> resultOfParameter(Local parameter) {
+ GlobalTypeInferenceElementResult resultOfParameter(Local parameter) {
return _parameterResults.putIfAbsent(
parameter, () => createParameterResult(_inferrer, parameter));
}
@@ -237,7 +240,7 @@
/// check.
// TODO(sigmund): move into the result of the element containing such
// constructor call.
- bool isFixedArrayCheckedForGrowable(T ctorCall) =>
+ bool isFixedArrayCheckedForGrowable(ir.Node ctorCall) =>
_inferrer.isFixedArrayCheckedForGrowable(ctorCall);
}
diff --git a/tests/compiler/dart2js/closure/closure_test.dart b/tests/compiler/dart2js/closure/closure_test.dart
index 819890e..1f5d849 100644
--- a/tests/compiler/dart2js/closure/closure_test.dart
+++ b/tests/compiler/dart2js/closure/closure_test.dart
@@ -58,9 +58,9 @@
}
/// Kernel IR visitor for computing closure data.
-class ClosureIrChecker extends IrDataExtractor with ComputeValueMixin<ir.Node> {
+class ClosureIrChecker extends IrDataExtractor with ComputeValueMixin {
final MemberEntity member;
- final ClosureDataLookup<ir.Node> closureDataLookup;
+ final ClosureDataLookup closureDataLookup;
final CodegenWorldBuilder codegenWorldBuilder;
final KernelToLocalsMap _localsMap;
final bool verbose;
@@ -135,10 +135,10 @@
}
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
bool get verbose;
Map<BoxLocal, String> boxNames = <BoxLocal, String>{};
- ClosureDataLookup<T> get closureDataLookup;
+ ClosureDataLookup get closureDataLookup;
Link<ScopeInfo> scopeInfoStack = const Link<ScopeInfo>();
ScopeInfo get scopeInfo => scopeInfoStack.head;
CapturedScope get capturedScope => capturedScopeStack.head;
@@ -167,7 +167,7 @@
capturedScopeStack = capturedScopeStack.tail;
}
- void pushLoopNode(T node) {
+ void pushLoopNode(ir.Node node) {
//scopeInfoStack = // TODO?
// scopeInfoStack.prepend(closureDataLookup.getScopeInfo(member));
capturedScopeStack = capturedScopeStack
@@ -182,7 +182,7 @@
capturedScopeStack = capturedScopeStack.tail;
}
- void pushLocalFunction(T node) {
+ void pushLocalFunction(ir.Node node) {
closureRepresentationInfoStack = closureRepresentationInfoStack
.prepend(closureDataLookup.getClosureInfo(node));
dump(node);
@@ -200,8 +200,8 @@
print(' capturedScope (${capturedScope.runtimeType})');
capturedScope.forEachBoxedVariable((a, b) => print(' boxed: $a->$b'));
}
- print(
- ' closureRepresentationInfo (${closureRepresentationInfo.runtimeType})');
+ print(' closureRepresentationInfo (${closureRepresentationInfo
+ .runtimeType})');
closureRepresentationInfo
?.forEachFreeVariable((a, b) => print(' free: $a->$b'));
closureRepresentationInfo
diff --git a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
index ca8c88f..05ef28d 100644
--- a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
+++ b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
@@ -91,13 +91,8 @@
KernelBackendStrategy backendStrategy = compiler.backendStrategy;
KernelToElementMapForBuilding elementMap = backendStrategy.elementMap;
MemberDefinition definition = elementMap.getMemberDefinition(member);
- new TypeMaskIrComputer(
- compiler.reporter,
- actualMap,
- elementMap,
- member,
- compiler.backend.outputUnitData,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ new TypeMaskIrComputer(compiler.reporter, actualMap, elementMap, member,
+ compiler.backend.outputUnitData, backendStrategy.closureDataLookup)
.run(definition.node);
}
@@ -105,7 +100,7 @@
class TypeMaskIrComputer extends IrDataExtractor {
final KernelToElementMapForBuilding _elementMap;
final OutputUnitData _data;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
TypeMaskIrComputer(
DiagnosticReporter reporter,
diff --git a/tests/compiler/dart2js/inference/callers_test.dart b/tests/compiler/dart2js/inference/callers_test.dart
index 60bc82f..6dcb3b3 100644
--- a/tests/compiler/dart2js/inference/callers_test.dart
+++ b/tests/compiler/dart2js/inference/callers_test.dart
@@ -27,7 +27,7 @@
});
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
TypeGraphInferrer get inferrer;
String getMemberValue(MemberEntity member) {
@@ -66,16 +66,15 @@
actualMap,
elementMap,
compiler.globalInference.typesInferrerInternal,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ backendStrategy.closureDataLookup)
.run(definition.node);
}
/// AST visitor for computing side effects data for a member.
-class CallersIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
+class CallersIrComputer extends IrDataExtractor with ComputeValueMixin {
final TypeGraphInferrer inferrer;
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
CallersIrComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap,
this._elementMap, this.inferrer, this._closureDataLookup)
diff --git a/tests/compiler/dart2js/inference/inference_data_test.dart b/tests/compiler/dart2js/inference/inference_data_test.dart
index ac4a410..6c403ef 100644
--- a/tests/compiler/dart2js/inference/inference_data_test.dart
+++ b/tests/compiler/dart2js/inference/inference_data_test.dart
@@ -32,7 +32,7 @@
static const String cannotThrow = 'no-throw';
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
InferredData get inferredData;
String getMemberValue(MemberEntity member) {
@@ -66,17 +66,16 @@
actualMap,
elementMap,
compiler.backendClosedWorldForTesting,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>,
+ backendStrategy.closureDataLookup,
compiler.globalInference.inferredData)
.run(definition.node);
}
/// AST visitor for computing side effects data for a member.
-class InferredDataIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
+class InferredDataIrComputer extends IrDataExtractor with ComputeValueMixin {
final JClosedWorld closedWorld;
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
final InferredData inferredData;
InferredDataIrComputer(
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/tests/compiler/dart2js/inference/inference_test_helper.dart
index 333688e..28238bf 100644
--- a/tests/compiler/dart2js/inference/inference_test_helper.dart
+++ b/tests/compiler/dart2js/inference/inference_test_helper.dart
@@ -58,11 +58,11 @@
});
}
-abstract class ComputeValueMixin<T> {
- GlobalTypeInferenceResults<T> get results;
+abstract class ComputeValueMixin {
+ GlobalTypeInferenceResults get results;
String getMemberValue(MemberEntity member) {
- GlobalTypeInferenceMemberResult<T> memberResult =
+ GlobalTypeInferenceMemberResult memberResult =
results.resultOfMember(member);
if (member.isFunction || member.isConstructor || member.isGetter) {
return getTypeMaskValue(memberResult.returnType);
@@ -78,7 +78,7 @@
}
String getParameterValue(Local parameter) {
- GlobalTypeInferenceParameterResult<T> elementResult =
+ GlobalTypeInferenceParameterResult elementResult =
results.resultOfParameter(parameter);
return getTypeMaskValue(elementResult.type);
}
@@ -105,18 +105,17 @@
member,
localsMap.getLocalsMap(member),
compiler.globalInference.resultsForTesting,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ backendStrategy.closureDataLookup)
.run(definition.node);
}
/// IR visitor for computing inference data for a member.
-class TypeMaskIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
- final GlobalTypeInferenceResults<ir.Node> results;
- GlobalTypeInferenceElementResult<ir.Node> result;
+class TypeMaskIrComputer extends IrDataExtractor with ComputeValueMixin {
+ final GlobalTypeInferenceResults results;
+ GlobalTypeInferenceElementResult result;
final KernelToElementMapForBuilding _elementMap;
final KernelToLocalsMap _localsMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
TypeMaskIrComputer(
DiagnosticReporter reporter,
@@ -131,7 +130,7 @@
@override
visitFunctionExpression(ir.FunctionExpression node) {
- GlobalTypeInferenceElementResult<ir.Node> oldResult = result;
+ GlobalTypeInferenceElementResult oldResult = result;
ClosureRepresentationInfo info = _closureDataLookup.getClosureInfo(node);
result = results.resultOfMember(info.callMethod);
super.visitFunctionExpression(node);
@@ -140,7 +139,7 @@
@override
visitFunctionDeclaration(ir.FunctionDeclaration node) {
- GlobalTypeInferenceElementResult<ir.Node> oldResult = result;
+ GlobalTypeInferenceElementResult oldResult = result;
ClosureRepresentationInfo info = _closureDataLookup.getClosureInfo(node);
result = results.resultOfMember(info.callMethod);
super.visitFunctionDeclaration(node);
diff --git a/tests/compiler/dart2js/inference/side_effects_test.dart b/tests/compiler/dart2js/inference/side_effects_test.dart
index 3920656..4a506bd 100644
--- a/tests/compiler/dart2js/inference/side_effects_test.dart
+++ b/tests/compiler/dart2js/inference/side_effects_test.dart
@@ -28,7 +28,7 @@
});
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
InferredData get inferredData;
String getMemberValue(MemberEntity member) {
@@ -53,17 +53,16 @@
actualMap,
elementMap,
compiler.backendClosedWorldForTesting,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>,
+ backendStrategy.closureDataLookup,
compiler.globalInference.inferredData)
.run(definition.node);
}
/// AST visitor for computing side effects data for a member.
-class SideEffectsIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
+class SideEffectsIrComputer extends IrDataExtractor with ComputeValueMixin {
final JClosedWorld closedWorld;
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
final InferredData inferredData;
SideEffectsIrComputer(
diff --git a/tests/compiler/dart2js/inlining/inlining_test.dart b/tests/compiler/dart2js/inlining/inlining_test.dart
index 18951fc..cd2294a 100644
--- a/tests/compiler/dart2js/inlining/inlining_test.dart
+++ b/tests/compiler/dart2js/inlining/inlining_test.dart
@@ -27,7 +27,7 @@
});
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
JavaScriptBackend get backend;
ConstructorBodyEntity getConstructorBody(ConstructorEntity constructor);
@@ -87,22 +87,16 @@
KernelBackendStrategy backendStrategy = compiler.backendStrategy;
KernelToElementMapForBuilding elementMap = backendStrategy.elementMap;
MemberDefinition definition = elementMap.getMemberDefinition(member);
- new InliningIrComputer(
- compiler.reporter,
- actualMap,
- elementMap,
- member,
- compiler.backend,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ new InliningIrComputer(compiler.reporter, actualMap, elementMap, member,
+ compiler.backend, backendStrategy.closureDataLookup)
.run(definition.node);
}
/// AST visitor for computing inference data for a member.
-class InliningIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
+class InliningIrComputer extends IrDataExtractor with ComputeValueMixin {
final JavaScriptBackend backend;
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
InliningIrComputer(
DiagnosticReporter reporter,
diff --git a/tests/compiler/dart2js/rti/rti_emission_test.dart b/tests/compiler/dart2js/rti/rti_emission_test.dart
index 416fabe..1b81048 100644
--- a/tests/compiler/dart2js/rti/rti_emission_test.dart
+++ b/tests/compiler/dart2js/rti/rti_emission_test.dart
@@ -54,7 +54,7 @@
static const String functionType = 'functionType';
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
Compiler get compiler;
ProgramLookup lookup;
@@ -106,13 +106,8 @@
KernelBackendStrategy backendStrategy = compiler.backendStrategy;
KernelToElementMapForBuilding elementMap = backendStrategy.elementMap;
MemberDefinition definition = elementMap.getMemberDefinition(member);
- new RtiMemberEmissionIrComputer(
- compiler.reporter,
- actualMap,
- elementMap,
- member,
- compiler,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ new RtiMemberEmissionIrComputer(compiler.reporter, actualMap, elementMap,
+ member, compiler, backendStrategy.closureDataLookup)
.run(definition.node);
}
@@ -125,8 +120,7 @@
.computeClassValue(cls);
}
-class RtiClassEmissionIrComputer extends DataRegistry
- with ComputeValueMixin<ir.Node> {
+class RtiClassEmissionIrComputer extends DataRegistry with ComputeValueMixin {
final Compiler compiler;
final KernelToElementMapForBuilding _elementMap;
final Map<Id, ActualData> actualMap;
@@ -144,9 +138,9 @@
}
class RtiMemberEmissionIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node> {
+ with ComputeValueMixin {
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
final Compiler compiler;
RtiMemberEmissionIrComputer(
diff --git a/tests/compiler/dart2js/rti/rti_need_test_helper.dart b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
index 1145266..aa64e16 100644
--- a/tests/compiler/dart2js/rti/rti_need_test_helper.dart
+++ b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
@@ -63,7 +63,7 @@
static const String instantiationsNeedTypeArguments = 'needsInst';
}
-abstract class ComputeValueMixin<T> {
+abstract class ComputeValueMixin {
Compiler get compiler;
ResolutionWorldBuilder get resolutionWorldBuilder =>
@@ -248,13 +248,8 @@
KernelBackendStrategy backendStrategy = compiler.backendStrategy;
KernelToElementMapForBuilding elementMap = backendStrategy.elementMap;
MemberDefinition definition = elementMap.getMemberDefinition(member);
- new RtiMemberNeedIrComputer(
- compiler.reporter,
- actualMap,
- elementMap,
- member,
- compiler,
- backendStrategy.closureDataLookup as ClosureDataLookup<ir.Node>)
+ new RtiMemberNeedIrComputer(compiler.reporter, actualMap, elementMap, member,
+ compiler, backendStrategy.closureDataLookup)
.run(definition.node);
}
@@ -270,7 +265,7 @@
.computeClassValue(cls);
}
-abstract class IrMixin implements ComputeValueMixin<ir.Node> {
+abstract class IrMixin implements ComputeValueMixin {
@override
MemberEntity getFrontendMember(MemberEntity backendMember) {
ElementEnvironment elementEnvironment = compiler
@@ -320,7 +315,7 @@
}
class RtiClassNeedIrComputer extends DataRegistry
- with ComputeValueMixin<ir.Node>, IrMixin {
+ with ComputeValueMixin, IrMixin {
final Compiler compiler;
final KernelToElementMapForBuilding _elementMap;
final Map<Id, ActualData> actualMap;
@@ -339,9 +334,9 @@
/// AST visitor for computing inference data for a member.
class RtiMemberNeedIrComputer extends IrDataExtractor
- with ComputeValueMixin<ir.Node>, IrMixin {
+ with ComputeValueMixin, IrMixin {
final KernelToElementMapForBuilding _elementMap;
- final ClosureDataLookup<ir.Node> _closureDataLookup;
+ final ClosureDataLookup _closureDataLookup;
final Compiler compiler;
RtiMemberNeedIrComputer(
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart b/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart
index 6b3a329..88372a5 100644
--- a/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart
+++ b/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart
@@ -19,7 +19,6 @@
import 'package:compiler/src/js/js_source_mapping.dart';
import 'package:compiler/src/js_backend/js_backend.dart';
import 'package:compiler/src/source_file_provider.dart';
-import 'package:kernel/ast.dart' as ir;
import '../../memory_compiler.dart';
import '../../output_collector.dart';
@@ -188,7 +187,7 @@
/// A wrapper of [JavaScriptSourceInformationStrategy] that records
/// [RecordedSourceInformationProcess].
class RecordingSourceInformationStrategy
- extends JavaScriptSourceInformationStrategy<ir.Node> {
+ extends JavaScriptSourceInformationStrategy {
final JavaScriptSourceInformationStrategy strategy;
final Map<RecordedSourceInformationProcess, js.Node> processMap =
<RecordedSourceInformationProcess, js.Node>{};
@@ -198,8 +197,7 @@
RecordingSourceInformationStrategy(this.strategy);
@override
- SourceInformationBuilder<ir.Node> createBuilderForContext(
- MemberEntity member) {
+ SourceInformationBuilder createBuilderForContext(MemberEntity member) {
return strategy.createBuilderForContext(member);
}