diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-07-07 11:22:16 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-07-07 11:22:16 +0000 |
commit | d9f65f3eb35c6d320008435e01009eb75c681b9c (patch) | |
tree | 6ae3d03192e6009a0209fdcd5ce842fd8f7afce4 | |
parent | 957bd55c65ec352334ff78f2b0285b2dee0961e1 (diff) | |
download | scala-d9f65f3eb35c6d320008435e01009eb75c681b9c.tar.gz scala-d9f65f3eb35c6d320008435e01009eb75c681b9c.tar.bz2 scala-d9f65f3eb35c6d320008435e01009eb75c681b9c.zip |
Trying to patch up NoPosition crash from syntax...
Trying to patch up NoPosition crash from syntaxError call in Parser that
only affects the IDE.
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 96a550179f..5254d23ebb 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -112,7 +112,7 @@ trait Parsers extends NewScanners with MarkupParsers { protected def posToReport: Int = in.currentPos protected implicit def i2p(offset : Int) : Position - private implicit def p2i(pos : Position) = pos.offset.get + //private implicit def p2i(pos : Position) = pos.offset.get private def inToken = in.token private def inSkipToken = in.skipToken @@ -231,6 +231,10 @@ trait Parsers extends NewScanners with MarkupParsers { def warning(pos : Int, msg : String) : Unit def incompleteInputError(msg: String) : Unit def deprecationWarning(pos : Int, msg : String) : Unit + private def syntaxError(pos : Position, msg : String, skipIt : Boolean) : Unit = pos.offset match { + case None => syntaxError(msg,skipIt) + case Some(offset) => syntaxError(offset, msg, skipIt) + } def syntaxError(pos: Int, msg: String) : Unit def syntaxError(msg: String, skipIt: Boolean) { syntaxError(inCurrentPos, msg, skipIt) @@ -2226,7 +2230,7 @@ trait Parsers extends NewScanners with MarkupParsers { case vdef @ ValDef(mods, name, tpt, rhs) if !(mods hasFlag Flags.DEFERRED) => List(copy.ValDef(vdef, mods | Flags.PRESUPER, name, tpt, rhs)) case stat if !stat.isEmpty => - syntaxError(stat.pos, "only concrete field definitions allowed in early object initialization section", false) + syntaxError(stat.pos, "only concrete field definitions allowed in early object initialization section", false) List() case _ => List() } |