Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify RawQuoted instantiations
  • Loading branch information
nicolasstucki committed Jan 8, 2018
commit 2bd3b6f341df2a5eb2d5db0832795fa05968f6c9
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import config.Printers.pickling
import typer.Checking
import config.Config
import dotty.tools.dotc.quoted.PickledQuotes
import dotty.tools.dotc.interpreter.RawExpr
import dotty.tools.dotc.interpreter.RawQuoted
import scala.quoted.Expr

/** Unpickler for typed trees
Expand Down Expand Up @@ -1035,7 +1035,7 @@ class TreeUnpickler(reader: TastyReader,
val splice = splices(idx)
val expr =
if (args.isEmpty) splice.asInstanceOf[Expr[_]]
else splice.asInstanceOf[Seq[Any] => Expr[_]](args.map(arg => new RawExpr(arg)))
else splice.asInstanceOf[Seq[Any] => Expr[_]](args.map(RawQuoted.apply))
PickledQuotes.quotedToTree(expr)
case _ =>
readPathTerm()
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/interpreter/Interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class Interpreter(implicit ctx: Context) {
try {
tree match {
case Apply(_, quote :: Nil) if tree.symbol eq defn.quoteMethod =>
new RawExpr(quote)
RawQuoted(quote)
case TypeApply(_, quote :: Nil) if tree.symbol eq defn.typeQuoteMethod =>
new RawType(quote)
RawQuoted(quote)

case Literal(Constant(c)) =>
c.asInstanceOf[AnyRef]
Expand Down
6 changes: 0 additions & 6 deletions compiler/src/dotty/tools/dotc/interpreter/RawExpr.scala

This file was deleted.

10 changes: 10 additions & 0 deletions compiler/src/dotty/tools/dotc/interpreter/RawQuoted.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ trait RawQuoted extends quoted.Quoted {
def tree: tpd.Tree
override def toString: String = s"${this.getClass.getName}(${tree.toString})"
}

object RawQuoted {

def apply(tree: tpd.Tree): RawQuoted =
if (tree.isTerm) new RawExpr(tree)
else new RawType(tree)

private final class RawExpr(val tree: tpd.Tree) extends quoted.Expr[Any] with RawQuoted
private final class RawType(val tree: tpd.Tree) extends quoted.Type[Any] with RawQuoted
}
6 changes: 0 additions & 6 deletions compiler/src/dotty/tools/dotc/interpreter/RawType.scala

This file was deleted.