Skip to content

Commit 988d6e3

Browse files
committed
Cleanup
1 parent ecea405 commit 988d6e3

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,13 @@ object MainProxies {
265265
val argName = nme.args ++ idx.toString
266266
val isRepeated = formal.isRepeatedParam
267267
val formalType = if isRepeated then formal.argTypes.head else formal
268-
val getterSym =
269-
if isRepeated then defn.MainAnnotationCommand_varargGetter
270-
else defn.MainAnnotationCommand_argGetter
268+
val getterName = if isRepeated then nme.varargGetter else nme.argGetter
271269
val defaultValueGetterOpt = defaultValueSymbols.get(idx) match
272270
case None => ref(defn.NoneModule.termRef)
273271
case Some(dvSym) =>
274272
val value = unitToValue(ref(dvSym.termRef))
275273
Apply(ref(defn.SomeClass.companionModule.termRef), value)
276-
val argGetter0 = TypeApply(Select(Ident(nme.cmd), getterSym.name), TypeTree(formalType) :: Nil)
274+
val argGetter0 = TypeApply(Select(Ident(nme.cmd), getterName), TypeTree(formalType) :: Nil)
277275
val argGetter =
278276
if isRepeated then argGetter0
279277
else Apply(argGetter0, List(Literal(Constant(idx)), defaultValueGetterOpt))
@@ -324,11 +322,11 @@ object MainProxies {
324322
nme.cmd,
325323
TypeTree(),
326324
Apply(
327-
Select(instantiateAnnotation(mainAnnot), defn.MainAnnotation_command.name),
325+
Select(instantiateAnnotation(mainAnnot), nme.command),
328326
List(cmdInfo, Ident(nme.args))
329327
)
330328
)
331-
val run = Apply(Select(Ident(nme.cmd), defn.MainAnnotationCommand_run.name), mainCall)
329+
val run = Apply(Select(Ident(nme.cmd), nme.run), mainCall)
332330
val body = Block(cmdInfo :: cmd :: args, run)
333331
val mainArg = ValDef(nme.args, TypeTree(defn.ArrayType.appliedTo(defn.StringType)), EmptyTree)
334332
.withFlags(Param)

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,16 +852,10 @@ class Definitions {
852852
@tu lazy val XMLTopScopeModule: Symbol = requiredModule("scala.xml.TopScope")
853853

854854
@tu lazy val MainAnnotationClass: ClassSymbol = requiredClass("scala.annotation.MainAnnotation")
855-
@tu lazy val MainAnnotation_command: Symbol = MainAnnotationClass.requiredMethod("command")
856855
@tu lazy val MainAnnotationCommandInfo: ClassSymbol = requiredClass("scala.annotation.MainAnnotation.CommandInfo")
857856
@tu lazy val MainAnnotationParameterInfo: ClassSymbol = requiredClass("scala.annotation.MainAnnotation.ParameterInfo")
858-
@tu lazy val MainAnnotationParameterInfo_withDocumentation: Symbol = MainAnnotationParameterInfo.requiredMethod("withDocumentation")
859-
@tu lazy val MainAnnotationParameterInfo_withAnnotations: Symbol = MainAnnotationParameterInfo.requiredMethod("withAnnotations")
860857
@tu lazy val MainAnnotationParameterAnnotation: ClassSymbol = requiredClass("scala.annotation.MainAnnotation.ParameterAnnotation")
861858
@tu lazy val MainAnnotationCommand: ClassSymbol = requiredClass("scala.annotation.MainAnnotation.Command")
862-
@tu lazy val MainAnnotationCommand_argGetter: Symbol = MainAnnotationCommand.requiredMethod("argGetter")
863-
@tu lazy val MainAnnotationCommand_varargGetter: Symbol = MainAnnotationCommand.requiredMethod("varargGetter")
864-
@tu lazy val MainAnnotationCommand_run: Symbol = MainAnnotationCommand.requiredMethod("run")
865859

866860
@tu lazy val CommandLineParserModule: Symbol = requiredModule("scala.util.CommandLineParser")
867861
@tu lazy val CLP_ParseError: ClassSymbol = CommandLineParserModule.requiredClass("ParseError").typeRef.symbol.asClass

compiler/src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ object StdNames {
419419
val applyOrElse: N = "applyOrElse"
420420
val args : N = "args"
421421
val argv : N = "argv"
422+
val argGetter : N = "argGetter"
422423
val arrayClass: N = "arrayClass"
423424
val arrayElementClass: N = "arrayElementClass"
424425
val arrayType: N = "arrayType"
@@ -450,6 +451,7 @@ object StdNames {
450451
val classType: N = "classType"
451452
val clone_ : N = "clone"
452453
val cmd: N = "cmd"
454+
val command: N = "command"
453455
val common: N = "common"
454456
val compiletime : N = "compiletime"
455457
val conforms_ : N = "$conforms"
@@ -636,6 +638,7 @@ object StdNames {
636638
val fromOrdinal: N = "fromOrdinal"
637639
val values: N = "values"
638640
val view_ : N = "view"
641+
val varargGetter : N = "varargGetter"
639642
val wait_ : N = "wait"
640643
val wildcardType: N = "wildcardType"
641644
val withFilter: N = "withFilter"

0 commit comments

Comments
 (0)