summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2014-02-13 22:13:23 -0800
committerSom Snytt <som.snytt@gmail.com>2014-02-14 13:29:16 -0800
commit37f822eb66dc18a2b3bfdaa672081b6f08ef5688 (patch)
treedc29d030f6d3dc6710d459ede604cbcff2e31c6f /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parentd4f5abf9002fd617e871d1f20fdcf531b38b26e1 (diff)
downloadscala-37f822eb66dc18a2b3bfdaa672081b6f08ef5688.tar.gz
scala-37f822eb66dc18a2b3bfdaa672081b6f08ef5688.tar.bz2
scala-37f822eb66dc18a2b3bfdaa672081b6f08ef5688.zip
SI-7711 Do not emit extra argv in script body
Take away `argv` and make `args` the standard parameter name. This is a quick fix to avoid "unused local" lint error. All the examples use `args`; in particular, "Step 4. Write some Scala scripts" in "Programming in Scala" uses `args`. I see the footnote there is also where Odersky concatenation is specified, `"Hello, "+ args(0) +"!"` with no space next to the literals. Also removes `argv` from `StdNames`. Was torn whether just to add `argc`. Maybe start a new project to house Names, emeritus.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index e3d2bf14a0..5dadbd0825 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -413,12 +413,10 @@ self =>
*
* {{{
* object moduleName {
- * def main(argv: Array[String]): Unit = {
- * val args = argv
+ * def main(args: Array[String]): Unit =
* new AnyRef {
* stmts
* }
- * }
* }
* }}}
*/
@@ -433,9 +431,8 @@ self =>
// def main
def mainParamType = AppliedTypeTree(Ident(tpnme.Array), List(Ident(tpnme.String)))
- def mainParameter = List(ValDef(Modifiers(Flags.PARAM), nme.argv, mainParamType, EmptyTree))
- def mainSetArgv = List(ValDef(NoMods, nme.args, TypeTree(), Ident(nme.argv)))
- def mainDef = DefDef(NoMods, nme.main, Nil, List(mainParameter), scalaDot(tpnme.Unit), Block(mainSetArgv, gen.mkAnonymousNew(stmts)))
+ def mainParameter = List(ValDef(Modifiers(Flags.PARAM), nme.args, mainParamType, EmptyTree))
+ def mainDef = DefDef(NoMods, nme.main, Nil, List(mainParameter), scalaDot(tpnme.Unit), gen.mkAnonymousNew(stmts))
// object Main
def moduleName = newTermName(ScriptRunner scriptMain settings)