Skip to content

Commit c6037a2

Browse files
Merge pull request #8568 from dotty-staging/cleanup-quotePickling
Use `quotePickling.println`
2 parents 26bee5e + 381c1db commit c6037a2

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

compiler/src/dotty/tools/dotc/core/quoted/PickledQuotes.scala

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ object PickledQuotes {
9898

9999
/** Pickle tree into it's TASTY bytes s*/
100100
private def pickle(tree: Tree)(implicit ctx: Context): Array[Byte] = {
101+
quotePickling.println(i"**** pickling quote of \n${tree.show}")
101102
val pickler = new TastyPickler(defn.RootClass)
102103
val treePkl = pickler.treePkl
103104
treePkl.pickle(tree :: Nil)
@@ -107,32 +108,21 @@ object PickledQuotes {
107108
if (tree.span.exists)
108109
new PositionPickler(pickler, treePkl.buf.addrOfTree).picklePositions(tree :: Nil)
109110

110-
if (quotePickling ne noPrinter)
111-
println(i"**** pickling quote of \n${tree.show}")
112-
113111
val pickled = pickler.assembleParts()
114-
115-
if (quotePickling ne noPrinter)
116-
println(new TastyPrinter(pickled).printContents())
117-
112+
quotePickling.println(s"**** pickled quote\n${new TastyPrinter(pickled).printContents()}")
118113
pickled
119114
}
120115

121116
/** Unpickle TASTY bytes into it's tree */
122117
private def unpickle(bytes: Array[Byte], splices: Seq[Any], isType: Boolean)(implicit ctx: Context): Tree = {
123-
if (quotePickling ne noPrinter) {
124-
println(i"**** unpickling quote from TASTY")
125-
println(new TastyPrinter(bytes).printContents())
126-
}
118+
quotePickling.println(s"**** unpickling quote from TASTY\n${new TastyPrinter(bytes).printContents()}")
127119

128120
val mode = if (isType) UnpickleMode.TypeTree else UnpickleMode.Term
129121
val unpickler = new QuoteUnpickler(bytes, splices, mode)
130122
unpickler.enter(Set.empty)
131-
val tree = unpickler.tree
132-
133-
if (quotePickling ne noPrinter)
134-
println(i"**** unpickle quote ${tree.show}")
135123

124+
val tree = unpickler.tree
125+
quotePickling.println(i"**** unpickle quote ${tree.show}")
136126
tree
137127
}
138128

0 commit comments

Comments
 (0)