Skip to content

Commit 4c17df3

Browse files
committed
WIP
1 parent a1b96bf commit 4c17df3

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object ConsumeTasty {
1616
new TastyFromClass(tastyConsumer)
1717
}
1818

19-
val currentClasspath = QuoteDriver.currentClasspath
19+
val currentClasspath = QuoteDriver.currentClasspath(getClass.getClassLoader)
2020
import java.io.File.{ pathSeparator => sep }
2121
val args = "-from-tasty" :: "-Yretain-trees" :: "-classpath" :: s"$classpath$sep$currentClasspath" :: classes
2222
(new Consume).process(args.toArray)

compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class QuoteDriver(cl: ClassLoader) extends Driver {
8787

8888
override def initCtx: Context = {
8989
val ictx = contextBase.initialCtx
90-
ictx.settings.classpath.update(QuoteDriver.currentClasspath)(ictx)
90+
ictx.settings.classpath.update(QuoteDriver.currentClasspath(cl))(ictx)
9191
ictx
9292
}
9393

@@ -99,9 +99,9 @@ class QuoteDriver(cl: ClassLoader) extends Driver {
9999

100100
object QuoteDriver {
101101

102-
def currentClasspath: String = {
102+
def currentClasspath(cl: ClassLoader): String = {
103103
val classpath0 = System.getProperty("java.class.path")
104-
this.getClass.getClassLoader match {
104+
cl match {
105105
case cl: URLClassLoader =>
106106
// Loads the classes loaded by this class loader
107107
// When executing `run` or `test` in sbt the classpath is not in the property java.class.path

compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object ToolboxImpl {
1111

1212
def make(settings: scala.quoted.Toolbox.Settings): scala.quoted.Toolbox = new scala.quoted.Toolbox {
1313

14-
private[this] val driver: QuoteDriver = new QuoteDriver()
14+
private[this] val driver: QuoteDriver = new QuoteDriver(getClass.getClassLoader)
1515

1616
def run[T](expr: Expr[T]): T = expr match {
1717
case expr: LiftedExpr[T] =>
@@ -27,9 +27,9 @@ object ToolboxImpl {
2727
def show[T](tpe: Type[T]): String = synchronized(driver.show(tpe, settings))
2828
}
2929

30-
def make2(settings: scala.quoted.Toolbox.Settings): scala.quoted.Toolbox = new scala.quoted.Toolbox {
30+
def make2(settings: scala.quoted.Toolbox.Settings, cl: ClassLoader): scala.quoted.Toolbox = new scala.quoted.Toolbox {
3131

32-
private[this] val driver: QuoteDriver = new QuoteDriver()
32+
private[this] val driver: QuoteDriver = new QuoteDriver(cl)
3333

3434
def run[T](expr: Expr[T]): T = expr match {
3535
case expr: LiftedExpr[T] =>
@@ -42,5 +42,7 @@ object ToolboxImpl {
4242

4343
def show[T](expr: Expr[T]): String = synchronized(driver.show(expr, settings))
4444

45+
def show[T](tpe: Type[T]): String = synchronized(driver.show(tpe, settings))
4546
}
47+
4648
}

library/src/scala/quoted/Toolbox.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object Toolbox {
1919
def make2(cl: ClassLoader)(implicit settings: Settings): Toolbox = {
2020
try {
2121
val toolboxImplCls = cl.loadClass("dotty.tools.dotc.quoted.ToolboxImpl")
22-
val makeMeth = toolboxImplCls.getMethod("make2", classOf[Settings])
22+
val makeMeth = toolboxImplCls.getMethod("make2", classOf[Settings], classOf[ClassLoader])
2323
makeMeth.invoke(null, settings, cl).asInstanceOf[Toolbox]
2424
}
2525
catch {

0 commit comments

Comments
 (0)