Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/CompilationUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ object CompilationUnit {
* Used for `compiletime.testing.typeChecks`.
*/
def apply(name: String, source: String): CompilationUnit = {
val src = SourceFile.virtual(name = name, content = source, maybeIncomplete = false)
val src = SourceFile.virtual(name = name, content = source)
new CompilationUnit(src, null)
}

Expand Down
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/dotc/parsing/Scanners.scala
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,8 @@ object Scanners {
if lastToken == IDENTIFIER && lastName != null && isIdentifierStart(lastName.head)
|| colonEOLPredecessors.contains(lastToken)
then token = COLONfollow
case RBRACE | RPAREN | RBRACKET =>
case RBRACE | RPAREN | RBRACKET | EOF =>
closeIndented()
case EOF =>
if !source.maybeIncomplete then closeIndented()
case _ =>
}
}
Expand Down
7 changes: 1 addition & 6 deletions compiler/src/dotty/tools/dotc/util/SourceFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends
myContent
}

private var _maybeInComplete: Boolean = false

def maybeIncomplete: Boolean = _maybeInComplete

override def name: String = file.name
override def path: String = file.path
override def jfile: Optional[JFile] = Optional.ofNullable(file.file)
Expand Down Expand Up @@ -252,9 +248,8 @@ object SourceFile {
/** A source file with an underlying virtual file. The name is taken as a file system path
* with the local separator converted to "/". The last element of the path will be the simple name of the file.
*/
def virtual(name: String, content: String, maybeIncomplete: Boolean = false) =
def virtual(name: String, content: String) =
SourceFile(new VirtualFile(name.replace(separator, "/"), content.getBytes(StandardCharsets.UTF_8)), content.toCharArray)
.tap(_._maybeInComplete = maybeIncomplete)

/** A helper method to create a virtual source file for given URI.
* It relies on SourceFile#virtual implementation to create the virtual file.
Expand Down
Loading