forked from dotty-staging/dotty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marek Żarnowski
committed
Mar 7, 2019
1 parent
ae2eb54
commit df342cd
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package tasty4scalac | ||
|
||
import dotty.tools.dotc.core.Comments.{ContextDoc, ContextDocstrings} | ||
import dotty.tools.dotc.core.Contexts | ||
import dotty.tools.dotc.core.Contexts.ContextBase | ||
import dotty.tools.dotc.reporting.Reporter.NoReporter | ||
import dotty.tools.io.VirtualDirectory | ||
import tasty4scalac.Compiler.Factory | ||
|
||
final class Dotty(val ctx: Contexts.Context) extends dotty.tools.dotc.Compiler with Compiler { | ||
override def compile(code: String): Unit = newRun(ctx.fresh).compile(code) | ||
} | ||
|
||
object Dotty extends Factory { | ||
private val classpath = System.getProperty("dotty.classpath") | ||
|
||
override def apply(): Compiler = { | ||
implicit val ctx: Contexts.FreshContext = new ContextBase().initialCtx.fresh | ||
ctx.setSetting(ctx.settings.classpath, classpath) | ||
ctx.setSetting(ctx.settings.YtestPickler, true) | ||
ctx.setSetting(ctx.settings.encoding, "UTF8") | ||
ctx.setSetting(ctx.settings.outputDir, new VirtualDirectory("<quote compilation output>")) | ||
|
||
ctx.setReporter(NoReporter) | ||
ctx.setProperty(ContextDoc, new ContextDocstrings) | ||
new Dotty(ctx) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters