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

Unified Diff: frog/leg/operations.dart

Issue 9866027: Error out on compile-time constants if equality is tested on bad types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 9 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 | « frog/leg/compile_time_constants.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/operations.dart
diff --git a/frog/leg/operations.dart b/frog/leg/operations.dart
index 8ad5427d01f1e2d320ded4f8f4d14d8bcd74c2a2..ff66987d2415e711220c0456508ea2924c093e01 100644
--- a/frog/leg/operations.dart
+++ b/frog/leg/operations.dart
@@ -267,6 +267,11 @@ class EqualsOperation implements BinaryOperation {
NumConstant rightNum = right;
return new BoolConstant(leftNum.value == rightNum.value);
}
+ if (left.isConstructedObject()) {
+ // Unless we know that the user-defined object does not implement the
+ // equality operator we cannot fold here.
+ return null;
+ }
return new BoolConstant(left == right);
}
}
« no previous file with comments | « frog/leg/compile_time_constants.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698