mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_eval.c: skip internal names
* vm_eval.c (local_var_list_add): skip internal local variable name by its type but not if it has a name. internal local variable names are just unique per frame, not globally. [ruby-core:71437] [Bug #11674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66a138c2d9
commit
9cf1136481
3 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Nov 11 17:38:24 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (local_var_list_add): skip internal local variable
|
||||
name by its type but not if it has a name. internal local
|
||||
variable names are just unique per frame, not globally.
|
||||
[ruby-core:71437] [Bug #11674]
|
||||
|
||||
Wed Nov 11 14:14:33 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||
|
||||
* transcode.c: fix a typo
|
||||
|
|
|
@ -136,4 +136,15 @@ class TestVariable < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_local_variables_with_kwarg
|
||||
bug11674 = '[ruby-core:71437] [Bug #11674]'
|
||||
v = with_kwargs_11(v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8,v9:9,v10:10,v11:11)
|
||||
assert_equal(%i(v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11), v, bug11674)
|
||||
end
|
||||
|
||||
private
|
||||
def with_kwargs_11(v1:, v2:, v3:, v4:, v5:, v6:, v7:, v8:, v9:, v10:, v11:)
|
||||
local_variables
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2066,7 +2066,7 @@ local_var_list_update(st_data_t *key, st_data_t *value, st_data_t arg, int exist
|
|||
static void
|
||||
local_var_list_add(const struct local_var_list *vars, ID lid)
|
||||
{
|
||||
if (lid && rb_id2str(lid)) {
|
||||
if (lid && rb_is_local_id(lid)) {
|
||||
/* should skip temporary variable */
|
||||
st_table *tbl = RHASH_TBL_RAW(vars->tbl);
|
||||
st_data_t idx = 0; /* tbl->num_entries */
|
||||
|
|
Loading…
Add table
Reference in a new issue