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

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

Issue 15027014: Fix oversight in side effects computation and closure calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/language/closure_side_effect_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (revision 22612)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -831,12 +831,18 @@
sideEffects.setChangesInstanceProperty();
} else if (selector.isGetter()) {
sideEffects.setDependsOnInstancePropertyStore();
+ } else {
+ sideEffects.setAllSideEffects();
+ sideEffects.setDependsOnSomething();
}
} else {
if (selector.isSetter()) {
sideEffects.setChangesStaticProperty();
} else if (selector.isGetter()) {
sideEffects.setDependsOnStaticPropertyStore();
+ } else {
+ sideEffects.setAllSideEffects();
+ sideEffects.setDependsOnSomething();
}
}
} else if (callee.isGetter() && !selector.isGetter()) {
@@ -860,6 +866,8 @@
Selector constraint,
SideEffects sideEffects,
bool inLoop) {
+ updateSideEffects(sideEffects, selector, callee);
+
// Bailout for closure calls. We're not tracking types of
// arguments for closures.
if (callee.isInstanceMember() && selector.isClosureCall()) {
@@ -878,7 +886,6 @@
}
}
- updateSideEffects(sideEffects, selector, callee);
assert(isNotClosure(caller));
callee = callee.implementation;
if (!analyzeCount.containsKey(caller)) {
@@ -1948,16 +1955,6 @@
}
Selector selector = elements.getSelector(node);
ArgumentsTypes arguments = analyzeArguments(node.arguments);
- if (Elements.isUnresolved(element)
- || element.isGetter()
- || element.isField()) {
- if (element.isGetter()) {
- handleStaticSend(node, new Selector.getterFrom(selector),
- element, null);
- }
- return inferrer.dynamicType;
- }
-
if (!selector.applies(element, compiler)) return inferrer.dynamicType;
handleStaticSend(node, selector, element, arguments);
@@ -1965,8 +1962,12 @@
return inferrer.growableListType;
} else if (Elements.isFixedListConstructorCall(element, node, compiler)) {
return inferrer.fixedListType;
+ } else if (element.isFunction() || element.isConstructor()) {
+ return inferrer.returnTypeOfElement(element);
} else {
- return inferrer.returnTypeOfElement(element);
+ assert(element.isField() || element.isGetter());
+ // Closure call.
+ return inferrer.dynamicType;
}
}
@@ -2074,13 +2075,17 @@
TypeMask visitClosureSend(Send node) {
node.visitChildren(this);
Element element = elements[node];
+ Selector selector = elements.getSelector(node);
if (element != null && element.isFunction()) {
assert(Elements.isLocal(element));
// This only works for function statements. We need a
// more sophisticated type system with function types to support
// more.
+ inferrer.updateSideEffects(sideEffects, selector, element);
return inferrer.returnTypeOfElement(element);
}
+ sideEffects.setDependsOnSomething();
+ sideEffects.setAllSideEffects();
return inferrer.dynamicType;
}
« no previous file with comments | « no previous file | tests/language/closure_side_effect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698