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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/dart_types.dart

Issue 18181013: Remove weird operator== implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | dart/tests/compiler/dart2js/analyze_api_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/dart_types.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/dart_types.dart b/dart/sdk/lib/_internal/compiler/implementation/dart_types.dart
index fd9ed6332f635feec4f5ec9ea1e389ff90b904ab..873b926fb7b2b9721d63cc94350db40132fd4012 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -94,10 +94,6 @@ abstract class DartType {
*/
bool forEachMalformedType(bool f(MalformedType type)) => true;
- // TODO(ahe): This is implicitly inherited from Object. What is the purpose
- // of duplicating it here?
- bool operator ==(other);
-
/**
* Is [: true :] if this type has no explict type arguments.
*/
@@ -346,10 +342,6 @@ class MalformedType extends DartType {
return visitor.visitMalformedType(this, argument);
}
- // TODO(ahe): This is the default implementation that would be inherited if
- // DartType didn't declare an abstract method. What is the purpose?
- bool operator ==(other) => identical(this, other);
-
String toString() {
var sb = new StringBuffer();
if (typeArguments != null) {
@@ -456,7 +448,8 @@ abstract class GenericType extends DartType {
bool operator ==(other) {
if (other is !GenericType) return false;
- return identical(element, other.element)
+ return kind == other.kind
+ && element == other.element
&& typeArguments == other.typeArguments;
}
@@ -465,7 +458,6 @@ abstract class GenericType extends DartType {
GenericType asRaw() => element.rawType;
}
-// TODO(johnniwinther): Add common supertype for InterfaceType and TypedefType.
class InterfaceType extends GenericType {
final ClassElement element;
@@ -553,17 +545,6 @@ class InterfaceType extends GenericType {
return null;
}
- bool operator ==(other) {
- // TODO(johnniwinther,karlklose): This is a bad implementation of
- // operator==. This implementation is not compatible with the
- // implementation in the superclass: another subclass of GenericType might
- // compare equal to an instance of this class if the other subclass forgets
- // to implement operator==. This is brittle and easy to avoid, ask ahe@
- // for concrete suggestions.
- if (other is !InterfaceType) return false;
- return super == other;
- }
-
int get hashCode => super.hashCode;
InterfaceType asRaw() => super.asRaw();
@@ -826,12 +807,6 @@ class TypedefType extends GenericType {
return definition.subst(typeArguments, declaration.typeArguments);
}
- bool operator ==(other) {
- // TODO(johnniwinther,karlklose): See InterfaceType.operator==.
- if (other is !TypedefType) return false;
- return super == other;
- }
-
int get hashCode => super.hashCode;
TypedefType asRaw() => super.asRaw();
« no previous file with comments | « no previous file | dart/tests/compiler/dart2js/analyze_api_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698