More changes to make dart2js dart 2 strong mode clean.

Change-Id: I796ac4b71ca9b91ec43ac72a02127ed87872f954
Reviewed-on: https://dart-review.googlesource.com/56460
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
Emily Fortuna
2018-05-24 20:50:51 +00:00
parent 2d8bf7751e
commit 00a5197542
9 changed files with 30 additions and 26 deletions
@@ -48,12 +48,12 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
final GlobalTypeInferenceElementData<ir.Node> _memberData;
final bool _inGenerativeConstructor;
LocalsHandler _locals;
LocalsHandler<ir.Node> _locals;
final SideEffectsBuilder _sideEffectsBuilder;
final Map<JumpTarget, List<LocalsHandler>> _breaksFor =
<JumpTarget, List<LocalsHandler>>{};
final Map<JumpTarget, List<LocalsHandler>> _continuesFor =
<JumpTarget, List<LocalsHandler>>{};
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>>>{};
TypeInformation _returnType;
final Set<Local> _capturedVariables = new Set<Local>();
@@ -90,7 +90,7 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
FieldInitializationScope<ir.Node> fieldScope =
_inGenerativeConstructor ? new FieldInitializationScope(_types) : null;
_locals = new LocalsHandler(
_locals = new LocalsHandler<ir.Node>(
_inferrer, _types, _options, _analyzedNode, fieldScope);
}
@@ -522,7 +522,7 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
continueTargets.forEach(_clearBreaksAndContinues);
} else {
LocalsHandler saved = _locals;
List<LocalsHandler> localsToMerge = <LocalsHandler>[];
List<LocalsHandler<ir.Node>> localsToMerge = <LocalsHandler<ir.Node>>[];
bool hasDefaultCase = false;
for (ir.SwitchCase switchCase in node.cases) {
@@ -944,8 +944,12 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
void _setupBreaksAndContinues(JumpTarget target) {
if (target == null) return;
if (target.isContinueTarget) _continuesFor[target] = <LocalsHandler>[];
if (target.isBreakTarget) _breaksFor[target] = <LocalsHandler>[];
if (target.isContinueTarget) {
_continuesFor[target] = <LocalsHandler<ir.Node>>[];
}
if (target.isBreakTarget) {
_breaksFor[target] = <LocalsHandler<ir.Node>>[];
}
}
void _clearBreaksAndContinues(JumpTarget element) {
@@ -953,15 +957,15 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
_breaksFor.remove(element);
}
List<LocalsHandler> _getBreaks(JumpTarget target) {
List<LocalsHandler> list = <LocalsHandler>[_locals];
List<LocalsHandler<ir.Node>> _getBreaks(JumpTarget target) {
List<LocalsHandler<ir.Node>> list = <LocalsHandler<ir.Node>>[_locals];
if (target == null) return list;
if (!target.isBreakTarget) return list;
return list..addAll(_breaksFor[target]);
}
List<LocalsHandler> _getLoopBackEdges(JumpTarget target) {
List<LocalsHandler> list = <LocalsHandler>[_locals];
List<LocalsHandler<ir.Node>> _getLoopBackEdges(JumpTarget target) {
List<LocalsHandler<ir.Node>> list = <LocalsHandler<ir.Node>>[_locals];
if (target == null) return list;
if (!target.isContinueTarget) return list;
return list..addAll(_continuesFor[target]);
@@ -1463,7 +1467,7 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
// 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 closureLocals =
LocalsHandler<ir.Node> closureLocals =
new LocalsHandler.from(_locals, node, useOtherTryBlock: false);
KernelTypeGraphBuilder visitor = new KernelTypeGraphBuilder(
_options,
+3 -3
View File
@@ -1102,7 +1102,7 @@ class Namer {
}
jsAst.Name _disambiguateGlobalMember(MemberEntity element) {
return _disambiguateGlobal(element, _proposeNameForMember);
return _disambiguateGlobal<MemberEntity>(element, _proposeNameForMember);
}
jsAst.Name _disambiguateGlobalType(Entity element) {
@@ -1112,8 +1112,8 @@ class Namer {
/// Returns the disambiguated name for a top-level or static element.
///
/// The resulting name is unique within the global-member namespace.
jsAst.Name _disambiguateGlobal(
Entity element, String proposeName(Entity element)) {
jsAst.Name _disambiguateGlobal<T extends Entity>(
T element, String proposeName(T element)) {
// TODO(asgerf): We can reuse more short names if we disambiguate with
// a separate namespace for each of the global holder objects.
jsAst.Name newName = userGlobals[element];
@@ -616,7 +616,7 @@ class ProgramBuilder {
List<StaticMethod> statics = memberElements
.where((e) => !e.isField)
.cast<FunctionEntity>()
.map(_buildStaticMethod)
.map<StaticMethod>(_buildStaticMethod)
.toList();
if (library == _commonElements.interceptorsLibrary) {
@@ -144,7 +144,7 @@ abstract class SourceFileProvider implements CompilerInput {
relativizeUri(Uri uri) => relativize(cwd, uri, isWindows);
SourceFile getUtf8SourceFile(Uri resourceUri) {
SourceFile<List<int>> getUtf8SourceFile(Uri resourceUri) {
return utf8SourceFiles[resourceUri];
}
+1 -1
View File
@@ -2423,7 +2423,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
void generateThrowWithHelper(FunctionEntity helper, argument,
{SourceInformation sourceInformation}) {
js.Expression jsHelper = _emitter.staticFunctionAccess(helper);
List arguments = [];
List arguments = <js.Expression>[];
if (argument is List) {
argument.forEach((instruction) {
use(instruction);
+2 -2
View File
@@ -1555,7 +1555,7 @@ class HCreate extends HInstruction {
/// we have to register the instantiated type in the code generator. The
/// [instructionType] of this node is not enough, because we also need the
/// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
List<DartType> instantiatedTypes;
List<InterfaceType> instantiatedTypes;
/// If this node creates a closure class, [callMethod] is the call method of
/// the closure class.
@@ -1759,7 +1759,7 @@ class HInvokeStatic extends HInvoke {
/// contains the type(s) used in the (Dart) `New` expression(s). The
/// [instructionType] of this node is not enough, because we also need the
/// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
List<DartType> instantiatedTypes;
List<InterfaceType> instantiatedTypes;
/** The first input must be the target. */
HInvokeStatic(this.element, inputs, AbstractValue type, this.typeArguments,
@@ -550,9 +550,9 @@ class VariableNamer {
if (instruction is HCheck) {
// Special case this instruction to use the name of its
// input if it has one.
var temp = instruction;
HInstruction temp = instruction;
do {
temp = temp.checkedInput;
temp = (temp as HCheck).checkedInput;
name = names.ownName[temp];
} while (name == null && temp is HCheck);
if (name != null) return addAllocatedName(instruction, name);
+1 -1
View File
@@ -138,7 +138,7 @@ class Setlet<E> extends SetBase<E> {
while (copyTo < CAPACITY) _contents[copyTo++] = null;
} else {
_contents = new Set<E>()
..addAll(_contents)
..addAll((_contents as List).cast<E>())
..add(element);
_extra = _MARKER;
}
+1 -1
View File
@@ -1254,7 +1254,7 @@ class MiniJsParser {
VariableDeclarationList finishVariableDeclarationList(
Declaration firstVariable) {
var initialization = [];
var initialization = <VariableInitialization>[];
void declare(Declaration declaration) {
Expression initializer = null;