Revert "Make Comparable generic."

This reverts commit dd714db881a0ad63eaa1e5491e93dd8843eb5929.

R=lrn@google.com
BUG=

Review URL: https://codereview.chromium.org//12298027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18657 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
kasperl@google.com 2013-02-19 08:06:03 +00:00
parent a0f22b77be
commit d4feeb4910
10 changed files with 16 additions and 14 deletions

View file

@ -288,7 +288,7 @@ class int32 implements intx {
return _i == _convert(other);
}
int compareTo(other) {
int compareTo(Comparable other) {
if (other is int64) {
return this.toInt64().compareTo(other);
}

View file

@ -247,7 +247,7 @@ class LoggerHandlerList {
* own level, make sure you use a value between those used in [Level.ALL] and
* [Level.OFF].
*/
class Level implements Comparable<Level> {
class Level implements Comparable {
// TODO(sigmund): mark name/value as 'const' when the language supports it.
final String name;

View file

@ -271,7 +271,7 @@ class BasicRule extends SerializationRule {
* This represents a field in an object. It is intended to be used as part of
* a [_FieldList].
*/
abstract class _Field implements Comparable<_Field> {
abstract class _Field implements Comparable {
/** The FieldList that contains us. */
final _FieldList fieldList;

View file

@ -26,7 +26,7 @@ class SplayTreeNode<K, V> {
* This implementation is a Dart version of the JavaScript
* implementation in the V8 project.
*/
class SplayTreeMap<K extends Comparable<K>, V> implements Map<K, V> {
class SplayTreeMap<K extends Comparable, V> implements Map<K, V> {
// The root node of the splay tree. It will contain either the last
// element inserted, or the last element looked up.

View file

@ -22,7 +22,7 @@ typedef int Comparator<T>(T a, T b);
/**
* Interface used by types that have an intrinsic ordering.
*/
abstract class Comparable<T extends Comparable<T>> {
abstract class Comparable {
/**
* Compares this object to another [Comparable]
*
@ -31,7 +31,7 @@ abstract class Comparable<T extends Comparable<T>> {
* May throw an [ArgumentError] if [other] is of a type that
* is not comparable to [:this:].
*/
int compareTo(T other);
int compareTo(Comparable other);
/**
* Compare one comparable to another.

View file

@ -8,7 +8,7 @@ part of dart.core;
* Deprecated class. Please use [DateTime] instead.
*/
@deprecated
abstract class Date implements Comparable<Date> {
abstract class Date implements Comparable {
// Weekday constants that are returned by [weekday] method:
static const int MON = 1;
static const int TUE = 2;

View file

@ -7,7 +7,7 @@ part of dart.core;
/**
* All numbers in dart are instances of [num].
*/
abstract class num implements Comparable<num> {
abstract class num implements Comparable {
/** Addition operator. */
num operator +(num other);

View file

@ -6,7 +6,7 @@
/**
* Represents a file of source code.
*/
class SourceFile implements Comparable<SourceFile> {
class SourceFile implements Comparable {
// TODO(terry): This filename for in memory buffer. May need to rework if
// filename is used for more than informational.
static String IN_MEMORY_FILE = '<buffer>';
@ -132,7 +132,7 @@ class SourceFile implements Comparable<SourceFile> {
* work.
*/
// TODO(jmesserly): Rename to Span - but first write cool refactoring tool
class SourceSpan implements Comparable<SourceSpan> {
class SourceSpan implements Comparable {
/** The [SourceFile] that contains this span. */
final SourceFile file;

View file

@ -85,7 +85,7 @@ class Package {
/// different directories that happen to contain identical packages. For
/// example, the same package may be available from multiple sources. As far as
/// Pub is concerned, those packages are different.
class PackageId implements Comparable<PackageId> {
class PackageId implements Comparable {
/// The name of the package being identified.
final String name;
@ -129,7 +129,9 @@ class PackageId implements Comparable<PackageId> {
return "$name $version from $source";
}
int compareTo(PackageId other) {
int compareTo(Comparable other) {
if (other is! PackageId) throw new ArgumentError(other);
var sourceComp = source.name.compareTo(other.source.name);
if (sourceComp != 0) return sourceComp;

View file

@ -6,7 +6,7 @@
/**
* Represents a file of source code.
*/
class SourceFile implements Comparable<SourceFile> {
class SourceFile implements Comparable {
// TODO(terry): This filename for in memory buffer. May need to rework if
// filename is used for more than informational.
static String IN_MEMORY_FILE = '<buffer>';
@ -132,7 +132,7 @@ class SourceFile implements Comparable<SourceFile> {
* work.
*/
// TODO(jmesserly): Rename to Span - but first write cool refactoring tool
class SourceSpan implements Comparable<SourceSpan> {
class SourceSpan implements Comparable {
/** The [SourceFile] that contains this span. */
final SourceFile file;