Skip to content

Commit e4eed7b

Browse files
committed
Remove duplicate implementation of isLocal
1 parent b769005 commit e4eed7b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import scala.tools.nsc.backend.jvm._
1313
import dotty.tools.dotc
1414
import dotty.tools.dotc.backend.jvm.DottyPrimitives
1515
import dotty.tools.dotc.transform.Erasure
16+
import dotty.tools.dotc.transform.SymUtils._
1617
import dotty.tools.dotc.interfaces
1718
import java.util.Optional
1819

@@ -265,7 +266,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
265266
// ----------- sbt's callbacks
266267

267268
val (fullClassName, isLocal) = ctx.atPhase(ctx.sbtExtractDependenciesPhase) { implicit ctx =>
268-
(ExtractDependencies.classNameAsString(claszSymbol), ExtractDependencies.isLocal(claszSymbol))
269+
(ExtractDependencies.classNameAsString(claszSymbol), claszSymbol.isLocal)
269270
}
270271

271272
for ((cls, clsFile) <- classNodes.zip(classFiles)) {

compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import core._, core.Decorators._
66
import util.NoSource.{file => NoSourceFile}
77
import Contexts._, Flags._, Phases._, Trees._, Types._, Symbols._
88
import Names._, NameOps._, StdNames._
9+
import transform.SymUtils._
910

1011
import scala.collection.{Set, mutable}
1112

@@ -151,9 +152,6 @@ object ExtractDependencies {
151152
def classNameAsString(sym: Symbol)(implicit ctx: Context): String =
152153
sym.fullName.stripModuleClassSuffix.toString
153154

154-
def isLocal(sym: Symbol)(implicit ctx: Context): Boolean =
155-
sym.ownersIterator.exists(_.isTerm)
156-
157155
/** Return the enclosing class or the module class if it's a module. */
158156
def enclOrModuleClass(dep: Symbol)(implicit ctx: Context): Symbol =
159157
if (dep.is(ModuleVal)) dep.moduleClass else dep.enclosingClass
@@ -301,7 +299,7 @@ private class ExtractDependenciesCollector extends tpd.TreeTraverser { thisTreeT
301299
private def addInheritanceDependency(tree: Template)(implicit ctx: Context): Unit =
302300
if (tree.parents.nonEmpty) {
303301
val depContext =
304-
if (isLocal(tree.symbol.owner)) LocalDependencyByInheritance
302+
if (tree.symbol.owner.isLocal) LocalDependencyByInheritance
305303
else DependencyByInheritance
306304
val from = resolveDependencySource
307305
tree.parents.foreach { parent =>

0 commit comments

Comments
 (0)