@@ -34,23 +34,16 @@ object PickledQuotes {
34
34
35
35
/** Transform the expression into its fully spliced Tree */
36
36
def quotedToTree (expr : quoted.Quoted )(implicit ctx : Context ): Tree = expr match {
37
- case expr : quoted.TastyQuoted => unpickleQuote(expr)
38
- case expr : quoted.Liftable .ConstantExpr [_] => Literal (Constant (expr.value))
37
+ case expr : quoted.TastyQuoted =>
38
+ unpickleQuote(expr)
39
+ case expr : quoted.Liftable .ConstantExpr [_] =>
40
+ Literal (Constant (expr.value))
39
41
case expr : quoted.Expr .FunctionAppliedTo [_, _] =>
40
42
functionAppliedTo(quotedToTree(expr.f), quotedToTree(expr.x))
41
43
case expr : quoted.Type .TaggedPrimitive [_] =>
42
- val tpe = expr.ct match {
43
- case ClassTag .Unit => defn.UnitType
44
- case ClassTag .Byte => defn.ByteType
45
- case ClassTag .Char => defn.CharType
46
- case ClassTag .Short => defn.ShortType
47
- case ClassTag .Int => defn.IntType
48
- case ClassTag .Long => defn.LongType
49
- case ClassTag .Float => defn.FloatType
50
- case ClassTag .Double => defn.FloatType
51
- }
52
- TypeTree (tpe)
53
- case expr : RawQuoted => expr.tree
44
+ classTagToTypeTree(expr.ct)
45
+ case expr : RawQuoted =>
46
+ expr.tree
54
47
}
55
48
56
49
/** Unpickle the tree contained in the TastyQuoted */
@@ -115,6 +108,20 @@ object PickledQuotes {
115
108
tree
116
109
}
117
110
111
+ private def classTagToTypeTree (ct : ClassTag [_])(implicit ctx : Context ): TypeTree = {
112
+ val tpe = ct match {
113
+ case ClassTag .Unit => defn.UnitType
114
+ case ClassTag .Byte => defn.ByteType
115
+ case ClassTag .Char => defn.CharType
116
+ case ClassTag .Short => defn.ShortType
117
+ case ClassTag .Int => defn.IntType
118
+ case ClassTag .Long => defn.LongType
119
+ case ClassTag .Float => defn.FloatType
120
+ case ClassTag .Double => defn.FloatType
121
+ }
122
+ TypeTree (tpe)
123
+ }
124
+
118
125
private def functionAppliedTo (f : Tree , x : Tree )(implicit ctx : Context ): Tree = {
119
126
val x1 = SyntheticValDef (NameKinds .UniqueName .fresh(" x" .toTermName), x)
120
127
def x1Ref () = ref(x1.symbol)
0 commit comments