Skip to content

Commit c79729e

Browse files
Use types in MainProxies for convenience
1 parent 79059ae commit c79729e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import Annotations.Annotation
4646
* }
4747
*/
4848
object MainProxies {
49+
private type DefaultValues = Map[Int, Tree[_]]
50+
private type ParameterAnnotations = Vector[Option[Annotation]]
4951

5052
def mainProxies(stats: List[tpd.Tree])(using Context): List[untpd.Tree] = {
5153
import tpd._
@@ -54,7 +56,7 @@ object MainProxies {
5456
* Compute the default values of the function. Since they cannot be infered anymore at this point
5557
* of the compilation, they must be explicitely passed by [[mainProxy]].
5658
*/
57-
def defaultValues(scope: Tree, funSymbol: Symbol): Map[Int, Tree] =
59+
def defaultValues(scope: Tree, funSymbol: Symbol): DefaultValues =
5860
scope match {
5961
case TypeDef(_, template: Template) =>
6062
template.body.flatMap((_: Tree) match {
@@ -68,7 +70,7 @@ object MainProxies {
6870
}
6971

7072
/** Computes the list of main methods present in the code. */
71-
def mainMethods(scope: Tree, stats: List[Tree]): List[(Symbol, Vector[Option[Annotation]], Map[Int, Tree], Option[Comment])] = stats.flatMap {
73+
def mainMethods(scope: Tree, stats: List[Tree]): List[(Symbol, ParameterAnnotations, DefaultValues, Option[Comment])] = stats.flatMap {
7274
case stat: DefDef =>
7375
val sym = stat.symbol
7476
sym.annotations.filter(_.matches(defn.MainAnnot)) match {
@@ -98,7 +100,7 @@ object MainProxies {
98100
}
99101

100102
import untpd._
101-
def mainProxy(mainFun: Symbol, paramAnnotations: Vector[Option[Annotation]], defaultValues: Map[Int, Tree], docComment: Option[Comment])(using Context): List[TypeDef] = {
103+
def mainProxy(mainFun: Symbol, paramAnnotations: ParameterAnnotations, defaultValues: DefaultValues, docComment: Option[Comment])(using Context): List[TypeDef] = {
102104
val mainAnnot = mainFun.getAnnotation(defn.MainAnnot).get
103105
def pos = mainFun.sourcePos
104106
val mainArgsName: TermName = nme.args

0 commit comments

Comments
 (0)