mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
reject numbered parameters from Binding#local_variables
Also, Binding#local_variable_get and #local_variable_set rejects an access to numbered parameters. [Bug #20965] [Bug #21049]
This commit is contained in:
parent
6d75599a1a
commit
993fd96ce6
Notes:
git
2025-02-18 07:23:41 +00:00
5 changed files with 64 additions and 5 deletions
15
vm.c
15
vm.c
|
@ -1106,6 +1106,21 @@ rb_vm_env_local_variables(const rb_env_t *env)
|
|||
return local_var_list_finish(&vars);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_vm_env_numbered_parameters(const rb_env_t *env)
|
||||
{
|
||||
struct local_var_list vars;
|
||||
local_var_list_init(&vars);
|
||||
// if (VM_ENV_FLAGS(env->ep, VM_ENV_FLAG_ISOLATED)) break; // TODO: is this needed?
|
||||
const rb_iseq_t *iseq = env->iseq;
|
||||
unsigned int i;
|
||||
if (!iseq) return 0;
|
||||
for (i = 0; i < ISEQ_BODY(iseq)->local_table_size; i++) {
|
||||
numparam_list_add(&vars, ISEQ_BODY(iseq)->local_table[i]);
|
||||
}
|
||||
return local_var_list_finish(&vars);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_iseq_local_variables(const rb_iseq_t *iseq)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue