diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/util/SourceFile.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 42489c5aaf..22820806be 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -55,7 +55,7 @@ abstract class SourceFile { */ object NoSourceFile extends SourceFile { def content = Array() - def file = null // TODO: push NPE-defense out another level or two + def file = NoFile def isLineBreak(idx: Int) = false def isSelfContained = true def length = -1 @@ -64,6 +64,8 @@ object NoSourceFile extends SourceFile { override def toString = "NoSourceFile" } +object NoFile extends VirtualFile("<no file>", "<no file>") + object ScriptSourceFile { /** Length of the script header from the given content, if there is one. * The header begins with "#!" or "::#!" and ends with a line starting |