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

Unified Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 9956012: Don't use === instead of equality-method call for user class constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | tests/language/src/CompileTimeConstantNTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index 03d2fb560490aa5ae50a7dcf06f92913bdcaa408..0ce41919a7a9e36b3abb1f8805cbbf3ce5fd4b7f 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -1843,7 +1843,12 @@ class HEquals extends HRelational {
accept(HVisitor visitor) => visitor.visitEquals(this);
bool get builtin() {
- return (left.isNumber() && right.isNumber()) || left is HConstant;
+ if (left.isNumber() && right.isNumber()) return true;
+ if (left is !HConstant) return false;
+ HConstant leftConstant = left;
+ // TODO(floitsch): we can do better if we know that the constant does not
+ // have the equality operator overridden.
+ return !leftConstant.constant.isConstructedObject();
}
HType computeType() => HType.BOOLEAN;
« no previous file with comments | « no previous file | tests/language/src/CompileTimeConstantNTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698