Skip to content

Commit 6e73f81

Browse files
committed
Plugin test harness internal improvements.
1 parent df68fbf commit 6e73f81

File tree

2 files changed

+16
-73
lines changed

2 files changed

+16
-73
lines changed

scalac-scoverage-plugin/src/test/scala/scoverage/LocationCompiler.scala

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools
2727

2828
class LocationSetter(val global: Global) extends PluginComponent with TypingTransformers with Transform {
2929

30-
override val phaseName: String = "location-setter"
31-
override val runsAfter: List[String] = List("typer")
32-
override val runsBefore = List[String]("patmat")
30+
override val phaseName = "location-setter"
31+
override val runsAfter = List("typer")
32+
override val runsBefore = List("patmat")
3333

3434
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
3535
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -44,35 +44,7 @@ class LocationCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tools
4444
}
4545

4646
override def computeInternalPhases() {
47-
val phs = List(
48-
syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring",
49-
analyzer.namerFactory -> "resolve names, attach symbols to named trees",
50-
analyzer.packageObjects -> "load package objects",
51-
analyzer.typerFactory -> "the meat and potatoes: type the trees",
52-
locationSetter -> "sets locations",
53-
patmat -> "translate match expressions",
54-
superAccessors -> "add super accessors in traits and nested classes",
55-
extensionMethods -> "add extension methods for inline classes",
56-
pickler -> "serialize symbol tables",
57-
refChecks -> "reference/override checking, translate nested objects",
58-
uncurry -> "uncurry, translate function values to anonymous classes",
59-
tailCalls -> "replace tail calls by jumps",
60-
specializeTypes -> "@specialized-driven class and method specialization",
61-
explicitOuter -> "this refs to outer pointers, translate patterns",
62-
erasure -> "erase types, add interfaces for traits",
63-
postErasure -> "clean up erased inline classes",
64-
lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs",
65-
lambdaLift -> "move nested functions to top level",
66-
constructors -> "move field definitions into constructors",
67-
mixer -> "mixin composition",
68-
cleanup -> "platform-specific cleanups, generate reflective calls",
69-
genicode -> "generate portable intermediate code",
70-
inliner -> "optimization: do inlining",
71-
inlineExceptionHandlers -> "optimization: inline exception handlers",
72-
closureElimination -> "optimization: eliminate uncalled closures",
73-
deadCode -> "optimization: eliminate dead code",
74-
terminal -> "The last phase in the compiler chain"
75-
)
76-
phs foreach (addToPhasesSet _).tupled
47+
super.computeInternalPhases()
48+
addToPhasesSet(locationSetter, "sets locations")
7749
}
78-
}
50+
}

scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
111111

112112
class PositionValidator(val global: Global) extends PluginComponent with TypingTransformers with Transform {
113113

114-
override val phaseName: String = "scoverage-validator"
115-
override val runsAfter: List[String] = List("typer")
116-
override val runsBefore = List[String]("scoverage-instrumentation")
114+
override val phaseName = "scoverage-validator"
115+
override val runsAfter = List("typer")
116+
override val runsBefore = List("scoverage-instrumentation")
117117

118118
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
119119
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -129,10 +129,9 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
129129

130130
val sources = new ListBuffer[String]
131131

132-
override val phaseName: String = "scoverage-teststore"
133-
override val runsAfter: List[String] = List("dce")
134-
// deadcode
135-
override val runsBefore = List[String]("terminal")
132+
override val phaseName = "scoverage-teststore"
133+
override val runsAfter = List("dce")
134+
override val runsBefore = List("terminal")
136135

137136
override protected def newTransformer(unit: global.CompilationUnit): global.Transformer = new Transformer(unit)
138137
class Transformer(unit: global.CompilationUnit) extends TypingTransformer(unit) {
@@ -145,38 +144,10 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, reporter: scala.tool
145144
}
146145

147146
override def computeInternalPhases() {
148-
val phs = List(
149-
syntaxAnalyzer -> "parse source into ASTs, perform simple desugaring",
150-
analyzer.namerFactory -> "resolve names, attach symbols to named trees",
151-
analyzer.packageObjects -> "load package objects",
152-
analyzer.typerFactory -> "the meat and potatoes: type the trees",
153-
validator -> "scoverage validator",
154-
instrumentationComponent -> "scoverage instrumentationComponent",
155-
patmat -> "translate match expressions",
156-
superAccessors -> "add super accessors in traits and nested classes",
157-
extensionMethods -> "add extension methods for inline classes",
158-
pickler -> "serialize symbol tables",
159-
refChecks -> "reference/override checking, translate nested objects",
160-
uncurry -> "uncurry, translate function values to anonymous classes",
161-
tailCalls -> "replace tail calls by jumps",
162-
specializeTypes -> "@specialized-driven class and method specialization",
163-
explicitOuter -> "this refs to outer pointers, translate patterns",
164-
erasure -> "erase types, add interfaces for traits",
165-
postErasure -> "clean up erased inline classes",
166-
lazyVals -> "allocate bitmaps, translate lazy vals into lazified defs",
167-
lambdaLift -> "move nested functions to top level",
168-
constructors -> "move field definitions into constructors",
169-
mixer -> "mixin composition",
170-
cleanup -> "platform-specific cleanups, generate reflective calls",
171-
genicode -> "generate portable intermediate code",
172-
inliner -> "optimization: do inlining",
173-
inlineExceptionHandlers -> "optimization: inline exception handlers",
174-
closureElimination -> "optimization: eliminate uncalled closures",
175-
deadCode -> "optimization: eliminate dead code",
176-
testStore -> "scoverage teststore",
177-
terminal -> "The last phase in the compiler chain"
178-
)
179-
phs foreach (addToPhasesSet _).tupled
147+
super.computeInternalPhases()
148+
addToPhasesSet(validator, "scoverage validator")
149+
addToPhasesSet(instrumentationComponent, "scoverage instrumentationComponent")
150+
addToPhasesSet(testStore, "scoverage teststore")
180151
}
181152
}
182153

0 commit comments

Comments
 (0)