Skip to content

Commit 5519509

Browse files
Avoid vars in code
1 parent fe79554 commit 5519509

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

compiler/src/dotty/tools/dotc/ast/MainProxies.scala

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,14 @@ object MainProxies {
122122
mt.paramInfos.zip(mt.paramNames).zipWithIndex.map {
123123
case ((formal, paramName), n) =>
124124
val argName = nme.args ++ n.toString
125-
126125
val isRepeated = formal.isRepeatedParam
127126

128-
var argRef: Tree = Apply(Ident(argName), Nil)
129-
var formalType = formal
130-
if isRepeated then
131-
argRef = repeated(argRef)
132-
formalType = formalType.argTypes.head
133-
134-
val getterSym =
135-
if isRepeated then
136-
defn.MainAnnotCommand_varargGetter
137-
else
138-
defn.MainAnnotCommand_argGetter
127+
val (argRef, formalType, getterSym) = {
128+
val argRef0 = Apply(Ident(argName), Nil)
129+
if formal.isRepeatedParam then
130+
(repeated(argRef0), formal.argTypes.head, defn.MainAnnotCommand_varargGetter)
131+
else (argRef0, formal, defn.MainAnnotCommand_argGetter)
132+
}
139133

140134
// The ParameterInfos to be passed to the arg getter
141135
val parameterInfos = {

0 commit comments

Comments
 (0)