Skip to content

Commit e559fe5

Browse files
committed
address feedback: BytecodeWriter extends HasContext
1 parent cefc22f commit e559fe5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/dotty/tools/dotc/backend/jvm/BytecodeWriters.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,20 @@ trait BytecodeWriters {
4545
val emitAsmp = ctx0.base.settings.Ygenasmp.isSetByUser
4646
val doDump = ctx0.base.settings.Ydumpclasses.isSetByUser
4747
(emitAsmp, doDump) match {
48-
case (false, false) => new ClassBytecodeWriter { }
48+
case (false, false) => new ClassBytecodeWriter { val ctx = ctx0 }
4949
case (false, true ) => new ClassBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
5050
case (true, false) => new ClassBytecodeWriter with AsmpBytecodeWriter { val ctx = ctx0 }
5151
case (true, true ) => new ClassBytecodeWriter with AsmpBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
5252
}
5353
}
5454

55-
trait BytecodeWriter {
55+
trait BytecodeWriter extends HasContext {
5656
def writeClass(label: String, jclassName: String, jclassBytes: Array[Byte], outfile: AbstractFile): Unit
5757
def close(): Unit = ()
5858
}
5959

6060
class DirectToJarfileWriter(jfile: JFile)(implicit protected val ctx: Context)
61-
extends BytecodeWriter
62-
with HasContext {
61+
extends BytecodeWriter {
6362
val jarMainAttrs = (
6463
if (ctx.settings.mainClass.isDefault) Nil
6564
else List(Name.MAIN_CLASS -> ctx.settings.mainClass.value)
@@ -88,7 +87,7 @@ trait BytecodeWriters {
8887
* their expansion by ASM is more readable.
8988
*
9089
* */
91-
trait AsmpBytecodeWriter extends BytecodeWriter with HasContext {
90+
trait AsmpBytecodeWriter extends BytecodeWriter {
9291
import dotty.tools.asm
9392

9493
private val baseDir = Directory(ctx.settings.Ygenasmp.value).createDirectory()
@@ -129,7 +128,7 @@ trait BytecodeWriters {
129128
}
130129
}
131130

132-
trait DumpBytecodeWriter extends BytecodeWriter with HasContext {
131+
trait DumpBytecodeWriter extends BytecodeWriter {
133132
val baseDir = Directory(ctx.settings.Ydumpclasses.value).createDirectory()
134133

135134
abstract override def writeClass(label: String, jclassName: String, jclassBytes: Array[Byte], outfile: AbstractFile): Unit = {

0 commit comments

Comments
 (0)