File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
compiler/src/dotty/tools/dotc/fromtasty
doc-tool/src/dotty/tools/dottydoc Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class ReadTastyTreesFromClasses extends FrontEnd {
33
33
}
34
34
35
35
def alreadyLoaded (): None .type = {
36
- ctx.warning(s " sclass $className cannot be unpickled because it is already loaded " )
36
+ ctx.warning(s " class $className cannot be unpickled because it is already loaded " )
37
37
None
38
38
}
39
39
Original file line number Diff line number Diff line change @@ -3,8 +3,12 @@ package dottydoc
3
3
4
4
import core ._
5
5
import core .transform ._
6
+ import dotc .core .Contexts .Context
6
7
import dotc .core .Phases .Phase
7
- import dotc .Compiler
8
+ import dotc .core .Mode
9
+ import dotc .{Compiler , Run }
10
+
11
+ import dotty .tools .dotc .fromtasty .{ReadTastyTreesFromClasses , TASTYRun }
8
12
9
13
/** Custom Compiler with phases for the documentation tool
10
14
*
@@ -20,6 +24,15 @@ import dotc.Compiler
20
24
*/
21
25
class DocCompiler extends Compiler {
22
26
27
+ override def newRun (implicit ctx : Context ): Run = {
28
+ if (ctx.settings.fromTasty.value) {
29
+ reset()
30
+ new TASTYRun (this , ctx.addMode(Mode .ReadPositions ).addMode(Mode .ReadComments ))
31
+ } else {
32
+ super .newRun
33
+ }
34
+ }
35
+
23
36
override protected def frontendPhases : List [List [Phase ]] =
24
37
List (new DocFrontEnd ) :: Nil
25
38
Original file line number Diff line number Diff line change 1
1
package dotty .tools
2
2
package dottydoc
3
3
4
+ import dotc .fromtasty .ReadTastyTreesFromClasses
4
5
import dotc .typer .FrontEnd
5
6
import dotc .core .Contexts .Context
6
7
import dotc .CompilationUnit
@@ -12,6 +13,16 @@ import dotc.CompilationUnit
12
13
* `discardAfterTyper`.
13
14
*/
14
15
class DocFrontEnd extends FrontEnd {
16
+
17
+ override def runOn (units : List [CompilationUnit ])(implicit ctx : Context ): List [CompilationUnit ] = {
18
+ if (ctx.settings.fromTasty.value) {
19
+ val fromTastyFrontend = new ReadTastyTreesFromClasses
20
+ fromTastyFrontend.runOn(units)
21
+ } else {
22
+ super .runOn(units)
23
+ }
24
+ }
25
+
15
26
override protected def discardAfterTyper (unit : CompilationUnit )(implicit ctx : Context ) =
16
27
unit.isJava
17
28
}
You can’t perform that action at this time.
0 commit comments