@@ -2,7 +2,7 @@ package com.typesafe.genjavadoc
2
2
3
3
import scala .annotation .tailrec
4
4
5
- trait AST { this : TransformCake ⇒
5
+ trait AST { this : TransformCake =>
6
6
7
7
import global ._
8
8
@@ -18,11 +18,11 @@ trait AST { this: TransformCake ⇒
18
18
sym : Symbol ,
19
19
name : String ,
20
20
access : String ,
21
- pattern : (String , String ) ⇒ String ,
21
+ pattern : (String , String ) => String ,
22
22
module : Boolean ,
23
23
comment : Seq [String ],
24
24
pckg : String ,
25
- filepattern : String ⇒ String ,
25
+ filepattern : String => String ,
26
26
members : Vector [Templ ],
27
27
interface : Boolean ,
28
28
static : Boolean ,
@@ -49,14 +49,14 @@ trait AST { this: TransformCake ⇒
49
49
object ClassInfo {
50
50
def apply (c : ImplDef , comment : Seq [String ], topLevel : Boolean ): ClassInfo = {
51
51
c match {
52
- case ClassDef (mods, _, tparams, impl) ⇒
52
+ case ClassDef (mods, _, tparams, impl) =>
53
53
val name = c.name.toString
54
54
val acc = access(mods, topLevel)
55
55
val fl = flags(mods)
56
56
val kind = if (mods.isInterface || mods.isTrait) " interface" else " class"
57
57
val tp = c.symbol.owner.thisType.memberInfo(c.symbol) match {
58
- case p @ PolyType (params, _) ⇒ js(c.symbol, p)
59
- case _ ⇒ " "
58
+ case p @ PolyType (params, _) => js(c.symbol, p)
59
+ case _ => " "
60
60
}
61
61
val parent = {
62
62
val p = impl.parents.head
@@ -65,13 +65,13 @@ trait AST { this: TransformCake ⇒
65
65
s " extends ${js(c.symbol, p.tpe)}"
66
66
}
67
67
}
68
- val intf = impl.parents.tail map (i ⇒ js(c.symbol, i.tpe)) mkString (" , " )
68
+ val intf = impl.parents.tail map (i => js(c.symbol, i.tpe)) mkString (" , " )
69
69
val interfaces = if (! intf.isEmpty) (if (mods.isInterface || mods.isTrait) " extends " else " implements " ) + intf else " "
70
- val sig = (n : String , a : String ) ⇒ s " $a $fl $kind $n$tp$parent$interfaces"
70
+ val sig = (n : String , a : String ) => s " $a $fl $kind $n$tp$parent$interfaces"
71
71
val packageName = c.symbol.enclosingPackage.fullName('/' )
72
72
val file =
73
73
if (packageName == " <empty>" ) (n : String ) => s " $n.java "
74
- else (n : String ) ⇒ s " $packageName/ $n.java "
74
+ else (n : String ) => s " $packageName/ $n.java "
75
75
val pckg = c.symbol.enclosingPackage.fullName
76
76
ClassInfo (c.symbol, name, acc, sig, mods.hasModuleFlag, comment, pckg, file, Vector .empty, kind == " interface" , false , true )
77
77
}
@@ -93,7 +93,7 @@ trait AST { this: TransformCake ⇒
93
93
}
94
94
}
95
95
96
- case class MethodInfo (access : String , pattern : String ⇒ String , ret : String , name : String , comment : Seq [String ]) extends Templ {
96
+ case class MethodInfo (access : String , pattern : String => String , ret : String , name : String , comment : Seq [String ]) extends Templ {
97
97
def sig = pattern(s " $ret $name" )
98
98
}
99
99
object MethodInfo {
@@ -104,13 +104,13 @@ trait AST { this: TransformCake ⇒
104
104
(" " , d.symbol.enclClass.name.toString)
105
105
} else (js(d.symbol, d.tpt.tpe), d.name.toString)
106
106
val tp = d.symbol.owner.thisType.memberInfo(d.symbol) match {
107
- case p @ PolyType (params, _) ⇒ js(d.symbol, p)
108
- case _ ⇒ " "
107
+ case p @ PolyType (params, _) => js(d.symbol, p)
108
+ case _ => " "
109
109
}
110
110
@ tailrec def rec (l : List [ValDef ], acc : Vector [String ] = Vector .empty): Seq [String ] = l match {
111
- case x :: Nil if hasVararg ⇒ acc :+ s " ${js(d.symbol, x.tpt.tpe, voidOK = false ).dropRight(2 )}... ${mangleMethodName(x)}"
112
- case x :: xs ⇒ rec(xs, acc :+ s " ${js(d.symbol, x.tpt.tpe, voidOK = false )} ${mangleMethodName(x)}" )
113
- case Nil ⇒ acc
111
+ case x :: Nil if hasVararg => acc :+ s " ${js(d.symbol, x.tpt.tpe, voidOK = false ).dropRight(2 )}... ${mangleMethodName(x)}"
112
+ case x :: xs => rec(xs, acc :+ s " ${js(d.symbol, x.tpt.tpe, voidOK = false )} ${mangleMethodName(x)}" )
113
+ case Nil => acc
114
114
}
115
115
val args = rec(d.vparamss.head) mkString (" (" , " , " , " )" )
116
116
@@ -123,7 +123,7 @@ trait AST { this: TransformCake ⇒
123
123
val throws = if (throwsAnnotations.isEmpty) " " else " throws " + throwsAnnotations.mkString(" , " )
124
124
125
125
val impl = if (d.mods.isDeferred || interface) " ;" else " { throw new RuntimeException(); }"
126
- val pattern = (n : String ) ⇒ s " $acc $tp $n $args $throws $impl"
126
+ val pattern = (n : String ) => s " $acc $tp $n $args $throws $impl"
127
127
def hasParam (n : String ) = comment.find(_.contains(s " @param $n" )).isDefined
128
128
129
129
val commentWithParams =
@@ -154,7 +154,7 @@ trait AST { this: TransformCake ⇒
154
154
}
155
155
val d = DefDef (sym, EmptyTree )
156
156
val m = MethodInfo (d, false , Nil , varargs, None )
157
- m.copy(pattern = n ⇒ " static " + m.pattern(n))
157
+ m.copy(pattern = n => " static " + m.pattern(n))
158
158
}
159
159
}
160
160
0 commit comments