| 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 da2fb5f80f9f9511f6868783290a3dfc97f1877a..321d88f2147e52bcfde427e4d5d531d83d216e22 100644
|
| --- a/pkg/compiler/lib/src/kernel/element_map.dart
|
| +++ b/pkg/compiler/lib/src/kernel/element_map.dart
|
| @@ -721,22 +721,26 @@ class Constantifier extends ir.ExpressionVisitor<ConstantExpression> {
|
|
|
| @override
|
| ConstantExpression visitLet(ir.Let node) {
|
| - if (node.body is ir.ConditionalExpression) {
|
| - ir.ConditionalExpression conditional = node.body;
|
| - if (conditional.condition is ir.MethodInvocation) {
|
| - ir.MethodInvocation methodInvocation = conditional.condition;
|
| - if (methodInvocation.name.name == BinaryOperator.EQ.name &&
|
| - methodInvocation.receiver is ir.VariableGet &&
|
| - methodInvocation.arguments.positional.single is ir.NullLiteral &&
|
| - conditional.otherwise is ir.VariableGet) {
|
| - ir.VariableGet variableGet1 = methodInvocation.receiver;
|
| - ir.VariableGet variableGet2 = conditional.otherwise;
|
| - if (variableGet1.variable == node.variable &&
|
| - variableGet2.variable == node.variable) {
|
| + ir.Expression body = node.body;
|
| + if (body is ir.ConditionalExpression) {
|
| + ir.Expression condition = body.condition;
|
| + if (condition is ir.MethodInvocation) {
|
| + ir.Expression receiver = condition.receiver;
|
| + ir.Expression otherwise = body.otherwise;
|
| + if (condition.name.name == BinaryOperator.EQ.name &&
|
| + receiver is ir.VariableGet &&
|
| + condition.arguments.positional.single is ir.NullLiteral &&
|
| + otherwise is ir.VariableGet) {
|
| + if (receiver.variable == node.variable &&
|
| + otherwise.variable == node.variable) {
|
| // We have <left> ?? <right> encoded as:
|
| // let #1 = <left> in #1 == null ? <right> : #1
|
| ConstantExpression left = visit(node.variable.initializer);
|
| - ConstantExpression right = visit(conditional.then);
|
| + ConstantExpression right = visit(body.then);
|
| + // TODO(johnniwinther): Remove [IF_NULL] binary constant expression
|
| + // when the resolver is removed; then we no longer need the
|
| + // expressions to be structurally equivalence for equivalence
|
| + // testing.
|
| return new BinaryConstantExpression(
|
| left, BinaryOperator.IF_NULL, right);
|
| }
|
|
|