summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2004-04-21 07:31:40 +0000
committerschinz <schinz@epfl.ch>2004-04-21 07:31:40 +0000
commitef5b5ca41a3a80b91fa477b7192e039350078348 (patch)
tree61f13a785e3e89e03d6b2f233118f304c654f7e1 /sources
parentbda037d7c6d4cd869df23ab3f4eb5805551417d8 (diff)
downloadscala-ef5b5ca41a3a80b91fa477b7192e039350078348.tar.gz
scala-ef5b5ca41a3a80b91fa477b7192e039350078348.tar.bz2
scala-ef5b5ca41a3a80b91fa477b7192e039350078348.zip
- changed the ordering relation used on symbols...
- changed the ordering relation used on symbols, to improve (dramatically) the balance of the trees
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/symtab/SymSet.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/sources/scalac/symtab/SymSet.java b/sources/scalac/symtab/SymSet.java
index 6911b75c06..6d9740f02f 100644
--- a/sources/scalac/symtab/SymSet.java
+++ b/sources/scalac/symtab/SymSet.java
@@ -27,10 +27,10 @@ public class SymSet {
return new SymSet(sym, EMPTY, EMPTY);
} else if (sym == this.sym) {
return this;
- } else if (sym.isLess(this.sym)) {
+ } else if (less(sym, this.sym)) {
return new SymSet(this.sym, l.incl(sym), r);
} else {
- assert this.sym.isLess(sym);
+ assert less(this.sym, sym);
return new SymSet(this.sym, l, r.incl(sym));
}
}
@@ -51,10 +51,10 @@ public class SymSet {
}
m.l = l;
return m;
- } else if (sym.isLess(this.sym)) {
+ } else if (less(sym, this.sym)) {
return new SymSet(this.sym, l.excl(sym), r);
} else {
- assert this.sym.isLess(sym);
+ assert less(this.sym, sym);
return new SymSet(this.sym, l, r.excl(sym));
}
}
@@ -66,10 +66,10 @@ public class SymSet {
return false;
} else if (sym == this.sym) {
return true;
- } else if (sym.isLess(this.sym)) {
+ } else if (less(sym, this.sym)) {
return l.contains(sym);
} else {
- assert this.sym.isLess(sym);
+ assert less(this.sym, sym);
return r.contains(sym);
}
}
@@ -110,4 +110,9 @@ public class SymSet {
/** The empty set.
*/
public final static SymSet EMPTY = new SymSet();
+
+ private boolean less(Symbol s1, Symbol s2) {
+ return (s1.hashCode() < s2.hashCode())
+ || (s1.hashCode() == s2.hashCode() && s1.isLess(s2));
+ }
}