summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/reify
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-10-13 14:35:18 -0700
committerPaul Phillips <paulp@improving.org>2013-10-13 14:35:18 -0700
commit3052eefae4921f84a8a7b586f924a1d673afc743 (patch)
treef6531f44c6cbc242238a1bba273a0ca19be2ca52 /src/compiler/scala/reflect/reify
parent392d1ddb1588d69c2e8ae10a2b3e902c7229b772 (diff)
downloadscala-3052eefae4921f84a8a7b586f924a1d673afc743.tar.gz
scala-3052eefae4921f84a8a7b586f924a1d673afc743.tar.bz2
scala-3052eefae4921f84a8a7b586f924a1d673afc743.zip
Aesthetics in GenTrees.
A nominee for "worst textual shape" might be \\\\\ ///// \\\\\ ///// \\\\\ ///// where the zigzagging wall of text is confined to the first forty columns. In this commit we halve the vertical space usage and double the readability.
Diffstat (limited to 'src/compiler/scala/reflect/reify')
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenTrees.scala37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
index a09acc04b8..f6b3c42ca9 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala
@@ -41,17 +41,12 @@ trait GenTrees {
// the first prototype of reification reified all types and symbols for all trees => this quickly became unyieldy
// the second prototype reified external types, but avoided reifying local ones => this created an ugly irregularity
// current approach is uniform and compact
- var rtree = tree match {
- case FreeDef(_, _, _, _, _) =>
- reifyNestedFreeDef(tree)
- case FreeRef(_, _) =>
- reifyNestedFreeRef(tree)
- case BoundTerm(tree) =>
- reifyBoundTerm(tree)
- case BoundType(tree) =>
- reifyBoundType(tree)
- case _ =>
- reifyTreeSyntactically(tree)
+ var rtree: Tree = tree match {
+ case FreeDef(_, _, _, _, _) => reifyNestedFreeDef(tree)
+ case FreeRef(_, _) => reifyNestedFreeRef(tree)
+ case BoundTerm(tree) => reifyBoundTerm(tree)
+ case BoundType(tree) => reifyBoundType(tree)
+ case _ => reifyTreeSyntactically(tree)
}
// usually we don't reify symbols/types, because they can be re-inferred during subsequent reflective compilation
@@ -68,19 +63,13 @@ trait GenTrees {
rtree
}
- def reifyTreeSyntactically(tree: Tree) = tree match {
- case global.EmptyTree =>
- reifyMirrorObject(EmptyTree)
- case global.noSelfType =>
- mirrorSelect(nme.noSelfType)
- case global.pendingSuperCall =>
- mirrorSelect(nme.pendingSuperCall)
- case Literal(const @ Constant(_)) =>
- mirrorCall(nme.Literal, reifyProduct(const))
- case Import(expr, selectors) =>
- mirrorCall(nme.Import, reify(expr), mkList(selectors map reifyProduct))
- case _ =>
- reifyProduct(tree)
+ def reifyTreeSyntactically(tree: Tree): Tree = tree match {
+ case global.EmptyTree => reifyMirrorObject(EmptyTree)
+ case global.noSelfType => mirrorSelect(nme.noSelfType)
+ case global.pendingSuperCall => mirrorSelect(nme.pendingSuperCall)
+ case Literal(const @ Constant(_)) => mirrorCall(nme.Literal, reifyProduct(const))
+ case Import(expr, selectors) => mirrorCall(nme.Import, reify(expr), mkList(selectors map reifyProduct))
+ case _ => reifyProduct(tree)
}
def reifyFlags(flags: FlagSet) =