@@ -14,19 +14,17 @@ import dotty.tools.unsupported
14
14
15
15
class Parser extends Phase {
16
16
17
- override def phaseName : String = " parsing "
17
+ override def phaseName : String = Parser .name
18
18
19
19
// We run TreeChecker only after type checking
20
20
override def isCheckable : Boolean = false
21
21
22
- override def isRunnable (implicit ctx : Context ): Boolean = true
23
-
24
22
/** The position of the first XML literal encountered while parsing,
25
23
* NoSourcePosition if there were no XML literals.
26
24
*/
27
25
private [dotc] var firstXmlPos : SourcePosition = NoSourcePosition
28
26
29
- def parse (using Context ) = monitor(" parsing " ) {
27
+ def parse (using Context ) = monitor(" parser " ) {
30
28
val unit = ctx.compilationUnit
31
29
unit.untpdTree =
32
30
if (unit.isJava) new JavaParsers .JavaParser (unit.source).parse()
@@ -39,7 +37,7 @@ class Parser extends Phase {
39
37
tree
40
38
}
41
39
42
- val printer = if (ctx.settings.Xprint .value.contains(" parser " )) default else typr
40
+ val printer = if (ctx.settings.Xprint .value.contains(Parser .name )) default else typr
43
41
printer.println(" parsed:\n " + unit.untpdTree.show)
44
42
if (Config .checkPositions)
45
43
unit.untpdTree.checkPos(nonOverlapping = ! unit.isJava && ! ctx.reporter.hasErrors)
@@ -49,7 +47,7 @@ class Parser extends Phase {
49
47
override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] = {
50
48
val unitContexts =
51
49
for unit <- units yield
52
- report.inform(s " running parser on ${unit.source}" )
50
+ report.inform(s " parsing ${unit.source}" )
53
51
ctx.fresh.setCompilationUnit(unit).withRootImports
54
52
55
53
unitContexts.foreach(parse(using _))
@@ -60,3 +58,7 @@ class Parser extends Phase {
60
58
61
59
def run (using Context ): Unit = unsupported(" run" )
62
60
}
61
+
62
+ object Parser {
63
+ val name : String = " parser"
64
+ }
0 commit comments