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

Side by Side Diff: lib/compiler/implementation/ssa/types.dart

Issue 10411094: Fix bug in combination of bounded and exact types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 abstract class HType { 5 abstract class HType {
6 const HType(); 6 const HType();
7 7
8 /** 8 /**
9 * Returns an [HType] that represents [type] and all types that have 9 * Returns an [HType] that represents [type] and all types that have
10 * [type] as supertype. 10 * [type] as supertype.
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 Element lookupMember(SourceString name) { 642 Element lookupMember(SourceString name) {
643 ClassElement classElement = type.element; 643 ClassElement classElement = type.element;
644 return classElement.lookupMember(name); 644 return classElement.lookupMember(name);
645 } 645 }
646 646
647 HType combine(HType other) { 647 HType combine(HType other) {
648 if (other.isExact()) { 648 if (other.isExact()) {
649 HExactType concrete = other; 649 HExactType concrete = other;
650 if (this.type === concrete.type) return this; 650 if (this.type === concrete.type) return this;
651 } else if (other is HBoundedType) {
652 HBoundedType bounded = other;
653 if (this.type === bounded.type) return other;
ngeoffray 2012/05/23 14:09:45 This is OK for the union but not for the intersect
karlklose 2012/05/24 12:37:49 Done.
651 } 654 }
652 if (other.isUnknown()) return this; 655 if (other.isUnknown()) return this;
653 return HType.CONFLICTING; 656 return HType.CONFLICTING;
654 } 657 }
655 658
656 HType union(HType other) { 659 HType union(HType other) {
657 if (other.isNull()) return HType.CONFLICTING; 660 if (other.isNull()) return HType.CONFLICTING;
658 return combine(other); 661 return combine(other);
659 } 662 }
660 } 663 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 HType intersection(HType other) { 723 HType intersection(HType other) {
721 if (other.isString()) return HType.STRING; 724 if (other.isString()) return HType.STRING;
722 if (other.isStringOrNull()) { 725 if (other.isStringOrNull()) {
723 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING; 726 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING;
724 } 727 }
725 if (other.isReadableArray()) return HType.CONFLICTING; 728 if (other.isReadableArray()) return HType.CONFLICTING;
726 if (other.isIndexablePrimitive()) return HType.STRING; 729 if (other.isIndexablePrimitive()) return HType.STRING;
727 return super.intersection(other); 730 return super.intersection(other);
728 } 731 }
729 } 732 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/switch_this_test.dart » ('j') | tests/language/switch_this_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698