Index: pkg/compiler/lib/src/ssa/nodes.dart |
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart |
index e947317f22a4b8b39996a5233686b4d8e57b892e..80c7177b521aed56ebcbb3b64c6d212bfa51e78f 100644 |
--- a/pkg/compiler/lib/src/ssa/nodes.dart |
+++ b/pkg/compiler/lib/src/ssa/nodes.dart |
@@ -1321,6 +1321,15 @@ class HRef extends HInstruction { |
HInstruction get value => inputs[0]; |
@override |
+ HInstruction convertType(Compiler compiler, DartType type, int kind) { |
+ HInstruction converted = value.convertType(compiler, type, kind); |
+ if (converted == value) return this; |
+ HTypeConversion conversion = converted; |
+ conversion.inputs[0] = this; |
+ return conversion; |
+ } |
+ |
+ @override |
accept(HVisitor visitor) => visitor.visitRef(this); |
String toString() => 'HRef(${value})'; |
@@ -2743,7 +2752,14 @@ class HTypeConversion extends HCheck { |
HInstruction get context => inputs[1]; |
HInstruction convertType(Compiler compiler, DartType type, int kind) { |
- if (typeExpression == type) return this; |
+ if (typeExpression == type) { |
+ if (kind != BOOLEAN_CONVERSION_CHECK || |
+ isBooleanConversionCheck) { |
+ // Don't omit a boolean conversion (which doesn't allow `null`) unless |
herhut
2015/07/27 11:54:49
Move this comment above the conditional? It is the
Johnni Winther
2015/07/27 12:17:26
Done.
|
+ // this type conversion is already a boolean conversion. |
+ return this; |
+ } |
+ } |
return super.convertType(compiler, type, kind); |
} |