@@ -9,7 +9,7 @@ trait Output { this: TransformCake ⇒
9
9
10
10
def outputBase : File
11
11
12
- def write (out : Out , c : ClassInfo ) {
12
+ def write (out : Out , c : ClassInfo ): Unit = {
13
13
// TODO @param should be transformed to constructor comments
14
14
c.comment foreach {line =>
15
15
val replaced = line.replace(" @param" , " param: " ) match {
@@ -30,7 +30,7 @@ trait Output { this: TransformCake ⇒
30
30
out(" }" )
31
31
}
32
32
33
- def write (out : Out , m : MethodInfo ) {
33
+ def write (out : Out , m : MethodInfo ): Unit = {
34
34
m.comment foreach (out(_))
35
35
out(m.sig)
36
36
}
@@ -39,9 +39,9 @@ trait Output { this: TransformCake ⇒
39
39
var ind = 0
40
40
41
41
def println (s : String ): Unit
42
- def apply (s : String ) { println(" " * ind + s) }
43
- def indent () { ind += 2 }
44
- def outdent () { ind -= 2 }
42
+ def apply (s : String ): Unit = { println(" " * ind + s) }
43
+ def indent (): Unit = { ind += 2 }
44
+ def outdent (): Unit = { ind -= 2 }
45
45
def close (): Unit
46
46
}
47
47
@@ -50,8 +50,8 @@ trait Output { this: TransformCake ⇒
50
50
f.getParentFile.mkdirs
51
51
val w = new PrintStream (f, " UTF-8" )
52
52
new Out {
53
- def println (s : String ) { w.println(s) }
54
- def close () { w.close() }
53
+ def println (s : String ): Unit = { w.println(s) }
54
+ def close (): Unit = { w.close() }
55
55
}
56
56
}
57
57
@@ -107,7 +107,7 @@ trait Output { this: TransformCake ⇒
107
107
108
108
// goes from object to companion class (not the other way around)
109
109
private def fabricateCompanion (obj : ClassInfo ): ClassInfo = {
110
- val com = ( obj.comment /: obj.members )((c, mem) ⇒ mem match {
110
+ val com = obj.members.foldLeft( obj.comment )((c, mem) ⇒ mem match {
111
111
case x : MethodInfo if x.name == obj.name ⇒ c ++ x.comment
112
112
case _ ⇒ c
113
113
})
@@ -134,7 +134,7 @@ trait Output { this: TransformCake ⇒
134
134
else flatten(obj.classMembers) ++ obj.methodMembers
135
135
)
136
136
137
- val (com : Seq [String ], moduleMembers : Vector [Templ ]) = ((obj.comment, Vector .empty[Templ ]) /: members )((p, mem) ⇒ mem match {
137
+ val (com : Seq [String ], moduleMembers : Vector [Templ ]) = members.foldLeft ((obj.comment, Vector .empty[Templ ]))((p, mem) ⇒ mem match {
138
138
case x : MethodInfo if x.name == obj.name ⇒ (p._1 ++ x.comment, p._2 :+ x.copy(name = x.name + '$' , comment = Seq ()))
139
139
case x ⇒ (p._1, p._2 :+ x)
140
140
})
0 commit comments