diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-10-19 02:29:42 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-10-19 02:29:42 +0000 |
commit | baf7e773f3784fa1778c061be09e77606a72a25f (patch) | |
tree | a0afa0041bf8d284904784b90657101d52339583 /src | |
parent | 08a8c00be622e1ec685a2c406a23bb25f4e2bd88 (diff) | |
download | scala-baf7e773f3784fa1778c061be09e77606a72a25f.tar.gz scala-baf7e773f3784fa1778c061be09e77606a72a25f.tar.bz2 scala-baf7e773f3784fa1778c061be09e77606a72a25f.zip |
A couple of hardening changes.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/IdeSupport.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/util/SourceFile.scala | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala index 8000688cf3..ad831a8b14 100644 --- a/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala +++ b/src/compiler/scala/tools/nsc/symtab/IdeSupport.scala @@ -628,6 +628,11 @@ trait IdeSupport extends SymbolTable { // added to global, not analyzers. } override def notifyImport(what : Name, container : Type, from : Name, to : Name) : Unit = { super.notifyImport(what, container, from, to) + // sanity checking. + if ((container eq null) || + (what eq null) || + (from eq null) || + (currentClient eq null)) return val from0 = if (what.isTypeName) from.toTypeName else from.toTermName val result = container.member(from0) if (result != NoSymbol) diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 7cddd24e54..3215aae627 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -63,17 +63,17 @@ class BatchSourceFile(val file : AbstractFile, _content : Array[Char]) extends S override val length = content.length override def identifier(pos : Position, compiler : scala.tools.nsc.Global) = pos match { - case OffsetPosition(source,offset) if source == this => + case OffsetPosition(source,offset) if source == this && offset != -1 => import java.lang.Character var i = offset + 1 while (i < content.length && (compiler.syntaxAnalyzer.isOperatorPart(content(i)) || compiler.syntaxAnalyzer.isIdentifierPart(content(i)))) i = i + 1 - assert(i > offset) - if (i <= content.length && offset >= 0) - Some(new String(content, offset, i - offset)) - else None + assert(i > offset) + if (i <= content.length && offset >= 0) + Some(new String(content, offset, i - offset)) + else None case _ => super.identifier(pos, compiler) } |