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

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

Issue 3008083002: Handle variable set in inferrer (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/inference/data/locals.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index 659ac98e239ecf5a29210ab8a31100e2fccaa413..a2739301b5b2f48208d8813356396f22f69f42cd 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -149,12 +149,21 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
}
@override
- TypeInformation defaultExpression(ir.Expression expression) {
- // TODO(efortuna): Remove when more is implemented.
+ TypeInformation defaultExpression(ir.Expression node) {
+ // TODO(johnniwinther): Make this throw to assert that all expressions are
+ // handled.
return _types.dynamicType;
}
@override
+ TypeInformation defaultStatement(ir.Statement node) {
+ // TODO(johnniwinther): Make this throw to assert that all statements are
+ // handled.
+ node.visitChildren(this);
+ return null;
+ }
+
+ @override
TypeInformation visitNullLiteral(ir.NullLiteral literal) {
return _types.nullType;
}
@@ -236,4 +245,13 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
TypeInformation visitVariableGet(ir.VariableGet node) {
return _locals.use(_localsMap.getLocalVariable(node.variable));
}
+
+ @override
+ TypeInformation visitVariableSet(ir.VariableSet node) {
+ Local local = _localsMap.getLocalVariable(node.variable);
+ DartType type = _localsMap.getLocalType(_elementMap, local);
+ TypeInformation rhsType = visit(node.value);
+ _locals.update(local, rhsType, node, type);
+ return rhsType;
+ }
}
« no previous file with comments | « no previous file | tests/compiler/dart2js/inference/data/locals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698