File tree 7 files changed +15
-37
lines changed
7 files changed +15
-37
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import core.Contexts.{Context, ContextBase}
6
6
import util .DotClass
7
7
import reporting ._
8
8
import scala .util .control .NonFatal
9
+ import fromtasty .TASTYCompiler
9
10
10
11
/** Run the Dotty compiler.
11
12
*
@@ -15,7 +16,9 @@ import scala.util.control.NonFatal
15
16
*/
16
17
class Driver extends DotClass {
17
18
18
- protected def newCompiler (implicit ctx : Context ): Compiler = new Compiler
19
+ protected def newCompiler (implicit ctx : Context ): Compiler =
20
+ if (ctx.settings.tasty.value) new TASTYCompiler
21
+ else new Compiler
19
22
20
23
protected def emptyReporter : Reporter = new StoreReporter (null )
21
24
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
package dotty .tools
2
2
package dotc
3
3
4
- import core .Contexts .Context
5
-
6
4
/** Main class of the `dotc` batch compiler. */
7
5
object Main extends Driver
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class ScalaSettings extends Settings.SettingGroup {
43
43
val language = MultiStringSetting (" -language" , " feature" , " Enable one or more language features." )
44
44
val rewrite = OptionSetting [Rewrites ](" -rewrite" , " When used in conjunction with -language:Scala2 rewrites sources to migrate to new syntax" )
45
45
val silentWarnings = BooleanSetting (" -nowarn" , " Silence all warnings." )
46
+ val tasty = BooleanSetting (" -tasty" , " Compile classes from tasty in classpath. The arguments are used as class names." )
46
47
47
48
/** -X "Advanced" settings
48
49
*/
Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
395
395
protected def compileFromTasty (flags0 : TestFlags , suppressErrors : Boolean , targetDir : JFile ): TestReporter = {
396
396
val tastyOutput = new JFile (targetDir.getPath + " _from-tasty" )
397
397
tastyOutput.mkdir()
398
- val flags = flags0 and (" -d" , tastyOutput.getAbsolutePath)
398
+ val flags = flags0 and (" -d" , tastyOutput.getAbsolutePath) and " -tasty "
399
399
400
400
def hasTastyFileToClassName (f : JFile ): String =
401
401
targetDir.toPath.relativize(f.toPath).toString.dropRight(" .hasTasty" .length).replace('/' , '.' )
@@ -405,9 +405,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
405
405
TestReporter .reporter(realStdout, logLevel =
406
406
if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR )
407
407
408
+ val driver = new Driver
409
+
408
410
// Compile with a try to catch any StackTrace generated by the compiler:
409
411
try {
410
- dotc. FromTasty .process(flags.all ++ classes, reporter = reporter)
412
+ driver .process(flags.all ++ classes, reporter = reporter)
411
413
}
412
414
catch {
413
415
case NonFatal (ex) => reporter.logStackTrace(ex)
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ default_java_opts="-Xmx768m -Xms768m"
31
31
bootcp=true
32
32
33
33
CompilerMain=dotty.tools.dotc.Main
34
- FromTasty=dotty.tools.dotc.FromTasty
35
34
ReplMain=dotty.tools.repl.Main
36
35
37
36
PROG_NAME=$CompilerMain
@@ -82,7 +81,7 @@ case "$1" in
82
81
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
83
82
-Oshort) addJava " -XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;;
84
83
-repl) PROG_NAME=" $ReplMain " && shift ;;
85
- -tasty) addScala " -Yretain-trees" && PROG_NAME=" $FromTasty " && shift ;;
84
+ -tasty) addScala " -Yretain-trees" && PROG_NAME=" $CompilerMain " && shift ;;
86
85
-compile) PROG_NAME=" $CompilerMain " && shift ;;
87
86
-run) PROG_NAME=" $ReplMain " && shift ;;
88
87
-bootcp) bootcp=true && shift ;;
Original file line number Diff line number Diff line change @@ -523,8 +523,8 @@ object Build {
523
523
}
524
524
},
525
525
run := dotc.evaluated,
526
- dotc := runCompilerMain(Nil ).evaluated,
527
- repl := runCompilerMain(List ( " -repl " ) ).evaluated,
526
+ dotc := runCompilerMain(false ).evaluated,
527
+ repl := runCompilerMain(true ).evaluated,
528
528
529
529
// enable verbose exception messages for JUnit
530
530
testOptions in Test += Tests .Argument (
@@ -618,17 +618,15 @@ object Build {
618
618
}
619
619
)
620
620
621
- def runCompilerMain (otherArgs : List [ String ] ) = Def .inputTaskDyn {
621
+ def runCompilerMain (repl : Boolean ) = Def .inputTaskDyn {
622
622
val dottyLib = packageAll.value(" dotty-library" )
623
- val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList ++ otherArgs
624
- val args = args0.filter(arg => arg != " -tasty " && arg != " - repl" )
623
+ val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
624
+ val args = args0.filter(arg => arg != " -repl" )
625
625
626
- val repl = args0.contains(" -repl" )
627
626
val tasty = args0.contains(" -tasty" )
628
627
629
628
val main =
630
629
if (repl) " dotty.tools.repl.Main"
631
- else if (tasty) " dotty.tools.dotc.FromTasty"
632
630
else " dotty.tools.dotc.Main"
633
631
634
632
val extraArgs =
You can’t perform that action at this time.
0 commit comments