Commit 2d5eac9b
2d5eac9bf7a6Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Array#values_at
arr.values_at(i, j, ...) returns a fresh array of the same kind holding the elements at the given indices. Works uniformly for typed (int/str/ float) and poly arrays by emitting per-index get/push into a new array.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 2d5eac9bf7a6
- Parent
- 2112f518e68b
src/analyze.cmodifiedView file
@@ -469,7 +469,8 @@
469469
if (!strcmp(name, "push") || !strcmp(name, "<<") || !strcmp(name, "append") ||470470
!strcmp(name, "reverse") || !strcmp(name, "sort") || !strcmp(name, "uniq") ||471471
!strcmp(name, "to_a") || !strcmp(name, "dup") || !strcmp(name, "clone") ||472-
!strcmp(name, "compact") || !strcmp(name, "flatten")) return rt;472+
!strcmp(name, "compact") || !strcmp(name, "flatten") ||473+
!strcmp(name, "values_at")) return rt;473474
if (!strcmp(name, "[]=")) return ty_array_elem(rt);474475
}475476
src/codegen.cmodifiedView file
Loading diff…