Index: pkg/compiler/lib/src/cps_ir/optimizers.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/optimizers.dart b/pkg/compiler/lib/src/cps_ir/optimizers.dart |
index d10823adbd9be674488fca1b8cb1b29c12aa1d13..1ffe52699bae92acd8850d4a7eac9f2c2ce55b8f 100644 |
--- a/pkg/compiler/lib/src/cps_ir/optimizers.dart |
+++ b/pkg/compiler/lib/src/cps_ir/optimizers.dart |
@@ -37,3 +37,11 @@ bool isFalsyConstant(ConstantValue value) { |
value.isNaN || |
value is StringConstantValue && value.primitiveValue.isEmpty; |
} |
+ |
+/// Returns true if [value] satisfies a branching condition with the |
+/// given strictness. |
+/// |
+/// For non-strict, this is the opposite of [isFalsyConstant]. |
+bool isTruthyConstant(ConstantValue value, {bool strict: false}) { |
+ return strict ? value.isTrue : !isFalsyConstant(value); |
+} |