Extract range validation logic from list_subscript into a reusable calculateRange function that handles inclusive/exclusive bounds, negative indices, and direction stepping. Add CalculatedRange struct to wren_core.h and implement string subscripting via the new helper, including comprehensive test coverage for forward, backward, negative, and half-negative ranges with proper error messages for out-of-bounds and non-integer values.
3 lines
85 B
Plaintext
3 lines
85 B
Plaintext
var a = "123"
|
|
a["2"] // expect runtime error: Subscript must be a number or a range.
|