Skip to content

Commit 0f208ed

Browse files
committed
Add dotl script (short for dot link)
1 parent cb8baed commit 0f208ed

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

compiler/src/dotty/tools/dotc/CompilationUnit.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package dotty.tools
22
package dotc
33

4-
import dotty.tools.dotc.core.Types.Type
5-
import dotty.tools.dotc.core.tasty.{TastyUnpickler, TastyBuffer, TastyPickler}
6-
import util.SourceFile
4+
import util._
75
import ast.{tpd, untpd}
86
import dotty.tools.dotc.ast.tpd.{ Tree, TreeTraverser }
97
import dotty.tools.dotc.core.Contexts.Context
@@ -28,7 +26,7 @@ object CompilationUnit {
2826

2927
/** Make a compilation unit for top class `clsd` with the contends of the `unpickled` */
3028
def mkCompilationUnit(clsd: ClassDenotation, unpickled: Tree, forceTrees: Boolean)(implicit ctx: Context): CompilationUnit = {
31-
val unit1 = new CompilationUnit(new SourceFile(clsd.symbol.sourceFile, Seq()))
29+
val unit1 = new CompilationUnit(new SourceFile(clsd.symbol.associatedFile, Seq()))
3230
unit1.tpdTree = unpickled
3331
if (forceTrees)
3432
force.traverse(unit1.tpdTree)

dist/bin/dotl

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
dotc -tasty -Xlink-optimise $@

project/Build.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,11 @@ object Build {
522522
case (beforeCp, rest) => beforeCp ++ rest
523523
}
524524

525-
(runMain in Compile).toTask(
526-
s" dotty.tools.dotc.Main " + fullArgs.mkString(" ")
527-
)
525+
val main =
526+
if (fullArgs.contains("-Xlink-optimise")) "dotty.tools.dotc.FromTasty"
527+
else "dotty.tools.dotc.Main"
528+
529+
(runMain in Compile).toTask((main +: fullArgs).mkString(" ", " ", ""))
528530
}.evaluated,
529531
dotc := run.evaluated,
530532

0 commit comments

Comments
 (0)