summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-11-25 17:41:47 +0000
committerpaltherr <paltherr@epfl.ch>2004-11-25 17:41:47 +0000
commit3ef7b2660e3f0c3dcfce1876fb258c49a02a8726 (patch)
tree4e1a0c1ebfe55ceb10bc58a41fd6fb4940d595c5
parent72d99c95e94b2a869a235652f795e4ae1c8f0453 (diff)
downloadscala-3ef7b2660e3f0c3dcfce1876fb258c49a02a8726.tar.gz
scala-3ef7b2660e3f0c3dcfce1876fb258c49a02a8726.tar.bz2
scala-3ef7b2660e3f0c3dcfce1876fb258c49a02a8726.zip
- Simplified the bound printing code
-rw-r--r--sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala38
1 files changed, 14 insertions, 24 deletions
diff --git a/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala b/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala
index fca4810ed6..2ae8fd2606 100644
--- a/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala
+++ b/sources/scala/tools/scalac/ast/printer/TextTreePrinter.scala
@@ -855,35 +855,27 @@ class TextTreePrinter(global0: scalac_Global, out0: PrintWriter)
print(tp.toString());
}
- /** Print attributed lower bound. */
- def printALoBound(lobound: Type): Unit = {
- if (lobound.symbol() != global.definitions.ALL_CLASS && !global.debug) {
+ /** Print attributed bound. */
+ def printABound(kind: Text, bound: Type, default: Symbol): Unit = {
+ if (bound.symbol() != default && !global.debug) {
print(Space);
- print(TXT_SUPERTYPE);
+ print(kind);
print(Space);
- printType(lobound);
+ printType(bound);
}
}
+ /** Print attributed lower bound. */
+ def printALoBound(lobound: Type): Unit =
+ printABound(TXT_SUPERTYPE, lobound, global.definitions.ALL_CLASS);
+
/** Print attributed view bound. */
- def printAVuBound(vubound: Type): Unit = {
- if (vubound.symbol() != global.definitions.ANY_CLASS && !global.debug) {
- print(Space);
- print(TXT_VIEWBOUND);
- print(Space);
- printType(vubound);
- }
- }
+ def printAVuBound(vubound: Type): Unit =
+ printABound(TXT_VIEWBOUND, vubound, global.definitions.ANY_CLASS);
/** Print attributed higher bound. */
- def printAHiBound(hibound: Type): Unit = {
- if (hibound.symbol() != global.definitions.ANY_CLASS && !global.debug) {
- print(Space);
- print(TXT_SUBTYPE);
- print(Space);
- printType(hibound);
- }
- }
+ def printAHiBound(hibound: Type): Unit =
+ printABound(TXT_SUBTYPE, hibound, global.definitions.ANY_CLASS);
/** Print attributed bounds of symbol. */
def printABoundsOf(symbol: Symbol): Unit = {
@@ -905,9 +897,7 @@ class TextTreePrinter(global0: scalac_Global, out0: PrintWriter)
else
printAHiBound(hibound.getType());
else if (!"scala.Any".equals(hibound.toString()) && !global.debug)
- printOpt(
- if ((mods & Modifiers.VIEWBOUND) != 0) TXT_VIEWBOUND else TXT_SUBTYPE,
- hibound, true);
+ printOpt(if (isViewBounded) TXT_VIEWBOUND else TXT_SUBTYPE,hibound,true);
}
//##########################################################################