File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -543,24 +543,22 @@ object Parsers {
543
543
}
544
544
545
545
/** Accept identifier and return Ident with its name as a term name. */
546
- def termIdent (): Ident = {
547
- val lastOffset = in.lastOffset
548
- val id = atPos(in.offset) {
549
- makeIdent(in.token, ident())
550
- }
551
- // Make sure that even trees with parsing errors have a offset that is within the offset
552
- if (id.name == nme.ERROR && id.pos == NoPosition ) atPos(lastOffset - 1 )(id)
553
- else id
546
+ def termIdent (): Ident = atPos(in.offset) {
547
+ makeIdent(in.token, ident())
554
548
}
555
549
556
550
/** Accept identifier and return Ident with its name as a type name. */
557
551
def typeIdent (): Ident = atPos(in.offset) {
558
552
makeIdent(in.token, ident().toTypeName)
559
553
}
560
554
561
- private def makeIdent (tok : Token , name : Name ) =
562
- if (tok == BACKQUOTED_IDENT ) BackquotedIdent (name)
563
- else Ident (name)
555
+ private def makeIdent (tok : Token , name : Name ) = {
556
+ val tree =
557
+ if (tok == BACKQUOTED_IDENT ) BackquotedIdent (name)
558
+ else Ident (name)
559
+ if (name.toTermName == nme.ERROR ) tree.withPos(Position (in.offset, in.offset))
560
+ else tree
561
+ }
564
562
565
563
def wildcardIdent (): Ident =
566
564
atPos(accept(USCORE )) { Ident (nme.WILDCARD ) }
You can’t perform that action at this time.
0 commit comments