Commit 7f339cf1

7f339cf18824Merged

Ryan Seys <[email protected]> · 5 months ago · 4 files · +2 added · ~2 modified

Description

analyze,codegen: implement Range#exclude_end?

(1...5).exclude_end? previously fell through to the unresolved-call warning and raised undefined method 'exclude_end?' for range. Add an analyzer arm so the call types as bool (printed as true / false), and a codegen arm that reads the runtime excl flag off the sp_Range struct, so it is correct for both literal ... / .. ranges and non-literal sp_Range values.

The earlier version of this change also reworked size / length / count, but master has since brought those onto the same runtime-excl lowering (last - first + 1 - excl), so only exclude_end? remains. The test passes ranges through a method parameter so a non-literal sp_Range receiver (whose excl is unknown at compile time) actually exercises the runtime-flag read, and keeps the literal size / count / length assertions as a regression guard.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
7f339cf18824
Parent
e314f84e9ac8

spinel_analyze.rbmodifiedView file

@@ -4983,6 +4983,9 @@
49834983 if mname == "overlap?"
49844984 return "bool"
49854985 end
4986+ if mname == "exclude_end?"
4987+ return "bool"
4988+ end
49864989 if mname == "==="
49874990 return "bool"
49884991 end