Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| index b84a3786c9f7e2776b3731a97ca3d1d63889649b..e6e8a9c5cd1d878d7d5f439002f859e248d46062 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| @@ -2023,6 +2023,9 @@ abstract class IrBuilder { |
| {bool isTypeTest: false, |
| bool isNotCheck: false}); |
| + /// Creates a type test checking whether [value] is null. |
| + ir.Primitive buildChecknull(ir.Primitive value); |
| + |
| /// Create a lazy and/or expression. [leftValue] is the value of the left |
| /// operand and [buildRightValue] is called to process the value of the right |
| /// operand in the context of its own [IrBuilder]. |
| @@ -2323,6 +2326,12 @@ class DartIrBuilder extends IrBuilder { |
| (k) => new ir.TypeOperator(receiver, type, k, isTypeTest: isTypeTest)); |
| return isNotCheck ? buildNegation(check) : check; |
| } |
| + |
| + @override |
| + ir.Primitive buildCheckNull(ir.Primitive value) { |
|
Johnni Winther
2015/05/29 10:23:24
Move the implementation to IrBuilder.
Siggi Cherem (dart-lang)
2015/05/29 18:14:05
After addressing Kevin's comment, this moved just
|
| + assert(isOpen); |
| + return addPrimitive(new ir.Identical(value, buildNullConstant())); |
|
Kevin Millikin (Google)
2015/05/29 11:02:03
Identical is a 'JS specific' IR primitive, which m
Siggi Cherem (dart-lang)
2015/05/29 18:14:05
Great points - I moved most of the implementation
Siggi Cherem (dart-lang)
2015/05/29 19:02:02
Just synced and noticed that DartIrBuilder is gone
|
| + } |
| } |
| /// State shared between JsIrBuilders within the same function. |
| @@ -2695,6 +2704,11 @@ class JsIrBuilder extends IrBuilder { |
| return isNotCheck ? buildNegation(check) : check; |
| } |
| + @override |
| + ir.Primitive buildCheckNull(ir.Primitive value) { |
|
Johnni Winther
2015/05/29 10:23:24
Remove this.
Siggi Cherem (dart-lang)
2015/05/29 18:14:05
Acknowledged.
|
| + assert(isOpen); |
| + return addPrimitive(new ir.Identical(value, buildNullConstant())); |
|
Kevin Millikin (Google)
2015/05/29 11:02:03
This is completely safe, but since buildNullConsta
Siggi Cherem (dart-lang)
2015/05/29 18:14:05
Done.
|
| + } |
| } |