@@ -311,7 +311,7 @@ object Parsers {
311
311
312
312
def acceptColon (): Int =
313
313
val offset = in.offset
314
- if in.isColon() then { in.nextToken(); offset }
314
+ if in.isColon then { in.nextToken(); offset }
315
315
else accept(COLONop )
316
316
317
317
/** semi = nl {nl} | `;'
@@ -890,7 +890,7 @@ object Parsers {
890
890
lookahead.nextToken()
891
891
skipParams()
892
892
skipParams()
893
- lookahead.isColon()
893
+ lookahead.isColon
894
894
895
895
def followingIsExtension () =
896
896
val next = in.lookahead.token
@@ -1460,7 +1460,7 @@ object Parsers {
1460
1460
val paramStart = in.offset
1461
1461
val ts = in.currentRegion.withCommasExpected {
1462
1462
funArgType() match
1463
- case Ident (name) if name != tpnme.WILDCARD && in.isColon() =>
1463
+ case Ident (name) if name != tpnme.WILDCARD && in.isColon =>
1464
1464
isValParamList = true
1465
1465
commaSeparatedRest(
1466
1466
typedFunParam(paramStart, name.toTermName, imods),
@@ -1867,7 +1867,7 @@ object Parsers {
1867
1867
}
1868
1868
1869
1869
def contextBounds (pname : TypeName ): List [Tree ] =
1870
- if in.isColon() then
1870
+ if in.isColon then
1871
1871
atSpan(in.skipToken()) {
1872
1872
AppliedTypeTree (toplevelTyp(), Ident (pname))
1873
1873
} :: contextBounds(pname)
@@ -1882,7 +1882,7 @@ object Parsers {
1882
1882
Nil
1883
1883
1884
1884
def typedOpt (): Tree =
1885
- if in.isColon() then { in.nextToken(); toplevelTyp() }
1885
+ if in.isColon then { in.nextToken(); toplevelTyp() }
1886
1886
else TypeTree ().withSpan(Span (in.lastOffset))
1887
1887
1888
1888
def typeDependingOn (location : Location ): Tree =
@@ -2110,8 +2110,8 @@ object Parsers {
2110
2110
else expr1Rest(postfixExpr(location), location)
2111
2111
end expr1
2112
2112
2113
- def expr1Rest (t : Tree , location : Location ): Tree = in.token match
2114
- case EQUALS =>
2113
+ def expr1Rest (t : Tree , location : Location ): Tree =
2114
+ if in.token == EQUALS then
2115
2115
t match
2116
2116
case Ident (_) | Select (_, _) | Apply (_, _) | PrefixOp (_, _) =>
2117
2117
atSpan(startOffset(t), in.skipToken()) {
@@ -2120,12 +2120,11 @@ object Parsers {
2120
2120
}
2121
2121
case _ =>
2122
2122
t
2123
- case COLONop | COLONfollow =>
2123
+ else if in.isColon then
2124
2124
in.nextToken()
2125
2125
ascription(t, location)
2126
- case _ =>
2126
+ else
2127
2127
t
2128
- end expr1Rest
2129
2128
2130
2129
def ascription (t : Tree , location : Location ): Tree = atSpan(startOffset(t)) {
2131
2130
in.token match {
@@ -2354,7 +2353,7 @@ object Parsers {
2354
2353
case _ =>
2355
2354
if isLiteral then
2356
2355
literal()
2357
- else if in.isColon() then
2356
+ else if in.isColon then
2358
2357
syntaxError(IllegalStartSimpleExpr (tokenString(in.token)))
2359
2358
in.nextToken()
2360
2359
simpleExpr(location)
@@ -2381,7 +2380,7 @@ object Parsers {
2381
2380
case USCORE =>
2382
2381
atSpan(startOffset(t), in.skipToken()) { PostfixOp (t, Ident (nme.WILDCARD )) }
2383
2382
case _ =>
2384
- if in.isColon() && location == Location .InParens && followingIsLambdaParams() then
2383
+ if in.isColon && location == Location .InParens && followingIsLambdaParams() then
2385
2384
t match
2386
2385
case id @ Ident (name) =>
2387
2386
if name.is(WildcardParamName ) then
@@ -2485,7 +2484,7 @@ object Parsers {
2485
2484
! fn.isInstanceOf [Trees .Apply [? ]] // allow one () as annotation argument
2486
2485
else if lookahead.token == IDENTIFIER then
2487
2486
lookahead.nextToken()
2488
- ! lookahead.isColon()
2487
+ ! lookahead.isColon
2489
2488
else in.canStartExprTokens.contains(lookahead.token)
2490
2489
}
2491
2490
}
@@ -2718,7 +2717,7 @@ object Parsers {
2718
2717
*/
2719
2718
def pattern1 (location : Location = Location .InPattern ): Tree =
2720
2719
val p = pattern2()
2721
- if in.token == COLONop || in.token == COLONfollow then
2720
+ if in.isColon then
2722
2721
in.nextToken()
2723
2722
ascription(p, location)
2724
2723
else p
@@ -2919,7 +2918,7 @@ object Parsers {
2919
2918
if allowed.contains(in.token)
2920
2919
|| in.isSoftModifier
2921
2920
&& localModifierTokens.subsetOf(allowed) // soft modifiers are admissible everywhere local modifiers are
2922
- && ! in.lookahead.isColon()
2921
+ && ! in.lookahead.isColon
2923
2922
then
2924
2923
val isAccessMod = accessModifierTokens contains in.token
2925
2924
val mods1 = addModifier(mods)
@@ -3126,7 +3125,7 @@ object Parsers {
3126
3125
val isParams =
3127
3126
! impliedMods.is(Given )
3128
3127
|| startParamTokens.contains(in.token)
3129
- || isIdent && (in.name == nme.inline || in.lookahead.isColon() )
3128
+ || isIdent && (in.name == nme.inline || in.lookahead.isColon)
3130
3129
if isParams then commaSeparated(() => param())
3131
3130
else contextTypes(ofClass, nparams, impliedMods)
3132
3131
checkVarArgsRules(clause)
@@ -3739,7 +3738,7 @@ object Parsers {
3739
3738
isUsingClause(extParams)
3740
3739
do ()
3741
3740
leadParamss ++= paramClauses(givenOnly = true , numLeadParams = nparams)
3742
- if in.isColon() then
3741
+ if in.isColon then
3743
3742
syntaxError(" no `:` expected here" )
3744
3743
in.nextToken()
3745
3744
val methods : List [Tree ] =
@@ -3949,7 +3948,7 @@ object Parsers {
3949
3948
*/
3950
3949
def selfType (): ValDef =
3951
3950
if (in.isIdent || in.token == THIS )
3952
- && in.lookahead.token == COLONop && followingIsSelfType()
3951
+ && in.lookahead.isColon && followingIsSelfType()
3953
3952
|| in.lookahead.token == ARROW
3954
3953
then
3955
3954
atSpan(in.offset) {
@@ -3959,7 +3958,7 @@ object Parsers {
3959
3958
nme.WILDCARD
3960
3959
else ident()
3961
3960
val selfTpt =
3962
- if in.token == COLONfollow then
3961
+ if in.isColon then
3963
3962
in.nextToken()
3964
3963
infixType()
3965
3964
else
0 commit comments