Skip to content

Commit bae29e3

Browse files
committed
Add quote cache to staging
Cache is set per run
1 parent c0e7736 commit bae29e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

staging/src/scala/quoted/staging/QuoteDriver.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package staging
44
import dotty.tools.dotc.ast.tpd
55
import dotty.tools.dotc.Driver
66
import dotty.tools.dotc.core.Contexts.{Context, ContextBase, FreshContext}
7+
import dotty.tools.dotc.quoted.QuotesCache
78
import dotty.tools.io.{AbstractFile, Directory, PlainDirectory, VirtualDirectory}
89
import dotty.tools.repl.AbstractFileClassLoader
910
import dotty.tools.dotc.reporting._
@@ -33,8 +34,11 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver:
3334
new VirtualDirectory("<quote compilation output>")
3435
end outDir
3536

36-
val ctx0 = setup(settings.compilerArgs.toArray :+ "dummy.scala", initCtx.fresh).get._2
37-
val ctx = setCompilerSettings(ctx0.fresh.setSetting(ctx0.settings.outputDir, outDir), settings)
37+
val ctx = {
38+
val ctx0 = QuotesCache.init(initCtx.fresh)
39+
val ctx1 = setup(settings.compilerArgs.toArray :+ "dummy.scala", ctx0).get._2
40+
setCompilerSettings(ctx1.fresh.setSetting(ctx1.settings.outputDir, outDir), settings)
41+
}
3842

3943
new QuoteCompiler().newRun(ctx).compileExpr(exprBuilder) match
4044
case Right(value) =>

0 commit comments

Comments
 (0)