Fix one-by-one error of numbered parameter ID

This commit is contained in:
Richard Böhme 2025-05-21 18:14:28 +09:00 committed by Nobuyoshi Nakada
parent 081a44f586
commit 9a41d76b83
Notes: git 2025-05-21 13:12:49 +00:00
2 changed files with 5 additions and 1 deletions

2
proc.c
View File

@ -507,7 +507,7 @@ bind_local_variables(VALUE bindval)
int
rb_numparam_id_p(ID id)
{
return (tNUMPARAM_1 << ID_SCOPE_SHIFT) <= id && id < ((tNUMPARAM_1 + 10) << ID_SCOPE_SHIFT);
return (tNUMPARAM_1 << ID_SCOPE_SHIFT) <= id && id < ((tNUMPARAM_1 + 9) << ID_SCOPE_SHIFT);
}
/*

View File

@ -1637,6 +1637,10 @@ class TestProc < Test::Unit::TestCase
assert_equal(3, b.local_variable_get(:when))
assert_equal(4, b.local_variable_get(:begin))
assert_equal(5, b.local_variable_get(:end))
assert_raise_with_message(NameError, /local variable \Wdefault\W/) {
binding.local_variable_get(:default)
}
end
def test_local_variable_set