Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Unified Diff: pkg/compiler/lib/src/inferrer/locals_handler.dart

Issue 2981613002: Parameterize TypeSystem by its node kind (Closed)
Patch Set: Updated cf. comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/inferrer/locals_handler.dart
diff --git a/pkg/compiler/lib/src/inferrer/locals_handler.dart b/pkg/compiler/lib/src/inferrer/locals_handler.dart
index ab1c713c3e578d2fd7cb962beaa262b88bfd3a13..ed04230b6dbb4861cd68692b44c0f2f5ac2deae4 100644
--- a/pkg/compiler/lib/src/inferrer/locals_handler.dart
+++ b/pkg/compiler/lib/src/inferrer/locals_handler.dart
@@ -104,7 +104,7 @@ class VariableScope {
/// Tracks initializers via initializations and assignments.
class FieldInitializationScope {
- final TypeSystem types;
+ final TypeSystem<Node> types;
Map<Element, TypeInformation> fields;
bool isThisExposed;
@@ -243,7 +243,7 @@ class ArgumentsTypesIterator implements Iterator<TypeInformation> {
*/
class LocalsHandler {
final CompilerOptions options;
- final TypeSystem types;
+ final TypeSystem<Node> types;
final InferrerEngine inferrer;
final VariableScope locals;
final Map<Local, FieldEntity> captured;
@@ -326,7 +326,8 @@ class LocalsHandler {
type = types.addPhiInput(
local,
types.allocatePhi(
- locals.block, local, types.narrowNotNull(currentType)),
+ locals.block, local, types.narrowNotNull(currentType),
+ isTry: locals.block is TryStatement),
type);
}
locals[local] = type;
@@ -345,8 +346,9 @@ class LocalsHandler {
// the right phi for it.
TypeInformation existing = tryBlock.locals.parent[local];
if (existing != null) {
- TypeInformation phiType =
- types.allocatePhi(tryBlock.locals.block, local, existing);
+ TypeInformation phiType = types.allocatePhi(
+ tryBlock.locals.block, local, existing,
+ isTry: tryBlock.locals.block is TryStatement);
TypeInformation inputType = types.addPhiInput(local, phiType, type);
tryBlock.locals.parent[local] = inputType;
}
@@ -505,7 +507,8 @@ class LocalsHandler {
if (myType == null) return;
TypeInformation newType;
if (seen != null && !seen.contains(local)) {
- newType = types.allocatePhi(locals.block, local, otherType);
+ newType = types.allocatePhi(locals.block, local, otherType,
+ isTry: locals.block is TryStatement);
seen.add(local);
} else {
newType = types.addPhiInput(local, myType, otherType);
@@ -533,7 +536,8 @@ class LocalsHandler {
void startLoop(Node loop) {
locals.forEachLocal((Local variable, TypeInformation type) {
- TypeInformation newType = types.allocateLoopPhi(loop, variable, type);
+ TypeInformation newType = types.allocateLoopPhi(loop, variable, type,
+ isTry: loop is TryStatement);
if (newType != type) {
locals[variable] = newType;
}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/inferrer_engine.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698