-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented mSlice
on the VM allowing toOpenArray
to work at compile time.
#20586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already discussed some of the changes via real-time chat, so I thought I'd do a second round of review here.
You also need to handle the case of creating slices from slices (e.g. toOpenArray(toOpenArray(x, 1, 4), 1, 2)
. My recommendation would be to prevent nested slices by unwrapping them as part of opcSlice
.
The tyOpenArray
handling in ccgexprs.genBracedInit
also needs to be adjusted - it currently expects an nkBracket
.
Irrelevant CI failure, merging. |
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
…ile time. (#20586) * Implemented opcSlice to make 'toOpenArray' work on the VM * Added nkOpenArray for VM to reduce bodgeness * Fixed range issues and erraneous comments * Range check correctly for openArrays in opcLdArr * Inverted logic for ldArr checking * vm now supports slicing strings * Added string tests * Removed usage of 'nkOpenArray' and redundant operations * Refactored vmSlice implementation, removing redundant and incorrect code * Made tuples go throw opcWrObj for field assignment * All strkinds should be considered for openarrays (cherry picked from commit 4aa67ad)
…ile time. (nim-lang#20586) * Implemented opcSlice to make 'toOpenArray' work on the VM * Added nkOpenArray for VM to reduce bodgeness * Fixed range issues and erraneous comments * Range check correctly for openArrays in opcLdArr * Inverted logic for ldArr checking * vm now supports slicing strings * Added string tests * Removed usage of 'nkOpenArray' and redundant operations * Refactored vmSlice implementation, removing redundant and incorrect code * Made tuples go throw opcWrObj for field assignment * All strkinds should be considered for openarrays
…ile time. (nim-lang#20586) * Implemented opcSlice to make 'toOpenArray' work on the VM * Added nkOpenArray for VM to reduce bodgeness * Fixed range issues and erraneous comments * Range check correctly for openArrays in opcLdArr * Inverted logic for ldArr checking * vm now supports slicing strings * Added string tests * Removed usage of 'nkOpenArray' and redundant operations * Refactored vmSlice implementation, removing redundant and incorrect code * Made tuples go throw opcWrObj for field assignment * All strkinds should be considered for openarrays
This is requisite for changes to the stdlib to use
openArray[char]
more. There is an issue withstatic openArray[T]
, butoa[a..b]
does work so can be used in place.