feat: add list subscript setter and refactor parameter validation

Implement list subscript setter (`[ ]=`) native method in wren_core.c, enabling assignment to list elements via bracket syntax. Extract duplicate parameter count validation logic into a shared `validateNumParameters` function in wren_compiler.c, replacing inline checks in both `parameterList` and `methodCall`. Add comprehensive test suite covering basic assignment, return value semantics, negative indices, and error cases for out-of-range and excessive arguments.
This commit is contained in:
Bob Nystrom
2013-12-21 17:37:59 +00:00
parent 14b6eb04d2
commit b1243ac532
4 changed files with 82 additions and 31 deletions
@@ -0,0 +1,2 @@
var list = []
list[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] = 17 // expect error