@@ -65,16 +65,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
65
65
import ReifyQuotes ._
66
66
import tpd ._
67
67
68
- /** Classloader used for loading macros */
69
- private [this ] var myMacroClassLoader : java.lang.ClassLoader = _
70
- private def macroClassLoader (implicit ctx : Context ): ClassLoader = {
71
- if (myMacroClassLoader == null ) {
72
- val urls = ctx.settings.classpath.value.split(java.io.File .pathSeparatorChar).map(cp => java.nio.file.Paths .get(cp).toUri.toURL)
73
- myMacroClassLoader = new java.net.URLClassLoader (urls, getClass.getClassLoader)
74
- }
75
- myMacroClassLoader
76
- }
77
-
78
68
override def phaseName : String = ReifyQuotes .name
79
69
80
70
override def checkPostCondition (tree : Tree )(implicit ctx : Context ): Unit = {
@@ -433,11 +423,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
433
423
* are in the body of an inline method.
434
424
*/
435
425
private def splice (splice : Select )(implicit ctx : Context ): Tree = {
436
- // println("+++++++++++++++++++++++++++++++++++++++")
437
- // println(level)
438
- // println(splice)
439
- // println()
440
- // println()
441
426
if (level > 1 ) {
442
427
val body1 = nested(isQuote = false ).transform(splice.qualifier)
443
428
body1.select(splice.name)
@@ -447,27 +432,24 @@ class ReifyQuotes extends MacroTransformWithImplicits {
447
432
val tpe = outer.embedded.getHoleType(splice)
448
433
val hole = makeHole(body1, quotes, tpe).withSpan(splice.span)
449
434
// We do not place add the inline marker for trees that where lifted as they come from the same file as their
450
- // enclosing quote. Any intemediate splice will add it's own Inlined node and cancel it before splicig the lifted tree.
435
+ // enclosing quote. Any intermediate splice will add it's own Inlined node and cancel it before splicig the lifted tree.
451
436
// Note that lifted trees are not necessarily expressions and that Inlined nodes are expected to be expressions.
452
437
// For example we can have a lifted tree containing the LHS of an assignment (see tests/run-with-compiler/quote-var.scala).
453
438
if (splice.isType || outer.embedded.isLiftedSymbol(splice.qualifier.symbol)) hole
454
439
else Inlined (EmptyTree , Nil , hole).withSpan(splice.span)
455
440
}
456
- else if (enclosingInlineds.nonEmpty) { // level 0 in an inlined call
457
- val spliceCtx = ctx.outer // drop the last `inlineContext`
458
- val pos : SourcePosition = spliceCtx.source.atSpan(enclosingInlineds.head.span)
459
- val evaluatedSplice = Splicer .splice(splice.qualifier, pos, macroClassLoader)(spliceCtx).withSpan(splice.span)
460
- if (ctx.reporter.hasErrors) splice else transform(evaluatedSplice)
461
- }
462
441
else if (! ctx.owner.isInlineMethod) { // level 0 outside an inline method
442
+ // TODO assert(...)?
463
443
ctx.error(i " splice outside quotes or inline method " , splice.sourcePos)
464
444
splice
465
445
}
466
446
else if (Splicer .canBeSpliced(splice.qualifier)) { // level 0 inside an inline definition
447
+ // TODO remove?
467
448
nested(isQuote = false ).split(splice.qualifier) // Just check PCP
468
449
splice
469
450
}
470
451
else { // level 0 inside an inline definition
452
+ // TODO remove?
471
453
ctx.error(
472
454
" Malformed macro call. The contents of the ~ must call a static method and arguments must be quoted or inline." .stripMargin,
473
455
splice.sourcePos)
0 commit comments