Skip to content

Commit a9cf295

Browse files
committed
WIP
1 parent 0e42211 commit a9cf295

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,33 +221,35 @@ trait BCodeHelpers extends BCodeIdiomatic {
221221
val av = cw.visitAnnotation(typeDescriptor(typ), isRuntimeVisible(annot))
222222
emitAssocs(av, assocs, BCodeHelpers.this)(this)
223223
}
224-
225-
def toJTypeB(tpe: dotty.tools.dotc.transform.TypeB): TypeHints.TypeB =
224+
225+
def toJTypeB(tpe: dotty.tools.dotc.transform.TypeB): TypeHints.TypeB =
226226
tpe match
227227
case dotty.tools.dotc.transform.TypeB.None => TypeHints.TypeB.NO_HINT
228228
case dotty.tools.dotc.transform.TypeB.M(index) => new TypeHints.TypeB(TypeHints.TypeB.M_KIND, index)
229+
case dotty.tools.dotc.transform.TypeB.K(index) => ???
229230
// case _ =>
230231
// report.error("unexpected type in to Java TypeB: " + tpe)
231232
// TypeHints.TypeB.NO_HINT // fallback, should not happen
232233

233-
def addMethodTypeParameterCountAttribute(mw: asm.MethodVisitor, count: Int): Unit =
234+
def addMethodTypeParameterCountAttribute(mw: asm.MethodVisitor, count: Int): Unit =
234235
if (count > 0){
235236
val attr = new MethodTypeParameterCount(count)
236237
mw.visitAttribute(attr)
237238
}
238239

239240
def addMethodReturnTypeAttribute(mw: asm.MethodVisitor, tpe: dotty.tools.dotc.transform.TypeB): Unit =
240-
tpe match
241-
case dotty.tools.dotc.transform.TypeB.M(index) =>
241+
tpe match
242+
case dotty.tools.dotc.transform.TypeB.M(index) =>
242243
val typeB = new TypeHints.TypeB(TypeHints.TypeB.M_KIND, index)
243244
val attr = new MethodReturnType(typeB)
244245
mw.visitAttribute(attr)
245246
case dotty.tools.dotc.transform.TypeB.None => //do nothing
247+
case dotty.tools.dotc.transform.TypeB.K(index) => ???
246248
// case _ =>
247249
// report.error("Unexpected type for method return type attribute: " + tpe)
248-
249250

250-
def addMethodParameterTypeAttribute(mw: asm.MethodVisitor, lst: List[dotty.tools.dotc.transform.TypeB]) : Unit =
251+
252+
def addMethodParameterTypeAttribute(mw: asm.MethodVisitor, lst: List[dotty.tools.dotc.transform.TypeB]) : Unit =
251253
if (lst.isEmpty) return
252254
val lstJTypeB = lst.map(toJTypeB)
253255
val len = lstJTypeB.length

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,13 @@ trait BCodeIdiomatic {
426426
emitInvoke(Opcodes.INVOKEVIRTUAL, owner, name, desc, itf = false)
427427
}
428428

429-
def toJTypeB(tpe: dotty.tools.dotc.transform.TypeB): TypeHints.TypeB =
429+
def toJTypeB(tpe: dotty.tools.dotc.transform.TypeB): TypeHints.TypeB =
430430
tpe match
431431
case dotty.tools.dotc.transform.TypeB.None => TypeHints.TypeB.NO_HINT
432432
case dotty.tools.dotc.transform.TypeB.M(index) => new TypeHints.TypeB(TypeHints.TypeB.M_KIND, index)
433+
case _ => ???
433434

434-
def toJTypeA(tpe: dotty.tools.dotc.transform.TypeA): TypeHints.TypeA =
435+
def toJTypeA(tpe: dotty.tools.dotc.transform.TypeA): TypeHints.TypeA =
435436
tpe match
436437
case dotty.tools.dotc.transform.TypeA.Byte => TypeHints.TypeA.TYPEA_BYTE
437438
case dotty.tools.dotc.transform.TypeA.Char => TypeHints.TypeA.TYPEA_CHAR
@@ -444,9 +445,9 @@ trait BCodeIdiomatic {
444445
case dotty.tools.dotc.transform.TypeA.M(x) => TypeHints.TypeA(TypeHints.TypeA.M_KIND, x)
445446
case dotty.tools.dotc.transform.TypeA.K(x) => TypeHints.TypeA(TypeHints.TypeA.K_KIND, x)
446447
case dotty.tools.dotc.transform.TypeA.Ref => TypeHints.TypeA.TYPEA_REFERENCE
447-
448448

449-
def emitInvoke(opcode: Int, owner: String, name: String, desc: String, itf: Boolean,
449+
450+
def emitInvoke(opcode: Int, owner: String, name: String, desc: String, itf: Boolean,
450451
invokeReturnType : Option[dotty.tools.dotc.transform.TypeB] = None, instrTypeArgs : Option[List[dotty.tools.dotc.transform.TypeA]] = None): Unit = {
451452
val node = new MethodInsnNode(opcode, owner, name, desc, itf)
452453
jmethod.instructions.add(node)

0 commit comments

Comments
 (0)