Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Jan 14, 2021
1 parent 8615e3f commit 593cff2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 51 deletions.
36 changes: 0 additions & 36 deletions amm/interp/src/main/scala/ammonite/interp/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import scala.tools.nsc.classpath.{
import scala.tools.nsc.{CustomZipAndJarFileLookupFactory, Global, Settings}
import scala.tools.nsc.interactive.Response
import scala.tools.nsc.plugins.Plugin
import scala.util.Try


/**
Expand All @@ -43,7 +42,6 @@ trait Compiler{
userCodeNestingLevel: Int,
fileName: String): Option[Compiler.Output]

def search(name: scala.reflect.runtime.universe.Type): Option[String]
/**
* Either the statements that were parsed or the error message
*/
Expand Down Expand Up @@ -276,40 +274,6 @@ object Compiler{
(vd, reporter, scalac)
}

def search(target: scala.reflect.runtime.universe.Type) = {
def resolve(path: String*): compiler.Symbol = {
var curr = path.toList
var start: compiler.Symbol = compiler.RootClass
while(curr != Nil){
val head :: rest = curr
start = start.typeSignature.member(compiler.newTermName(head))
curr = rest
}
start
}
var thingsInScope = Map[compiler.Symbol, List[compiler.Name]](
resolve() -> List(),
resolve("java", "lang") -> List(),
resolve("scala") -> List(),
resolve("scala", "Predef") -> List()
)
var level = 5
var found: Option[String] = None
while(level > 0){
thingsInScope = for {
(sym, path) <- thingsInScope
// No clue why this one blows up
m <- Try(sym.typeSignature.members).toOption.toSeq.flatten
} yield (m, m.name :: path)
thingsInScope.find(target.typeSymbol.fullName == _._1.fullName).foreach{ path =>
level = 0
found = Some(path._2.mkString("."))
}
}
found
}



/**
* Compiles a blob of bytes and spits of a list of classfiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ class CompilerLifecycleManager(
pressy.complete(offset, previousImports, snippet)
}

def search(target: scala.reflect.runtime.universe.Type) = synchronized{
init()
compiler.search(target)
}

def compileClass(processed: Preprocessor.Output,
printer: Printer,
fileName: String): Res[Compiler.Output] = synchronized{
Expand Down
11 changes: 1 addition & 10 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ trait AmmModule extends AmmInternalModule with PublishModule{
)
)

def transitiveSources: T[Seq[PathRef]] = T{
mill.define.Task.traverse(this +: moduleDeps)(m =>
T.task{m.sources()}
)().flatten
}

def transitiveJars: T[Agg[PathRef]] = T{
mill.define.Task.traverse(this +: moduleDeps)(m =>
T.task{m.jar()}
Expand All @@ -123,7 +117,6 @@ trait AmmModule extends AmmInternalModule with PublishModule{

}
trait AmmDependenciesResourceFileModule extends JavaModule{
def crossScalaVersion: String
def dependencyResourceFileName: String
def dependencyFileResources = T{
val deps0 = T.task{compileIvyDeps() ++ transitiveIvyDeps()}()
Expand All @@ -136,7 +129,6 @@ trait AmmDependenciesResourceFileModule extends JavaModule{


Seq(PathRef(generateDependenciesFile(
crossScalaVersion,
dependencyResourceFileName,
res.minDependencies.toSeq
)))
Expand Down Expand Up @@ -548,8 +540,7 @@ def generateConstantsFile(version: String = buildVersion,
ctx.dest/"Constants.scala"
}

def generateDependenciesFile(scalaVersion: String,
fileName: String,
def generateDependenciesFile(fileName: String,
deps: Seq[coursier.Dependency])
(implicit ctx: mill.util.Ctx.Dest) = {

Expand Down

0 comments on commit 593cff2

Please sign in to comment.