| Index: pkg/compiler/lib/src/kernel/element_map.dart
|
| diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
|
| index 59aeb59e8224d14fdb8b521392a91dbcd62a3638..13e11413a824ef232e09e5eb942836d3c2e2af73 100644
|
| --- a/pkg/compiler/lib/src/kernel/element_map.dart
|
| +++ b/pkg/compiler/lib/src/kernel/element_map.dart
|
| @@ -148,7 +148,7 @@ abstract class KernelToElementMap {
|
|
|
| /// Computes the [ConstantValue] for the constant [expression].
|
| ConstantValue getConstantValue(ir.Expression expression,
|
| - {bool requireConstant: true});
|
| + {bool requireConstant: true, bool implicitNull: false});
|
|
|
| /// Returns the `noSuchMethod` [FunctionEntity] call from a
|
| /// `super.noSuchMethod` invocation within [cls].
|
| @@ -243,9 +243,18 @@ abstract class KernelToElementMapMixin implements KernelToElementMap {
|
| }
|
|
|
| ConstantValue getConstantValue(ir.Expression node,
|
| - {bool requireConstant: true}) {
|
| - ConstantExpression constant =
|
| - new Constantifier(this, requireConstant: requireConstant).visit(node);
|
| + {bool requireConstant: true, bool implicitNull: false}) {
|
| + ConstantExpression constant;
|
| + if (node == null) {
|
| + if (!implicitNull) {
|
| + throw new SpannableAssertionFailure(
|
| + CURRENT_ELEMENT_SPANNABLE, 'No expression for constant.');
|
| + }
|
| + constant = new NullConstantExpression();
|
| + } else {
|
| + constant =
|
| + new Constantifier(this, requireConstant: requireConstant).visit(node);
|
| + }
|
| if (constant == null) {
|
| if (requireConstant) {
|
| throw new UnsupportedError(
|
|
|