Skip to content

Commit 011b3a7

Browse files
authored
Merge pull request #9099 from dotty-staging/cleanup-backend-interface
2 parents 6414e3f + bf7b5b3 commit 011b3a7

22 files changed

+1011
-2348
lines changed

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ package dotty.tools
22
package backend
33
package jvm
44

5+
import dotty.tools.dotc.core.Flags._
6+
import dotty.tools.dotc.core.Symbols._
7+
58
/**
69
* This trait contains code shared between GenBCode and GenASM that depends on types defined in
710
* the compiler cake (Global).
811
*/
9-
final class BCodeAsmCommon[I <: BackendInterface](val interface: I) {
12+
final class BCodeAsmCommon[I <: DottyBackendInterface](val interface: I) {
1013
import interface._
14+
import DottyBackendInterface.symExtensions
1115

1216
/**
1317
* True if `classSym` is an anonymous class or a local class. I.e., false if `classSym` is a
@@ -53,7 +57,7 @@ final class BCodeAsmCommon[I <: BackendInterface](val interface: I) {
5357
assert(classSym.isClass, classSym)
5458
def enclosingMethod(sym: Symbol): Option[Symbol] = {
5559
if (sym.isClass || sym == NoSymbol) None
56-
else if (sym.isMethod) Some(sym)
60+
else if (sym.is(Method)) Some(sym)
5761
else enclosingMethod(sym.originalOwner.originalLexicallyEnclosingClass)
5862
}
5963
enclosingMethod(classSym.originalOwner.originalLexicallyEnclosingClass)
@@ -85,10 +89,10 @@ final class BCodeAsmCommon[I <: BackendInterface](val interface: I) {
8589
def enclosingMethodAttribute(classSym: Symbol, classDesc: Symbol => String, methodDesc: Symbol => String): Option[EnclosingMethodEntry] = {
8690
if (isAnonymousOrLocalClass(classSym)) {
8791
val methodOpt = enclosingMethodForEnclosingMethodAttribute(classSym)
88-
debuglog(s"enclosing method for $classSym is $methodOpt (in ${methodOpt.map(_.enclClass)})")
92+
ctx.debuglog(s"enclosing method for $classSym is $methodOpt (in ${methodOpt.map(_.enclosingClass)})")
8993
Some(EnclosingMethodEntry(
9094
classDesc(enclosingClassForEnclosingMethodAttribute(classSym)),
91-
methodOpt.map(_.javaSimpleName.toString).orNull,
95+
methodOpt.map(_.javaSimpleName).orNull,
9296
methodOpt.map(methodDesc).orNull))
9397
} else {
9498
None

0 commit comments

Comments
 (0)