feat: implement Map.keys, Map.values iterators and proper toString with key-value formatting
Add MapKeySequence and MapValueSequence classes in core.wren to expose iterable key and value views on Map instances. Implement native iterate_, keyIteratorValue_, and valueIteratorValue_ primitives in wren_core.c to support these sequences. Replace the stub Map.toString with a full implementation that iterates keys and formats each entry as "key: value", handling empty maps and nested maps correctly. Include comprehensive test suites for key iteration, value iteration, iterator type validation, and toString output across multiple orderings.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
var a = {1: 2, 3: 4}
|
||||
a.values.iterate(1.5) // expect runtime error: Iterator must be an integer.
|
||||
Reference in New Issue
Block a user