summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-12-11 13:00:45 +0000
committermichelou <michelou@epfl.ch>2007-12-11 13:00:45 +0000
commit8ed122db8057500facf346a77e06e3d8d5e9823e (patch)
treecce363ae5e346a40eaf5650ec6abfd8243bec195 /src
parentda79f1b5fb171972704df6738ee2d9a17da4c8dc (diff)
downloadscala-8ed122db8057500facf346a77e06e3d8d5e9823e.tar.gz
scala-8ed122db8057500facf346a77e06e3d8d5e9823e.tar.bz2
scala-8ed122db8057500facf346a77e06e3d8d5e9823e.zip
added message parameter to custom assert method
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/doc/ModelExtractor.scala7
-rw-r--r--src/compiler/scala/tools/nsc/doc/ModelToXML.scala19
2 files changed, 16 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
index 58c09c0015..5aaeb01be8 100644
--- a/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
+++ b/src/compiler/scala/tools/nsc/doc/ModelExtractor.scala
@@ -20,8 +20,11 @@ trait ModelExtractor {
import global._
def assert(b: Boolean) {
- if (!b)
- throw new Error;
+ if (!b) throw new Error
+ }
+
+ def assert(b: Boolean, message: Any) {
+ if (!b) throw new Error(message.toString)
}
case class Tag(tag: String, option: String, body: String)
diff --git a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
index b02dc45e03..8874a36b7a 100644
--- a/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
+++ b/src/compiler/scala/tools/nsc/doc/ModelToXML.scala
@@ -197,14 +197,17 @@ trait ModelToXML extends ModelExtractor {
if (xs.elements.hasNext) {
// alphabetic
val set = new scala.collection.jcl.TreeSet[entity.Member]()(mA => new Ordered[entity.Member] {
- def compare(mB: entity.Member): Int = {
- if (mA eq mB) return 0;
- val diff = mA.name compare mB.name;
- if (diff != 0) return diff;
- val diff0 = mA.hashCode - mB.hashCode;
- assert(diff0 != 0);
- return diff0
- }
+ def compare(mB: entity.Member): Int =
+ if (mA eq mB) 0
+ else {
+ val diff = mA.name compare mB.name
+ if (diff != 0) diff
+ else {
+ val diff0 = mA.hashCode - mB.hashCode
+ assert(diff0 != 0, mA.name)
+ diff0
+ }
+ }
});
set addAll xs;
seq = seq ++ <table cellpadding="3" class="member" summary="">