diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-10-21 23:34:35 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-10-22 08:14:14 +0200 |
commit | cbad218dba47d49a39897b86d467c384538fdd53 (patch) | |
tree | 8acf0bb1698429754dd0ad97ad40170bfc6c200f /src | |
parent | 2bd2a7c9506790d25d01c6e79e50a233b16c31ff (diff) | |
download | scala-cbad218dba47d49a39897b86d467c384538fdd53.tar.gz scala-cbad218dba47d49a39897b86d467c384538fdd53.tar.bz2 scala-cbad218dba47d49a39897b86d467c384538fdd53.zip |
SI-2968 Fix brace healing for `^case (class|object) {`
The scanner coalesces the pair of tokens into CASEOBJECT or
CASECLASS, but fails to set `offset` back to the start of `case`.
Brace healing is then unable to correctly guess the location of
the missing brace.
This commit resets `offset` and `lastOffset`, as though
caseobject were a single keyword. Only the former was neccessary
to fix this bug; I haven't found a test that shows the need for
the latter.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Scanners.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index 5902209898..5b828ded79 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -283,10 +283,16 @@ trait Scanners extends ScannersCommon { prev copyFrom this val nextLastOffset = charOffset - 1 fetchToken() + def resetOffset() { + offset = prev.offset + lastOffset = prev.lastOffset + } if (token == CLASS) { token = CASECLASS + resetOffset() } else if (token == OBJECT) { token = CASEOBJECT + resetOffset() } else { lastOffset = nextLastOffset next copyFrom this |