Parents: #475, #493
Related: #750, #751
Problem
The shared iteratorOf entry point is more permissive than ECMA-262 GetIterator:
- an ordinary object with a
.next property but no Symbol.iterator is accepted as iterable;
- generator objects are returned before their observable
Symbol.iterator property is read, so an override, getter, deletion, or non-callable value is ignored.
A current-main probe returns false,1,1,0 for [manualObjectThrew, manualNextCalls, overriddenGeneratorSum, iteratorGetterCalls]; the specified result is true,0,7,1. This affects consumers such as Math.sumPrecise even though their subsequent IteratorStep behavior is correct.
Scope
- Make the language GetIterator path perform ordinary GetMethod on
@@iterator, require it to be callable, call it once with the input as receiver, and require an Object result.
- Honor observable overrides/deletions on generator and other built-in iterator objects.
- Keep deliberate GetIteratorDirect/GetIteratorFlattenable consumers distinct.
- Audit every
iteratorOf caller for the correct abstract operation and retain one captured [[NextMethod]] per iterator record.
- Preserve intrinsic array/string/Map/Set iteration behavior without changing their iterator storage or
next implementations.
No-workaround rules
- No
.next-property duck typing for GetIterator, generator/builtin bypass, array-only shortcut that skips observable @@iterator, repeated method lookup, source rewriting, or silent fallback after a missing/non-callable method.
- No stack, queue, job, Promise, Worker, or Map/Set iterator implementation changes.
Acceptance
Parents: #475, #493
Related: #750, #751
Problem
The shared
iteratorOfentry point is more permissive than ECMA-262 GetIterator:.nextproperty but noSymbol.iteratoris accepted as iterable;Symbol.iteratorproperty is read, so an override, getter, deletion, or non-callable value is ignored.A current-main probe returns
false,1,1,0for[manualObjectThrew, manualNextCalls, overriddenGeneratorSum, iteratorGetterCalls]; the specified result istrue,0,7,1. This affects consumers such asMath.sumPreciseeven though their subsequent IteratorStep behavior is correct.Scope
@@iterator, require it to be callable, call it once with the input as receiver, and require an Object result.iteratorOfcaller for the correct abstract operation and retain one captured[[NextMethod]]per iterator record.nextimplementations.No-workaround rules
.next-property duck typing for GetIterator, generator/builtin bypass, array-only shortcut that skips observable@@iterator, repeated method lookup, source rewriting, or silent fallback after a missing/non-callable method.Acceptance
.nextobjects are rejected without callingnext; an explicit@@iteratormakes them iterable.@@iteratorgetters, overrides, deletion, non-callable values, receiver, and result validation are observed in spec order.iteratorOfcaller is classified as GetIterator, GetIteratorDirect, or GetIteratorFlattenable and captures[[NextMethod]]once where required.