File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,11 @@ class Checker extends Phase {
31
31
32
32
override def runOn (units : List [CompilationUnit ])(using Context ): List [CompilationUnit ] =
33
33
val checkCtx = ctx.fresh.setPhase(this .start)
34
- Semantic .withInitialState {
34
+ Semantic .checkTasks( using checkCtx) {
35
35
val traverser = new InitTreeTraverser ()
36
36
units.foreach { unit => traverser.traverse(unit.tpdTree) }
37
- given Context = checkCtx
38
- Semantic .check()
39
- super .runOn(units)
40
37
}
38
+ units
41
39
42
40
def run (using Context ): Unit = {
43
41
// ignore, we already called `Semantic.check()` in `runOn`
Original file line number Diff line number Diff line change @@ -1131,7 +1131,6 @@ object Semantic:
1131
1131
*
1132
1132
*/
1133
1133
def tryPromote (msg : String ): Contextual [List [Error ]] = log(" promote " + warm.show + " , promoted = " + promoted, printer) {
1134
- val classRef = warm.klass.appliedRef
1135
1134
val obj = warm.objekt
1136
1135
1137
1136
def doPromote (klass : ClassSymbol , subClass : ClassSymbol , subClassSegmentHot : Boolean )(using Reporter ): Unit =
@@ -1268,16 +1267,17 @@ object Semantic:
1268
1267
*/
1269
1268
def check ()(using Cache , WorkList , Context ) = workList.work()
1270
1269
1271
- /** Perform actions with initial checking state.
1270
+ /** Check the specified tasks
1272
1271
*
1273
- * Semantic.withInitialState {
1272
+ * Semantic.checkTasks {
1274
1273
* Semantic.addTask(...)
1275
- * ...
1276
- * Semantic.check()
1277
1274
* }
1278
1275
*/
1279
- def withInitialState [T ](work : (Cache , WorkList ) ?=> T ): T =
1280
- work(using new Cache , new WorkList )
1276
+ def checkTasks (using Context )(taskBuilder : WorkList ?=> Unit ): Unit =
1277
+ val workList = new WorkList
1278
+ val cache = new Cache
1279
+ taskBuilder(using workList)
1280
+ Semantic .check()(using cache, workList, ctx)
1281
1281
1282
1282
// ----- Semantic definition --------------------------------
1283
1283
You can’t perform that action at this time.
0 commit comments