@@ -30,16 +30,13 @@ object Splicer {
3030 *
3131 * See: `ReifyQuotes`
3232 */
33- def splice (tree : Tree , call : Tree , bindings : List [Tree ], pos : Position )(implicit ctx : Context ): Tree = tree match {
33+ def splice (tree : Tree , call : Tree , bindings : List [Tree ], pos : Position , classLoader : ClassLoader )(implicit ctx : Context ): Tree = tree match {
3434 case Quoted (quotedTree) => quotedTree
35- case _ => reflectiveSplice(tree, call, bindings, pos)
36- }
37-
38- private def reflectiveSplice (tree : Tree , call : Tree , bindings : List [Tree ], pos : Position )(implicit ctx : Context ): Tree = {
39- val liftedArgs = getLiftedArgs(call, bindings)
40- val interpreter = new Interpreter (pos)
41- val interpreted = interpreter.interpretCallToSymbol[Seq [Any ] => Object ](call.symbol)
42- interpreted.flatMap(lambda => evaluateLambda(lambda, liftedArgs, pos)).fold(tree)(PickledQuotes .quotedExprToTree)
35+ case _ =>
36+ val liftedArgs = getLiftedArgs(call, bindings)
37+ val interpreter = new Interpreter (pos, classLoader)
38+ val interpreted = interpreter.interpretCallToSymbol[Seq [Any ] => Object ](call.symbol)
39+ interpreted.flatMap(lambda => evaluateLambda(lambda, liftedArgs, pos)).fold(tree)(PickledQuotes .quotedExprToTree)
4340 }
4441
4542 /** Given the inline code and bindings, compute the lifted arguments that will be used to execute the macro
@@ -98,12 +95,7 @@ object Splicer {
9895 * The interpreter assumes that all calls in the trees are to code that was
9996 * previously compiled and is present in the classpath of the current context.
10097 */
101- private class Interpreter (pos : Position )(implicit ctx : Context ) {
102-
103- private [this ] val classLoader = {
104- val urls = ctx.settings.classpath.value.split(':' ).map(cp => java.nio.file.Paths .get(cp).toUri.toURL)
105- new URLClassLoader (urls, getClass.getClassLoader)
106- }
98+ private class Interpreter (pos : Position , classLoader : ClassLoader )(implicit ctx : Context ) {
10799
108100 /** Returns the interpreted result of interpreting the code a call to the symbol with default arguments.
109101 * Return Some of the result or None if some error happen during the interpretation.
0 commit comments