Skip to content

Commit 44ff72f

Browse files
committed
Add ReplCcompilationUnit
1 parent 8497e46 commit 44ff72f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

compiler/src/dotty/tools/dotc/CompilationUnit.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ class CompilationUnit protected (val source: SourceFile) {
2727
/** Is this the compilation unit of a Java file */
2828
def isJava: Boolean = source.file.name.endsWith(".java")
2929

30-
/** Is this the compilation unit of a REPL input */
31-
def isREPL: Boolean = source.file.name.startsWith(str.REPL_SESSION_LINE)
32-
3330
/** The source version for this unit, as determined by a language import */
3431
var sourceVersion: Option[SourceVersion] = None
3532

@@ -53,7 +50,7 @@ class CompilationUnit protected (val source: SourceFile) {
5350
var suspended: Boolean = false
5451

5552
/** Can this compilation unit be suspended */
56-
def isSuspendable: Boolean = !isREPL
53+
def isSuspendable: Boolean = true
5754

5855
/** Suspends the compilation unit by thowing a SuspendException
5956
* and recoring the suspended compilation unit

compiler/src/dotty/tools/repl/ReplCompiler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class ReplCompiler extends Compiler {
146146
val objectTermName = ctx.source.file.toString.toTermName
147147
objectNames.update(defs.state.objectIndex, objectTermName)
148148

149-
val unit = CompilationUnit(ctx.source)
149+
val unit = new ReplCompilationUnit(ctx.source)
150150
unit.untpdTree = wrapped(defs, objectTermName, span)
151151
unit
152152
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package dotty.tools.repl
2+
3+
import dotty.tools.dotc.CompilationUnit
4+
import dotty.tools.dotc.util.SourceFile
5+
6+
7+
class ReplCompilationUnit(source: SourceFile) extends CompilationUnit(source):
8+
override def isSuspendable: Boolean = false

0 commit comments

Comments
 (0)