Build environment: macOS 26.5.2
Moddable SDK version:
- Installed via jsvu, so there is no SDK source tree /
git describe.
- Engine reports:
XS 17.9.1, slot 32 bytes, ID 4 bytes
Target device: desktop (host xs)
Description
The value and done properties of an iterator result object are created as non-writable and non-configurable.
CreateIteratorResultObject adds both with CreateDataPropertyOrThrow, which builds the descriptor { [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }, so both properties must be writable and configurable.
Steps to Reproduce
$ xst -e 'print(JSON.stringify(Object.getOwnPropertyDescriptor((function*(){})().next(), "value")))'
{"writable":false,"enumerable":true,"configurable":false}
Expected behavior
{"writable":true,"enumerable":true,"configurable":true}
For comparison, V8 (15.4.18):
$ v8 -e 'print(JSON.stringify(Object.getOwnPropertyDescriptor((function*(){})().next(), "value")))'
{"writable":true,"enumerable":true,"configurable":true}
Other information
done has the same descriptor, and every iterator result object is affected, not only generators. The results of the array, string, Map, Set, RegExp string and iterator helper next methods all report writable: false, configurable: false. The difference reaches ordinary code, since writing to the result throws in strict mode:
$ xst -e '"use strict"; var r = [1].values().next(); r.value = 9;'
TypeError: set value: not writable
Build environment: macOS 26.5.2
Moddable SDK version:
git describe.XS 17.9.1, slot 32 bytes, ID 4 bytesTarget device: desktop (host
xs)Description
The
valueanddoneproperties of an iterator result object are created as non-writable and non-configurable.CreateIteratorResultObjectadds both withCreateDataPropertyOrThrow, which builds the descriptor{ [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }, so both properties must be writable and configurable.Steps to Reproduce
Expected behavior
For comparison, V8 (15.4.18):
Other information
donehas the same descriptor, and every iterator result object is affected, not only generators. The results of the array, string, Map, Set, RegExp string and iterator helpernextmethods all reportwritable: false, configurable: false. The difference reaches ordinary code, since writing to the result throws in strict mode: