@@ -88,8 +88,27 @@ class ScoverageAwareCompiler(settings: scala.tools.nsc.Settings, reporter: scala
88
88
89
89
val preComponent = new ScoveragePreComponent (this )
90
90
val instrumentationComponent = new ScoverageInstrumentationComponent (this )
91
- val testStore = new ScoverageTestStoreComponent (this )
92
91
instrumentationComponent.setOptions(new ScoverageOptions ())
92
+ val testStore = new ScoverageTestStoreComponent (this )
93
+ val validator = new PositionValidator (this )
94
+
95
+ class PositionValidator (val global : Global ) extends PluginComponent with TypingTransformers with Transform {
96
+
97
+ val sources = new ListBuffer [String ]
98
+
99
+ override val phaseName : String = " scoverage-validator"
100
+ override val runsAfter : List [String ] = List (" typer" )
101
+ override val runsBefore = List [String ](" scoverage-instrumentation" )
102
+
103
+ override protected def newTransformer (unit : global.CompilationUnit ): global.Transformer = new Transformer (unit)
104
+ class Transformer (unit : global.CompilationUnit ) extends TypingTransformer (unit) {
105
+
106
+ override def transform (tree : global.Tree ) = {
107
+ global.validatePositions(tree)
108
+ tree
109
+ }
110
+ }
111
+ }
93
112
94
113
class ScoverageTestStoreComponent (val global : Global ) extends PluginComponent with TypingTransformers with Transform {
95
114
@@ -116,6 +135,7 @@ class ScoverageAwareCompiler(settings: scala.tools.nsc.Settings, reporter: scala
116
135
analyzer.namerFactory -> " resolve names, attach symbols to named trees" ,
117
136
analyzer.packageObjects -> " load package objects" ,
118
137
analyzer.typerFactory -> " the meat and potatoes: type the trees" ,
138
+ validator -> " scoverage validator" ,
119
139
instrumentationComponent -> " scoverage instrumentationComponent" ,
120
140
patmat -> " translate match expressions" ,
121
141
superAccessors -> " add super accessors in traits and nested classes" ,
0 commit comments