Chromium Code Reviews| Index: frog/type.dart |
| diff --git a/frog/type.dart b/frog/type.dart |
| index 328dd75f97b4df5aea170236baa912616321dcac..8eb594ff67cf8f226b8d61f6488305e9e558c79d 100644 |
| --- a/frog/type.dart |
| +++ b/frog/type.dart |
| @@ -41,6 +41,7 @@ class Type extends Element { |
| abstract Map<String, MethodMember> get constructors(); |
| abstract addDirectSubtype(Type type); |
| abstract bool get isClass(); |
| + abstract Library get library(); |
| Set<Type> get subtypes() => null; |
| // TODO(jmesserly): rename to isDynamic? |
| @@ -382,6 +383,16 @@ class Type extends Element { |
| return false; |
| } |
| + // TODO(nweiz): make hashCode and == more robust by |
|
Bob Nystrom
2011/12/06 23:11:23
By what? Don't leave me in suspense!
nweiz
2011/12/07 19:26:56
It was going to be "adding Library#hashCode", but
|
| + int hashCode() { |
| + var libraryCode = library == null ? 1 : library.hashCode(); |
| + var nameCode = name == null ? 1 : name.hashCode(); |
| + return (libraryCode << 4) ^ nameCode; |
| + } |
| + |
| + bool operator ==(other) => |
| + other is Type && other.name == name && library == other.library; |
| + |
| /** |
| * A function type (T1,...,Tn, [Tx1 x1,..., Txk xk]) -> T is a subtype of the |
| * function type (S1,...,Sn, [Sy1 y1,..., Sym ym]) -> S, if all of the |