Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 1091343002: Fix tests in bots (handle 'is' as an invalid binary operator) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698