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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/container_tracer.dart

Issue 24644004: Fix bug in container tracer, where a local would be updated with the wrong type in the expression `… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/list_tracer3_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library container_tracer; 5 library container_tracer;
6 6
7 import '../dart2jslib.dart' hide Selector, TypedSelector; 7 import '../dart2jslib.dart' hide Selector, TypedSelector;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../tree/tree.dart'; 9 import '../tree/tree.dart';
10 import '../universe/universe.dart'; 10 import '../universe/universe.dart';
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 tracer.addEscapingElement(analyzedElement); 581 tracer.addEscapingElement(analyzedElement);
582 } else if (element != null 582 } else if (element != null
583 && (!element.isInstanceMember() || visitingInitializers)) { 583 && (!element.isInstanceMember() || visitingInitializers)) {
584 // A local, a static element, or a field in an initializer. 584 // A local, a static element, or a field in an initializer.
585 tracer.addEscapingElement(element); 585 tracer.addEscapingElement(element);
586 } else { 586 } else {
587 tracer.addSettersToAnalysis(setterSelector); 587 tracer.addSettersToAnalysis(setterSelector);
588 } 588 }
589 } 589 }
590 590
591 if (Elements.isLocal(element)) { 591 TypeMask result;
592 locals.update(element, rhsType, node);
593 }
594
595 if (node.isPostfix) { 592 if (node.isPostfix) {
596 // We don't check if [getterSelector] could be the container because 593 // We don't check if [getterSelector] could be the container because
597 // a list++ will always throw. 594 // a list++ will always throw.
598 return inferrer.returnTypeOfSelector(getterSelector); 595 result = inferrer.returnTypeOfSelector(getterSelector);
599 } else if (op != '=') { 596 } else if (op != '=') {
600 // We don't check if [getterSelector] could be the container because 597 // We don't check if [getterSelector] could be the container because
601 // a list += 42 will always throw. 598 // a list += 42 will always throw.
602 return inferrer.returnTypeOfSelector(operatorSelector); 599 result = inferrer.returnTypeOfSelector(operatorSelector);
603 } else { 600 } else {
604 if (isValueEscaping) { 601 if (isValueEscaping) {
605 escaping = true; 602 escaping = true;
606 } 603 }
607 return rhsType; 604 result = rhsType;
608 } 605 }
606
607 if (Elements.isLocal(element)) {
608 locals.update(element, result, node);
609 }
610
611 return result;
609 } 612 }
610 613
611 TypeMask visitSuperSend(Send node) { 614 TypeMask visitSuperSend(Send node) {
612 Element element = elements[node]; 615 Element element = elements[node];
613 if (!node.isPropertyAccess) { 616 if (!node.isPropertyAccess) {
614 visitArguments(node.arguments, element); 617 visitArguments(node.arguments, element);
615 } 618 }
616 619
617 if (tracer.couldBeTheList(element)) { 620 if (tracer.couldBeTheList(element)) {
618 escaping = true; 621 escaping = true;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 Element element = elements[identifier]; 798 Element element = elements[identifier];
796 if (Elements.isLocal(element)) { 799 if (Elements.isLocal(element)) {
797 locals.update(element, currentType, node); 800 locals.update(element, currentType, node);
798 } 801 }
799 802
800 return handleLoop(node, () { 803 return handleLoop(node, () {
801 visit(node.body); 804 visit(node.body);
802 }); 805 });
803 } 806 }
804 } 807 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/list_tracer3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698