Skip to content

Commit 7451dca

Browse files
committed
Make sure to use Context with correct compilationUnit, otherwise source lines would be incorrect
1 parent 44fca94 commit 7451dca

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

compiler/src/dotty/tools/backend/jvm/CodeGen.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
4545

4646
private lazy val mirrorCodeGen = Impl.JMirrorBuilder()
4747

48-
def apply()(using Context): Unit = {
49-
val unit = ctx.compilationUnit
48+
def gen(unit: CompilationUnit): Unit = {
5049
val postProcessor = Phases.genBCodePhase match {
5150
case genBCode: GenBCode => genBCode.postProcessor
5251
case _ => null

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import StdNames.nme
2424
import NameKinds.LazyBitMapName
2525
import Names.Name
2626

27-
class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap: ReadOnlyMap[Symbol, Set[ClassSymbol]])(using val ctx: Context) {
27+
class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap: ReadOnlyMap[Symbol, Set[ClassSymbol]])(using var ctx: Context) {
2828

2929
private val desugared = new java.util.IdentityHashMap[Type, tpd.Select]
3030

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ class GenBCode extends Phase { self =>
104104
}
105105

106106
override def run(using Context): Unit =
107-
codeGen()
107+
backendInterface.ctx = summon[Context]
108+
codeGen.gen(ctx.compilationUnit)
108109

109110
override def runOn(units: List[CompilationUnit])(using ctx:Context): List[CompilationUnit] = {
110111
try

compiler/src/dotty/tools/backend/jvm/PostProcessorFrontendAccess.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object PostProcessorFrontendAccess {
4949
extension [T](s: dotty.tools.dotc.config.Settings.Setting[T])
5050
def valueSetByUser: Option[T] =
5151
Option(s.value).filter(_ != s.default)
52-
import ctx.{settings as s}
52+
def s = ctx.settings
5353

5454
lazy val target =
5555
val releaseValue = Option(ctx.settings.javaOutputVersion.value).filter(_.nonEmpty)

0 commit comments

Comments
 (0)