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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart

Issue 111803002: Implement tracing for function expressions and statements, and infer types of parameters of these c… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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: sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart (revision 31020)
+++ sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart (working copy)
@@ -111,6 +111,10 @@
return type;
}
+ TypeMask allocateClosure(Node node, Element element) {
+ return functionType;
+ }
+
Selector newTypedSelector(TypeMask receiver, Selector selector) {
return new TypedSelector(receiver, selector);
}
@@ -566,10 +570,7 @@
// Record the types of captured non-boxed variables. Types of
// these variables may already be there, because of an analysis of
- // a previous closure. Note that analyzing the same closure multiple
- // times closure will refine the type of those variables, therefore
- // [:inferrer.typeOf[variable]:] is not necessarilly null, nor the
- // same as [newType].
+ // a previous closure.
ClosureClassMap nestedClosureData =
compiler.closureToClassMapper.getMappingForNestedFunction(node);
nestedClosureData.forEachCapturedVariable((variable, field) {
@@ -584,9 +585,21 @@
capturedVariables.add(variable);
});
- return types.functionType;
+ return inferrer.concreteTypes.putIfAbsent(node, () {
+ return types.allocateClosure(node, element);
+ });
}
+ T visitFunctionDeclaration(FunctionDeclaration node) {
+ Element element = elements[node];
+ T type = inferrer.concreteTypes.putIfAbsent(node.function, () {
+ return types.allocateClosure(node.function, element);
+ });
+ locals.update(element, type, node);
+ visit(node.function);
+ return type;
+ }
+
T visitLiteralList(LiteralList node) {
// We only set the type once. We don't need to re-visit the children
// when re-analyzing the node.

Powered by Google App Engine
This is Rietveld 408576698