@@ -1072,15 +1072,11 @@ object Parsers {
1072
1072
}
1073
1073
1074
1074
/** Accept identifier and return Ident with its name as a term name. */
1075
- def rawTermIdent (): Ident =
1076
- makeIdent(in.token, in.offset, ident())
1077
-
1078
- /** Call `rawTermIdent`, and check it isn't a root package name. */
1079
1075
def termIdent (): Ident =
1080
- val ident = rawTermIdent( )
1081
- if ident .name == nme.ROOTPKG then
1076
+ val t = makeIdent(in.token, in.offset, ident() )
1077
+ if t .name == nme.ROOTPKG then
1082
1078
syntaxError(em " Illegal use of root package name. " )
1083
- ident
1079
+ t
1084
1080
1085
1081
/** Accept identifier and return Ident with its name as a type name. */
1086
1082
def typeIdent (): Ident =
@@ -1119,7 +1115,7 @@ object Parsers {
1119
1115
* | [id ‘.’] ‘this’
1120
1116
* | [id ‘.’] ‘super’ [ClassQualifier] ‘.’ id
1121
1117
*/
1122
- def simpleRef (allowRoot : Boolean = true ): Tree =
1118
+ def simpleRef (): Tree =
1123
1119
val start = in.offset
1124
1120
1125
1121
def handleThis (qual : Ident ) =
@@ -1135,19 +1131,21 @@ object Parsers {
1135
1131
1136
1132
if in.token == THIS then handleThis(EmptyTypeIdent )
1137
1133
else if in.token == SUPER then handleSuper(EmptyTypeIdent )
1138
- else
1139
- val t = if allowRoot then rawTermIdent() else termIdent()
1140
- if in.token == DOT then
1141
- def qual = cpy.Ident (t)(t.name.toTypeName)
1142
- in.lookahead.token match
1143
- case THIS =>
1144
- in.nextToken()
1145
- handleThis(qual)
1146
- case SUPER =>
1147
- in.nextToken()
1148
- handleSuper(qual)
1149
- case _ => t
1150
- else t
1134
+ else if in.lookahead.token == DOT then
1135
+ val tok = in.token
1136
+ val offset = in.offset
1137
+ val name = ident()
1138
+ def qual = makeIdent(tok, offset, name.toTypeName)
1139
+ in.lookahead.token match
1140
+ case THIS =>
1141
+ in.nextToken()
1142
+ handleThis(qual)
1143
+ case SUPER =>
1144
+ in.nextToken()
1145
+ handleSuper(qual)
1146
+ case _ =>
1147
+ makeIdent(tok, offset, name)
1148
+ else termIdent()
1151
1149
end simpleRef
1152
1150
1153
1151
/** MixinQualifier ::= `[' id `]'
@@ -2972,7 +2970,7 @@ object Parsers {
2972
2970
*/
2973
2971
def simplePattern (): Tree = in.token match {
2974
2972
case IDENTIFIER | BACKQUOTED_IDENT | THIS | SUPER =>
2975
- simpleRef(allowRoot = false ) match
2973
+ simpleRef() match
2976
2974
case id @ Ident (nme.raw.MINUS ) if isNumericLit => literal(startOffset(id))
2977
2975
case t => simplePatternRest(t)
2978
2976
case USCORE =>
0 commit comments