@@ -1207,31 +1207,23 @@ object Semantic:
1207
1207
cls == defn.ObjectClass
1208
1208
1209
1209
// ----- 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 ]):
1218
1211
/** Process the worklist until done */
1219
1212
final def work ()(using Cache , Context ): Unit =
1220
- for task <- pendingTasks
1221
- do doTask(task)
1213
+ for task <- tasks do doTask(task)
1222
1214
1223
1215
/** Check an individual class
1224
1216
*
1225
1217
* This method should only be called from the work list scheduler.
1226
1218
*/
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 ]
1230
1222
1231
1223
@ tailrec
1232
1224
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)
1235
1227
given reporter : Reporter .BufferedReporter = new Reporter .BufferedReporter
1236
1228
1237
1229
thisRef.ensureFresh()
@@ -1240,7 +1232,7 @@ object Semantic:
1240
1232
for param <- tpl.constr.termParamss.flatten do
1241
1233
thisRef.updateField(param.symbol, Hot )
1242
1234
1243
- log(" checking " + task ) { eval(tpl, thisRef, thisRef.klass ) }
1235
+ log(" checking " + classSym ) { eval(tpl, thisRef, classSym ) }
1244
1236
reporter.errors.foreach(_.issue)
1245
1237
1246
1238
if cache.hasChanged && reporter.errors.isEmpty then
@@ -1254,23 +1246,15 @@ object Semantic:
1254
1246
iterate()
1255
1247
end doTask
1256
1248
end WorkList
1257
- inline def workList (using wl : WorkList ): WorkList = wl
1258
1249
1259
1250
// ----- API --------------------------------
1260
1251
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
1269
1254
*/
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)
1272
1257
val cache = new Cache
1273
- taskBuilder(using workList)
1274
1258
workList.work()(using cache, ctx)
1275
1259
1276
1260
// ----- Semantic definition --------------------------------
0 commit comments