File tree 4 files changed +10
-8
lines changed
compiler/src/dotty/tools/dotc
4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ object ConsumeTasty {
16
16
new TastyFromClass (tastyConsumer)
17
17
}
18
18
19
- val currentClasspath = QuoteDriver .currentClasspath
19
+ val currentClasspath = QuoteDriver .currentClasspath(getClass.getClassLoader)
20
20
import java .io .File .{ pathSeparator => sep }
21
21
val args = " -from-tasty" :: " -Yretain-trees" :: " -classpath" :: s " $classpath$sep$currentClasspath" :: classes
22
22
(new Consume ).process(args.toArray)
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ class QuoteDriver(cl: ClassLoader) extends Driver {
87
87
88
88
override def initCtx : Context = {
89
89
val ictx = contextBase.initialCtx
90
- ictx.settings.classpath.update(QuoteDriver .currentClasspath)(ictx)
90
+ ictx.settings.classpath.update(QuoteDriver .currentClasspath(cl) )(ictx)
91
91
ictx
92
92
}
93
93
@@ -99,9 +99,9 @@ class QuoteDriver(cl: ClassLoader) extends Driver {
99
99
100
100
object QuoteDriver {
101
101
102
- def currentClasspath : String = {
102
+ def currentClasspath ( cl : ClassLoader ) : String = {
103
103
val classpath0 = System .getProperty(" java.class.path" )
104
- this .getClass.getClassLoader match {
104
+ cl match {
105
105
case cl : URLClassLoader =>
106
106
// Loads the classes loaded by this class loader
107
107
// When executing `run` or `test` in sbt the classpath is not in the property java.class.path
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ object ToolboxImpl {
11
11
12
12
def make (settings : scala.quoted.Toolbox .Settings ): scala.quoted.Toolbox = new scala.quoted.Toolbox {
13
13
14
- private [this ] val driver : QuoteDriver = new QuoteDriver ()
14
+ private [this ] val driver : QuoteDriver = new QuoteDriver (getClass.getClassLoader )
15
15
16
16
def run [T ](expr : Expr [T ]): T = expr match {
17
17
case expr : LiftedExpr [T ] =>
@@ -27,9 +27,9 @@ object ToolboxImpl {
27
27
def show [T ](tpe : Type [T ]): String = synchronized (driver.show(tpe, settings))
28
28
}
29
29
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 {
31
31
32
- private [this ] val driver : QuoteDriver = new QuoteDriver ()
32
+ private [this ] val driver : QuoteDriver = new QuoteDriver (cl )
33
33
34
34
def run [T ](expr : Expr [T ]): T = expr match {
35
35
case expr : LiftedExpr [T ] =>
@@ -42,5 +42,7 @@ object ToolboxImpl {
42
42
43
43
def show [T ](expr : Expr [T ]): String = synchronized (driver.show(expr, settings))
44
44
45
+ def show [T ](tpe : Type [T ]): String = synchronized (driver.show(tpe, settings))
45
46
}
47
+
46
48
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ object Toolbox {
19
19
def make2 (cl : ClassLoader )(implicit settings : Settings ): Toolbox = {
20
20
try {
21
21
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 ] )
23
23
makeMeth.invoke(null , settings, cl).asInstanceOf [Toolbox ]
24
24
}
25
25
catch {
You can’t perform that action at this time.
0 commit comments