Skip to content

Commit 805a9c3

Browse files
committed
wip
1 parent 1efa224 commit 805a9c3

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
6565
import ReifyQuotes._
6666
import tpd._
6767

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-
7868
override def phaseName: String = ReifyQuotes.name
7969

8070
override def checkPostCondition(tree: Tree)(implicit ctx: Context): Unit = {
@@ -433,11 +423,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
433423
* are in the body of an inline method.
434424
*/
435425
private def splice(splice: Select)(implicit ctx: Context): Tree = {
436-
// println("+++++++++++++++++++++++++++++++++++++++")
437-
// println(level)
438-
// println(splice)
439-
// println()
440-
// println()
441426
if (level > 1) {
442427
val body1 = nested(isQuote = false).transform(splice.qualifier)
443428
body1.select(splice.name)
@@ -447,27 +432,24 @@ class ReifyQuotes extends MacroTransformWithImplicits {
447432
val tpe = outer.embedded.getHoleType(splice)
448433
val hole = makeHole(body1, quotes, tpe).withSpan(splice.span)
449434
// 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.
451436
// Note that lifted trees are not necessarily expressions and that Inlined nodes are expected to be expressions.
452437
// For example we can have a lifted tree containing the LHS of an assignment (see tests/run-with-compiler/quote-var.scala).
453438
if (splice.isType || outer.embedded.isLiftedSymbol(splice.qualifier.symbol)) hole
454439
else Inlined(EmptyTree, Nil, hole).withSpan(splice.span)
455440
}
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-
}
462441
else if (!ctx.owner.isInlineMethod) { // level 0 outside an inline method
442+
// TODO assert(...)?
463443
ctx.error(i"splice outside quotes or inline method", splice.sourcePos)
464444
splice
465445
}
466446
else if (Splicer.canBeSpliced(splice.qualifier)) { // level 0 inside an inline definition
447+
// TODO remove?
467448
nested(isQuote = false).split(splice.qualifier) // Just check PCP
468449
splice
469450
}
470451
else { // level 0 inside an inline definition
452+
// TODO remove?
471453
ctx.error(
472454
"Malformed macro call. The contents of the ~ must call a static method and arguments must be quoted or inline.".stripMargin,
473455
splice.sourcePos)

0 commit comments

Comments
 (0)