@@ -1207,31 +1207,23 @@ object Semantic:
12071207 cls == defn.ObjectClass
12081208
12091209// ----- Work list ---------------------------------------------------
1210- case class Task (value : ThisRef )
1211-
1212- class WorkList private [Semantic ]():
1213- private val pendingTasks : mutable.ArrayBuffer [Task ] = new mutable.ArrayBuffer
1214-
1215- def addTask (task : Task ): Unit =
1216- if ! pendingTasks.contains(task) then pendingTasks.append(task)
1217-
1210+ class WorkList private [Semantic ](tasks : List [ClassSymbol ]):
12181211 /** Process the worklist until done */
12191212 final def work ()(using Cache , Context ): Unit =
1220- for task <- pendingTasks
1221- do doTask(task)
1213+ for task <- tasks do doTask(task)
12221214
12231215 /** Check an individual class
12241216 *
12251217 * This method should only be called from the work list scheduler.
12261218 */
1227- private def doTask (task : Task )(using Cache , Context ): Unit =
1228- val thisRef = task.value
1229- val tpl = thisRef.klass .defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
1219+ private def doTask (classSym : ClassSymbol )(using Cache , Context ): Unit =
1220+ val thisRef = ThisRef (classSym)
1221+ val tpl = classSym .defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
12301222
12311223 @ tailrec
12321224 def iterate (): Unit = {
1233- given Promoted = Promoted .empty(thisRef.klass )
1234- given Trace = Trace .empty.add(thisRef.klass .defTree)
1225+ given Promoted = Promoted .empty(classSym )
1226+ given Trace = Trace .empty.add(classSym .defTree)
12351227 given reporter : Reporter .BufferedReporter = new Reporter .BufferedReporter
12361228
12371229 thisRef.ensureFresh()
@@ -1240,7 +1232,7 @@ object Semantic:
12401232 for param <- tpl.constr.termParamss.flatten do
12411233 thisRef.updateField(param.symbol, Hot )
12421234
1243- log(" checking " + task ) { eval(tpl, thisRef, thisRef.klass ) }
1235+ log(" checking " + classSym ) { eval(tpl, thisRef, classSym ) }
12441236 reporter.errors.foreach(_.issue)
12451237
12461238 if cache.hasChanged && reporter.errors.isEmpty then
@@ -1254,23 +1246,15 @@ object Semantic:
12541246 iterate()
12551247 end doTask
12561248 end WorkList
1257- inline def workList (using wl : WorkList ): WorkList = wl
12581249
12591250// ----- API --------------------------------
12601251
1261- /** Add a checking task to the work list */
1262- def addTask (thisRef : ThisRef )(using WorkList ) = workList.addTask(Task (thisRef))
1263-
1264- /** Check the specified tasks
1265- *
1266- * Semantic.checkTasks {
1267- * Semantic.addTask(...)
1268- * }
1252+ /**
1253+ * Check the specified concrete classes
12691254 */
1270- def checkTasks ( using Context )( taskBuilder : WorkList ?=> Unit ): Unit =
1271- val workList = new WorkList
1255+ def checkClasses ( concreteClasses : List [ ClassSymbol ])( using Context ): Unit =
1256+ val workList = new WorkList (concreteClasses)
12721257 val cache = new Cache
1273- taskBuilder(using workList)
12741258 workList.work()(using cache, ctx)
12751259
12761260// ----- Semantic definition --------------------------------
0 commit comments