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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 21065002: Treat ambiguous types as malformed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated. Created 7 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 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 part of ssa; 5 part of ssa;
6 6
7 abstract class HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitBailoutTarget(HBailoutTarget node); 9 R visitBailoutTarget(HBailoutTarget node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 } 1110 }
1111 1111
1112 HInstruction convertType(Compiler compiler, DartType type, int kind) { 1112 HInstruction convertType(Compiler compiler, DartType type, int kind) {
1113 if (type == null) return this; 1113 if (type == null) return this;
1114 type = type.unalias(compiler); 1114 type = type.unalias(compiler);
1115 // Only the builder knows how to create [HTypeConversion] 1115 // Only the builder knows how to create [HTypeConversion]
1116 // instructions with generics. It has the generic type context 1116 // instructions with generics. It has the generic type context
1117 // available. 1117 // available.
1118 assert(type.kind != TypeKind.TYPE_VARIABLE); 1118 assert(type.kind != TypeKind.TYPE_VARIABLE);
1119 assert(type.isRaw || type.kind == TypeKind.FUNCTION); 1119 assert(type.isRaw || type.kind == TypeKind.FUNCTION);
1120 if (type.containsAmbiguousTypes) {
1121 return new HTypeConversion(type, kind, HType.UNKNOWN, this);
1122 }
1123 if (type.treatAsDynamic) return this; 1120 if (type.treatAsDynamic) return this;
1124 if (identical(type.element, compiler.objectClass)) return this; 1121 if (identical(type.element, compiler.objectClass)) return this;
1125 if (type.kind != TypeKind.INTERFACE) { 1122 if (type.kind != TypeKind.INTERFACE) {
1126 return new HTypeConversion(type, kind, HType.UNKNOWN, this); 1123 return new HTypeConversion(type, kind, HType.UNKNOWN, this);
1127 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { 1124 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) {
1128 // Boolean conversion checks work on non-nullable booleans. 1125 // Boolean conversion checks work on non-nullable booleans.
1129 return new HTypeConversion(type, kind, HType.BOOLEAN, this); 1126 return new HTypeConversion(type, kind, HType.BOOLEAN, this);
1130 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) { 1127 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) {
1131 throw 'creating compound check to $type (this = ${this})'; 1128 throw 'creating compound check to $type (this = ${this})';
1132 } else { 1129 } else {
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 HBasicBlock get start => expression.start; 2711 HBasicBlock get start => expression.start;
2715 HBasicBlock get end { 2712 HBasicBlock get end {
2716 // We don't create a switch block if there are no cases. 2713 // We don't create a switch block if there are no cases.
2717 assert(!statements.isEmpty); 2714 assert(!statements.isEmpty);
2718 return statements.last.end; 2715 return statements.last.end;
2719 } 2716 }
2720 2717
2721 bool accept(HStatementInformationVisitor visitor) => 2718 bool accept(HStatementInformationVisitor visitor) =>
2722 visitor.visitSwitchInfo(this); 2719 visitor.visitSwitchInfo(this);
2723 } 2720 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698