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

Unified Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 1259473005: Fix boolean conversion bug in dart2js + update JSRegExp accordingly. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment Created 5 years, 5 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 | « pkg/compiler/lib/src/ssa/builder.dart ('k') | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b23f32d6ecc357c67ab91285fcce0199de06a25d 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) {
+ // Don't omit a boolean conversion (which doesn't allow `null`) unless
+ // this type conversion is already a boolean conversion.
+ if (kind != BOOLEAN_CONVERSION_CHECK ||
+ isBooleanConversionCheck) {
+ return this;
+ }
+ }
return super.convertType(compiler, type, kind);
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | sdk/lib/_internal/js_runtime/lib/regexp_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698