Closed anba closed 1 year ago
Good catch. The main spec actually did do this until recently, but I changed it to be index-based for just this reason. I'll change it here as well.
It seems here should be used an approach similar to Set.prototype.forEach
for avoiding cases like #83.
The main spec never uses
for each element
iteration when the iterated-over list can be modified. Therefore it's not quite clear what the intended semantics should be, i.e. are newly added elements visible or not? Maybe it's necessary to rewrite this to an index-based loop.The modification can happen either through user-code, e.g. in
Set.prototype.intersection
when callingotherRec.[[Has]]
. Or it can happen through direct modification, e.g. inSet.prototype.difference
when an element is removed fromresultSetData
during iteration overresultSetData
.