Skip to content

Commit

Permalink
Avoid vars in code
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeandres committed Feb 6, 2022
1 parent f1bc063 commit 61744dd
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions compiler/src/dotty/tools/dotc/ast/MainProxies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,14 @@ object MainProxies {
mt.paramInfos.zip(mt.paramNames).zipWithIndex.map {
case ((formal, paramName), n) =>
val argName = nme.args ++ n.toString

val isRepeated = formal.isRepeatedParam

var argRef: Tree = Apply(Ident(argName), Nil)
var formalType = formal
if isRepeated then
argRef = repeated(argRef)
formalType = formalType.argTypes.head

val getterSym =
if isRepeated then
defn.MainAnnotCommand_varargGetter
else
defn.MainAnnotCommand_argGetter
val (argRef, formalType, getterSym) = {
val argRef0 = Apply(Ident(argName), Nil)
if formal.isRepeatedParam then
(repeated(argRef0), formal.argTypes.head, defn.MainAnnotCommand_varargGetter)
else (argRef0, formal, defn.MainAnnotCommand_argGetter)
}

// The ParameterInfos to be passed to the arg getter
val parameterInfos = {
Expand Down

0 comments on commit 61744dd

Please sign in to comment.