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

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

Issue 13865004: Fix issue https://code.google.com/p/dart/issues/detail?id=9251, by compiling for/in correctly. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/language/for_in2_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 21614)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -670,7 +670,7 @@
* Registers that [caller] calls [callee] with the given
* [arguments].
*/
- void registerCalledElement(Send send,
+ void registerCalledElement(Node node,
Selector selector,
Element caller,
Element callee,
@@ -696,7 +696,7 @@
}
if (selector.isSetter() && callee.isField()) {
- recordNonFinalFieldElementType(send, callee, arguments.positional[0]);
+ recordNonFinalFieldElementType(node, callee, arguments.positional[0]);
return;
} else if (selector.isGetter()) {
assert(arguments == null);
@@ -715,7 +715,7 @@
if (function.computeSignature(compiler).parameterCount == 0) return;
assert(arguments != null);
- bool isUseful = addArguments(send, callee, arguments);
+ bool isUseful = addArguments(node, callee, arguments);
if (hasAnalyzedAll && isUseful) {
updateArgumentsType(callee);
}
@@ -800,7 +800,7 @@
* Registers that [caller] calls an element matching [selector]
* with the given [arguments].
*/
- TypeMask registerCalledSelector(Send send,
+ TypeMask registerCalledSelector(Node node,
Selector selector,
TypeMask receiverType,
Element caller,
@@ -819,9 +819,9 @@
// whether [: element :] is a potential target for the type.
if (true) {
registerCalledElement(
- send, typedSelector, caller, element, arguments, inLoop);
+ node, typedSelector, caller, element, arguments, inLoop);
} else {
- unregisterCalledElement(send, selector, caller, element);
+ unregisterCalledElement(node, selector, caller, element);
}
if (!selector.isSetter()) {
TypeMask type = typeOfElementWithSelector(element, selector);
@@ -1595,7 +1595,7 @@
}
}
- TypeMask handlePlainAssignment(Send node,
+ TypeMask handlePlainAssignment(node,
ahe 2013/04/17 15:01:12 Type?
ngeoffray 2013/04/17 15:07:26 Done.
Element element,
Selector setterSelector,
TypeMask receiverType,
@@ -1622,7 +1622,7 @@
locals.update(element, rhsType);
}
- if (!Elements.isLocal(element)) {
+ if (node.asSend() != null && !Elements.isLocal(element)) {
// Recognize a constraint of the form [: field = other.field :].
// Note that we check if the right hand side is a local to
// recognize the situation [: var a = 42; this.a = a; :]. Our
@@ -2037,15 +2037,12 @@
checkIfExposesThis(
new TypedSelector(iteratorType, compiler.currentSelector));
}
- Element variable = elements[node.declaredIdentifier];
- Selector selector = elements.getSelector(node.declaredIdentifier);
- if (!Elements.isUnresolved(variable)) {
- locals.update(variable, inferrer.dynamicType);
- } else {
- handlePlainAssignment(new Send(), variable, selector,
- inferrer.dynamicType, inferrer.dynamicType,
- node.expression);
- }
+ Node identifier = node.declaredIdentifier;
+ Element variable = elements[identifier];
+ Selector selector = elements.getSelector(identifier);
+ handlePlainAssignment(identifier, variable, selector,
+ inferrer.dynamicType, inferrer.dynamicType,
+ node.expression);
loopLevel++;
do {
LocalsHandler saved = new LocalsHandler.from(locals);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/language/for_in2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698