@@ -45,21 +45,20 @@ trait BytecodeWriters {
45
45
val emitAsmp = ctx0.base.settings.Ygenasmp .isSetByUser
46
46
val doDump = ctx0.base.settings.Ydumpclasses .isSetByUser
47
47
(emitAsmp, doDump) match {
48
- case (false , false ) => new ClassBytecodeWriter { }
48
+ case (false , false ) => new ClassBytecodeWriter { val ctx = ctx0 }
49
49
case (false , true ) => new ClassBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
50
50
case (true , false ) => new ClassBytecodeWriter with AsmpBytecodeWriter { val ctx = ctx0 }
51
51
case (true , true ) => new ClassBytecodeWriter with AsmpBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
52
52
}
53
53
}
54
54
55
- trait BytecodeWriter {
55
+ trait BytecodeWriter extends HasContext {
56
56
def writeClass (label : String , jclassName : String , jclassBytes : Array [Byte ], outfile : AbstractFile ): Unit
57
57
def close (): Unit = ()
58
58
}
59
59
60
60
class DirectToJarfileWriter (jfile : JFile )(implicit protected val ctx : Context )
61
- extends BytecodeWriter
62
- with HasContext {
61
+ extends BytecodeWriter {
63
62
val jarMainAttrs = (
64
63
if (ctx.settings.mainClass.isDefault) Nil
65
64
else List (Name .MAIN_CLASS -> ctx.settings.mainClass.value)
@@ -88,7 +87,7 @@ trait BytecodeWriters {
88
87
* their expansion by ASM is more readable.
89
88
*
90
89
* */
91
- trait AsmpBytecodeWriter extends BytecodeWriter with HasContext {
90
+ trait AsmpBytecodeWriter extends BytecodeWriter {
92
91
import dotty .tools .asm
93
92
94
93
private val baseDir = Directory (ctx.settings.Ygenasmp .value).createDirectory()
@@ -129,7 +128,7 @@ trait BytecodeWriters {
129
128
}
130
129
}
131
130
132
- trait DumpBytecodeWriter extends BytecodeWriter with HasContext {
131
+ trait DumpBytecodeWriter extends BytecodeWriter {
133
132
val baseDir = Directory (ctx.settings.Ydumpclasses .value).createDirectory()
134
133
135
134
abstract override def writeClass (label : String , jclassName : String , jclassBytes : Array [Byte ], outfile : AbstractFile ): Unit = {
0 commit comments