Skip to content

Commit 8374903

Browse files
committed
Merge pull request #1 from lrytz/backendWip
context for ClassBytecodeWriter
2 parents e559fe5 + 698c51c commit 8374903

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ trait BytecodeWriters {
4141
def getFile(sym: Symbol, clsName: String, suffix: String): AbstractFile =
4242
getFile(outputDirectory(sym), clsName, suffix)
4343

44-
def factoryNonJarBytecodeWriter(implicit ctx0: Context): BytecodeWriter = {
45-
val emitAsmp = ctx0.base.settings.Ygenasmp.isSetByUser
46-
val doDump = ctx0.base.settings.Ydumpclasses.isSetByUser
44+
def factoryNonJarBytecodeWriter(implicit ctx: Context): BytecodeWriter = {
45+
val emitAsmp = ctx.settings.Ygenasmp.isSetByUser
46+
val doDump = ctx.settings.Ydumpclasses.isSetByUser
4747
(emitAsmp, doDump) match {
48-
case (false, false) => new ClassBytecodeWriter { val ctx = ctx0 }
49-
case (false, true ) => new ClassBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
50-
case (true, false) => new ClassBytecodeWriter with AsmpBytecodeWriter { val ctx = ctx0 }
51-
case (true, true ) => new ClassBytecodeWriter with AsmpBytecodeWriter with DumpBytecodeWriter { val ctx = ctx0 }
48+
case (false, false) => new ClassBytecodeWriter
49+
case (false, true ) => new ClassBytecodeWriter with DumpBytecodeWriter
50+
case (true, false) => new ClassBytecodeWriter with AsmpBytecodeWriter
51+
case (true, true ) => new ClassBytecodeWriter with AsmpBytecodeWriter with DumpBytecodeWriter
5252
}
5353
}
5454

@@ -116,7 +116,7 @@ trait BytecodeWriters {
116116
}
117117
}
118118

119-
trait ClassBytecodeWriter extends BytecodeWriter {
119+
class ClassBytecodeWriter(implicit protected val ctx: Context) extends BytecodeWriter {
120120
def writeClass(label: String, jclassName: String, jclassBytes: Array[Byte], outfile: AbstractFile): Unit = {
121121
assert(outfile != null,
122122
"Precisely this override requires its invoker to hand out a non-null AbstractFile.")

0 commit comments

Comments
 (0)