@@ -443,35 +443,35 @@ object Parsers {
443
443
444
444
/** Convert tree to formal parameter list
445
445
*/
446
- def convertToParams (tree : Tree , mods : Modifiers ): List [ValDef ] = tree match {
446
+ def convertToParams (tree : Tree ): List [ValDef ] = tree match {
447
447
case Parens (t) =>
448
- convertToParam(t, mods ) :: Nil
448
+ convertToParam(t) :: Nil
449
449
case Tuple (ts) =>
450
- ts.map(convertToParam(_, mods ))
450
+ ts.map(convertToParam(_))
451
451
case t : Typed =>
452
452
report.errorOrMigrationWarning(
453
453
em " parentheses are required around the parameter of a lambda ${rewriteNotice()}" ,
454
454
in.sourcePos())
455
455
if migrateTo3 then
456
456
patch(source, t.span.startPos, " (" )
457
457
patch(source, t.span.endPos, " )" )
458
- convertToParam(t, mods ) :: Nil
458
+ convertToParam(t) :: Nil
459
459
case t =>
460
- convertToParam(t, mods ) :: Nil
460
+ convertToParam(t) :: Nil
461
461
}
462
462
463
463
/** Convert tree to formal parameter
464
464
*/
465
- def convertToParam (tree : Tree , mods : Modifiers , expected : String = " formal parameter" ): ValDef = tree match {
465
+ def convertToParam (tree : Tree , expected : String = " formal parameter" ): ValDef = tree match {
466
466
case id @ Ident (name) =>
467
- makeParameter(name.asTermName, TypeTree (), mods , isBackquoted = isBackquoted(id)).withSpan(tree.span)
467
+ makeParameter(name.asTermName, TypeTree (), EmptyModifiers , isBackquoted = isBackquoted(id)).withSpan(tree.span)
468
468
case Typed (id @ Ident (name), tpt) =>
469
- makeParameter(name.asTermName, tpt, mods , isBackquoted = isBackquoted(id)).withSpan(tree.span)
469
+ makeParameter(name.asTermName, tpt, EmptyModifiers , isBackquoted = isBackquoted(id)).withSpan(tree.span)
470
470
case Typed (Splice (Ident (name)), tpt) =>
471
- makeParameter((" $" + name).toTermName, tpt, mods ).withSpan(tree.span)
471
+ makeParameter((" $" + name).toTermName, tpt, EmptyModifiers ).withSpan(tree.span)
472
472
case _ =>
473
473
syntaxError(s " not a legal $expected" , tree.span)
474
- makeParameter(nme.ERROR , tree, mods )
474
+ makeParameter(nme.ERROR , tree, EmptyModifiers )
475
475
}
476
476
477
477
/** Convert (qual)ident to type identifier
@@ -1500,7 +1500,7 @@ object Parsers {
1500
1500
def typedFunParam (start : Offset , name : TermName , mods : Modifiers = EmptyModifiers ): ValDef =
1501
1501
atSpan(start) {
1502
1502
accept(COLON )
1503
- makeParameter(name, typ(), mods | Param )
1503
+ makeParameter(name, typ(), mods)
1504
1504
}
1505
1505
1506
1506
/** FunParamClause ::= ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
@@ -1854,14 +1854,14 @@ object Parsers {
1854
1854
accept(altToken)
1855
1855
t
1856
1856
1857
- /** Expr ::= [`implicit'] FunParams ( ‘=>’ | ‘?=>’) Expr
1857
+ /** Expr ::= [`implicit'] FunParams ‘=>’ Expr
1858
1858
* | Expr1
1859
1859
* FunParams ::= Bindings
1860
1860
* | id
1861
1861
* | `_'
1862
1862
* ExprInParens ::= PostfixExpr `:' Type
1863
1863
* | Expr
1864
- * BlockResult ::= [‘implicit’] FunParams ( ‘=>’ | ‘?=>’) Block
1864
+ * BlockResult ::= [‘implicit’] FunParams ‘=>’ Block
1865
1865
* | Expr1
1866
1866
* Expr1 ::= [‘inline’] `if' `(' Expr `)' {nl} Expr [[semi] else Expr]
1867
1867
* | [‘inline’] `if' Expr `then' Expr [[semi] else Expr]
@@ -1910,10 +1910,9 @@ object Parsers {
1910
1910
finally placeholderParams = saved
1911
1911
1912
1912
val t = expr1(location)
1913
- if (in.token == ARROW || in.token == CTXARROW ) {
1913
+ if (in.token == ARROW ) {
1914
1914
placeholderParams = Nil // don't interpret `_' to the left of `=>` as placeholder
1915
- val paramMods = if in.token == CTXARROW then Modifiers (Given ) else EmptyModifiers
1916
- wrapPlaceholders(closureRest(start, location, convertToParams(t, paramMods)))
1915
+ wrapPlaceholders(closureRest(start, location, convertToParams(t)))
1917
1916
}
1918
1917
else if (isWildcard(t)) {
1919
1918
placeholderParams = placeholderParams ::: saved
@@ -2176,7 +2175,7 @@ object Parsers {
2176
2175
2177
2176
def closureRest (start : Int , location : Location , params : List [Tree ]): Tree =
2178
2177
atSpan(start, in.offset) {
2179
- if in.token == CTXARROW then in.nextToken() else accept(ARROW )
2178
+ accept(ARROW )
2180
2179
Function (params, if (location == Location .InBlock ) block() else expr())
2181
2180
}
2182
2181
@@ -3778,7 +3777,7 @@ object Parsers {
3778
3777
case Typed (tree @ This (EmptyTypeIdent ), tpt) =>
3779
3778
self = makeSelfDef(nme.WILDCARD , tpt).withSpan(first.span)
3780
3779
case _ =>
3781
- val ValDef (name, tpt, _) = convertToParam(first, EmptyModifiers , " self type clause" )
3780
+ val ValDef (name, tpt, _) = convertToParam(first, " self type clause" )
3782
3781
if (name != nme.ERROR )
3783
3782
self = makeSelfDef(name, tpt).withSpan(first.span)
3784
3783
}
0 commit comments