From fb57f8cec1dbde695e94a819e998f80f6d875dad Mon Sep 17 00:00:00 2001 From: Miles Sabin Date: Sun, 31 May 2009 19:58:48 +0000 Subject: Allow the content of SourceFiles backed by inte... Allow the content of SourceFiles backed by interactive buffers to be updated. --- src/compiler/scala/tools/nsc/util/SourceFile.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 9f5e094472..6d783e36b3 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -66,8 +66,14 @@ class BatchSourceFile(val file : AbstractFile, _content : Array[Char]) extends S } override def hashCode = file.hashCode - val content = _content - override val length = content.length + var content = _content + var length = _content.length + + def setContent(newContent : Array[Char]) { + content = newContent + length = newContent.length + } + // in SourceFileFragments, these are overridden to compensate during offset calculation // Invariant: length + start = underlyingLength def underlyingLength = length -- cgit v1.2.3