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

Unified Diff: lib/compiler/implementation/typechecker.dart

Issue 10917290: DartType equals converted to operator == and tested. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
Index: lib/compiler/implementation/typechecker.dart
diff --git a/lib/compiler/implementation/typechecker.dart b/lib/compiler/implementation/typechecker.dart
index c34ea42966ea076133ada47ab8eda3895ad6cb9f..fa636ac721cd153d3947002e4f9080daa76f73f9 100644
--- a/lib/compiler/implementation/typechecker.dart
+++ b/lib/compiler/implementation/typechecker.dart
@@ -41,7 +41,7 @@ abstract class DartType implements Hashable {
*/
abstract DartType unalias(Compiler compiler);
- abstract bool equals(other);
+ abstract bool operator ==(other);
}
class TypeVariableType implements DartType {
@@ -55,7 +55,7 @@ class TypeVariableType implements DartType {
int hashCode() => 17 * element.hashCode();
- bool equals(other) {
+ bool operator ==(other) {
if (other is !TypeVariableType) return false;
return other.element == element;
ahe 2012/09/17 08:19:58 ===
Johnni Winther 2012/09/18 08:14:30 Done.
}
@@ -87,7 +87,7 @@ class StatementType implements DartType {
int hashCode() => 17 * stringName.hashCode();
- bool equals(other) {
+ bool operator ==(other) {
if (other is !StatementType) return false;
return other.stringName == stringName;
}
@@ -104,7 +104,7 @@ class VoidType implements DartType {
int hashCode() => 1729;
- bool equals(other) => other is VoidType;
+ bool operator ==(other) => other is VoidType;
String toString() => name.slowToString();
}
@@ -142,8 +142,9 @@ class InterfaceType implements DartType {
return hash;
}
- bool equals(other) {
+ bool operator ==(other) {
if (other is !InterfaceType) return false;
+ if (element != other.element) return false;
ahe 2012/09/17 08:19:58 !==
Johnni Winther 2012/09/18 08:14:30 Done.
return arguments == other.arguments;
}
}
@@ -194,7 +195,7 @@ class FunctionType implements DartType {
return hash;
}
- bool equals(other) {
+ bool operator ==(other) {
if (other is !FunctionType) return false;
return returnType == other.returnType
&& parameterTypes == other.parameterTypes;
@@ -229,9 +230,10 @@ class TypedefType implements DartType {
int hashCode() => 17 * element.hashCode();
- bool equals(other) {
+ bool operator ==(other) {
if (other is !TypedefType) return false;
- return other.element == element;
+ if (element != other.element) return false;
ahe 2012/09/17 08:19:58 !==
Johnni Winther 2012/09/18 08:14:30 Done.
+ return typeArguments == other.typeArguments;
}
}
« no previous file with comments | « no previous file | lib/compiler/implementation/util/link.dart » ('j') | tests/compiler/dart2js/type_equals_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698