Index: pkg/compiler/lib/src/constant_system_dart.dart |
diff --git a/pkg/compiler/lib/src/constant_system_dart.dart b/pkg/compiler/lib/src/constant_system_dart.dart |
index 4a15ac9aff7cba10487fe95cb9a8086619ee39ea..c2c819ed7c53988d3abc9be1107861a5e94b6eea 100644 |
--- a/pkg/compiler/lib/src/constant_system_dart.dart |
+++ b/pkg/compiler/lib/src/constant_system_dart.dart |
@@ -332,6 +332,16 @@ class IdentityOperation implements BinaryOperation { |
apply(left, right) => identical(left, right); |
} |
+class IfNullOperation implements BinaryOperation { |
+ final String name = '??'; |
+ const IfNullOperation(); |
+ ConstantValue fold(ConstantValue left, ConstantValue right) { |
+ if (left.isNull) return right; |
+ return left; |
+ } |
+ apply(left, right) => left ?? right; |
+} |
+ |
abstract class CodeUnitAtOperation implements BinaryOperation { |
final String name = 'charCodeAt'; |
const CodeUnitAtOperation(); |
@@ -382,6 +392,7 @@ class DartConstantSystem extends ConstantSystem { |
final greaterEqual = const GreaterEqualOperation(); |
final greater = const GreaterOperation(); |
final identity = const IdentityOperation(); |
+ final ifNull = const IfNullOperation(); |
final lessEqual = const LessEqualOperation(); |
final less = const LessOperation(); |
final modulo = const ModuloOperation(); |