@@ -1206,56 +1206,49 @@ object Semantic:
1206
1206
cls == defn.AnyValClass ||
1207
1207
cls == defn.ObjectClass
1208
1208
1209
- // ----- Work list ---------------------------------------------------
1210
- class WorkList private [Semantic ](tasks : List [ClassSymbol ]):
1211
- /** Process the worklist until done */
1212
- final def work ()(using Cache , Context ): Unit =
1213
- for task <- tasks if isConcreteClass(task) do doTask(task)
1209
+ // ----- API --------------------------------
1214
1210
1215
- /** Check an individual class
1216
- *
1217
- * This method should only be called from the work list scheduler .
1218
- */
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 ]
1211
+ /** Check an individual class
1212
+ *
1213
+ * The class to be checked must be an instantiable concrete class .
1214
+ */
1215
+ private def checkClass (classSym : ClassSymbol )(using Cache , Context ): Unit =
1216
+ val thisRef = ThisRef (classSym)
1217
+ val tpl = classSym.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
1222
1218
1223
- @ tailrec
1224
- def iterate (): Unit = {
1225
- given Promoted = Promoted .empty(classSym)
1226
- given Trace = Trace .empty.add(classSym.defTree)
1227
- given reporter : Reporter .BufferedReporter = new Reporter .BufferedReporter
1219
+ @ tailrec
1220
+ def iterate (): Unit = {
1221
+ given Promoted = Promoted .empty(classSym)
1222
+ given Trace = Trace .empty.add(classSym.defTree)
1223
+ given reporter : Reporter .BufferedReporter = new Reporter .BufferedReporter
1228
1224
1229
- thisRef.ensureFresh()
1225
+ thisRef.ensureFresh()
1230
1226
1231
- // set up constructor parameters
1232
- for param <- tpl.constr.termParamss.flatten do
1233
- thisRef.updateField(param.symbol, Hot )
1227
+ // set up constructor parameters
1228
+ for param <- tpl.constr.termParamss.flatten do
1229
+ thisRef.updateField(param.symbol, Hot )
1234
1230
1235
- log(" checking " + classSym) { eval(tpl, thisRef, classSym) }
1236
- reporter.errors.foreach(_.issue)
1231
+ log(" checking " + classSym) { eval(tpl, thisRef, classSym) }
1232
+ reporter.errors.foreach(_.issue)
1237
1233
1238
- if cache.hasChanged && reporter.errors.isEmpty then
1239
- // code to prepare cache and heap for next iteration
1240
- cache.prepareForNextIteration()
1241
- iterate()
1242
- else
1243
- cache.prepareForNextClass()
1244
- }
1245
-
1246
- iterate()
1247
- end doTask
1248
- end WorkList
1234
+ if cache.hasChanged && reporter.errors.isEmpty then
1235
+ // code to prepare cache and heap for next iteration
1236
+ cache.prepareForNextIteration()
1237
+ iterate()
1238
+ else
1239
+ cache.prepareForNextClass()
1240
+ }
1249
1241
1250
- // ----- API --------------------------------
1242
+ iterate()
1243
+ end checkClass
1251
1244
1252
1245
/**
1253
1246
* Check the specified concrete classes
1254
1247
*/
1255
- def checkClasses (concreteClasses : List [ClassSymbol ])(using Context ): Unit =
1256
- val workList = new WorkList (concreteClasses )
1257
- val cache = new Cache
1258
- workList.work()( using cache, ctx )
1248
+ def checkClasses (classes : List [ClassSymbol ])(using Context ): Unit =
1249
+ given Cache ( )
1250
+ for classSym <- classes if isConcreteClass(classSym) do
1251
+ checkClass(classSym )
1259
1252
1260
1253
// ----- Semantic definition --------------------------------
1261
1254
0 commit comments