Chromium Code Reviews| Index: pkg/compiler/lib/src/compile_time_constants.dart |
| diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart |
| index 5932926d2c8af57c4624c31a9ac1d44ac231f540..40a1bffa1ce654f49c4ce0d9424c9143d36b5a30 100644 |
| --- a/pkg/compiler/lib/src/compile_time_constants.dart |
| +++ b/pkg/compiler/lib/src/compile_time_constants.dart |
| @@ -592,28 +592,31 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
| Operator node = send.selector.asOperator(); |
| BinaryOperator operator = BinaryOperator.parse(node.source); |
| ConstantValue folded = null; |
| - switch (operator.kind) { |
| - case BinaryOperatorKind.EQ: |
| - if (leftValue.isPrimitive && rightValue.isPrimitive) { |
| - folded = constantSystem.equal.fold(leftValue, rightValue); |
| - } |
| - break; |
| - case BinaryOperatorKind.NOT_EQ: |
| - if (leftValue.isPrimitive && rightValue.isPrimitive) { |
| - BoolConstantValue areEquals = |
| - constantSystem.equal.fold(leftValue, rightValue); |
| - if (areEquals == null) { |
| - folded = null; |
| - } else { |
| - folded = areEquals.negate(); |
| + // operator is null when `node=="is"` |
| + if (operator != null) { |
| + switch (operator.kind) { |
|
Siggi Cherem (dart-lang)
2015/04/17 19:19:23
FYI - no changes below besides indentation
Johnni Winther
2015/04/17 20:31:15
Thanks. I think `node=="as"` also ends here.
|
| + case BinaryOperatorKind.EQ: |
| + if (leftValue.isPrimitive && rightValue.isPrimitive) { |
| + folded = constantSystem.equal.fold(leftValue, rightValue); |
| } |
| - } |
| - break; |
| - default: |
| - BinaryOperation operation = constantSystem.lookupBinary(operator); |
| - if (operation != null) { |
| - folded = operation.fold(leftValue, rightValue); |
| - } |
| + break; |
| + case BinaryOperatorKind.NOT_EQ: |
| + if (leftValue.isPrimitive && rightValue.isPrimitive) { |
| + BoolConstantValue areEquals = |
| + constantSystem.equal.fold(leftValue, rightValue); |
| + if (areEquals == null) { |
| + folded = null; |
| + } else { |
| + folded = areEquals.negate(); |
| + } |
| + } |
| + break; |
| + default: |
| + BinaryOperation operation = constantSystem.lookupBinary(operator); |
| + if (operation != null) { |
| + folded = operation.fold(leftValue, rightValue); |
| + } |
| + } |
| } |
| if (folded == null) { |
| return signalNotCompileTimeConstant(send); |