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

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

Issue 422483002: Mix in [TreeElementMixin] only on nodes that need it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 4 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: sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
index 12aa1df03b56431deec0657ce3f76d6c60b3b85f..eb2466729a141e19a45be0e5fba2ddb7e6d7a275 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/simple_types_inferrer.dart
@@ -573,7 +573,7 @@ class SimpleTypeInferrerVisitor<T>
}
T visitFunctionExpression(ast.FunctionExpression node) {
- Element element = elements[node];
+ LocalFunctionElement element = elements.getFunctionDefinition(node);
// 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.
@@ -607,7 +607,7 @@ class SimpleTypeInferrerVisitor<T>
}
T visitFunctionDeclaration(ast.FunctionDeclaration node) {
- Element element = elements[node];
+ LocalFunctionElement element = elements.getFunctionDefinition(node.function);
T type = inferrer.concreteTypes.putIfAbsent(node.function, () {
return types.allocateClosure(node.function, element);
});
@@ -1228,30 +1228,31 @@ class SimpleTypeInferrerVisitor<T>
sideEffects,
inLoop);
}
-
- T visitReturn(ast.Return node) {
- if (node.isRedirectingFactoryBody) {
- Element element = elements[node.expression];
- if (Elements.isErroneousElement(element)) {
- recordReturnType(types.dynamicType);
- } else {
- // We don't create a selector for redirecting factories, and
- // the send is just a property access. Therefore we must
- // manually create the [ArgumentsTypes] of the call, and
- // manually register [analyzedElement] as a caller of [element].
- T mask = synthesizeForwardingCall(node.expression, element);
- recordReturnType(mask);
- }
+ T visitRedirectingFactoryBody(ast.RedirectingFactoryBody node) {
+ Element element = elements.getRedirectingTargetConstructor(node);
+ if (Elements.isErroneousElement(element)) {
+ recordReturnType(types.dynamicType);
} else {
- ast.Node expression = node.expression;
- recordReturnType(expression == null
- ? types.nullType
- : expression.accept(this));
+ // We don't create a selector for redirecting factories, and
+ // the send is just a property access. Therefore we must
+ // manually create the [ArgumentsTypes] of the call, and
+ // manually register [analyzedElement] as a caller of [element].
+ T mask = synthesizeForwardingCall(node.constructorReference, element);
+ recordReturnType(mask);
}
locals.seenReturnOrThrow = true;
return null;
}
+ T visitReturn(ast.Return node) {
+ ast.Node expression = node.expression;
+ recordReturnType(expression == null
+ ? types.nullType
+ : expression.accept(this));
+ locals.seenReturnOrThrow = true;
+ return null;
+ }
+
T visitForIn(ast.ForIn node) {
T expressionType = visit(node.expression);
Selector iteratorSelector = elements.getIteratorSelector(node);
@@ -1272,7 +1273,7 @@ class SimpleTypeInferrerVisitor<T>
}
ast.Node identifier = node.declaredIdentifier;
- Element element = elements[identifier];
+ Element element = elements.getForInVariable(node);
Selector selector = elements.getSelector(identifier);
T receiverType;

Powered by Google App Engine
This is Rietveld 408576698