feat: replace Wren Range class with native C object for performance
Remove the Range class definition from corelib.wren and implement it as a native C type with ObjRange struct, adding native methods for from, to, min, max, iterate, and iteratorValue. Move range operator handling from Num class to native num_dotDot and num_dotDotDot functions. Update VM to support OBJ_RANGE type in marking, printing, and type checking. Add comprehensive test suite for range operations including ordered, backwards, and exclusive ranges.
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
var inclusive = 2..5
|
||||
IO.print(inclusive is Range) // expect: true
|
||||
IO.print(inclusive.min) // expect: 2
|
||||
IO.print(inclusive.max) // expect: 5
|
||||
|
||||
var exclusive = 2...5
|
||||
IO.print(exclusive is Range) // expect: true
|
||||
IO.print(exclusive.min) // expect: 2
|
||||
IO.print(exclusive.max) // expect: 4
|
||||
|
||||
// TODO: Non-number RHS.
|
||||
// TODO: Non-integer RHS.
|
||||
// TODO: Range iteration.
|
||||
// TODO: Empty or negative ranges.
|
||||
Reference in New Issue
Block a user