summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--proc.c3
-rw-r--r--test/ruby/test_proc.rb5
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a342b2ed6..2b81d99b73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jul 2 02:14:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (bind_local_variables): update env from envval for each
+ iterations. [ruby-dev:48351] [Bug #10001]
+
Tue Jul 1 23:46:34 2014 NAKAMURA Usaku <usa@ruby-lang.org>
* NEWS: [DOC] mention about Binding#local_variables, introduced at
diff --git a/proc.c b/proc.c
index 34159480e0..1c37acb3d3 100644
--- a/proc.c
+++ b/proc.c
@@ -476,12 +476,13 @@ bind_local_variables(VALUE bindval)
GetBindingPtr(bindval, bind);
envval = bind->env;
- GetEnvPtr(envval, env);
do {
const rb_iseq_t *iseq;
int i;
ID id;
+
+ GetEnvPtr(envval, env);
iseq = env->block.iseq;
for (i = 0; i < iseq->local_table_size; i++) {
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 4cfbf9a1be..5a22afee85 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -1256,6 +1256,11 @@ class TestProc < Test::Unit::TestCase
assert_equal(%i[if case when begin end a], b.local_variables)
end
+ def test_local_variables_nested
+ b = tap {break binding}
+ assert_equal(%i[b], b.local_variables, '[ruby-dev:48351] [Bug #10001]')
+ end
+
def local_variables_of(bind)
this_should_not_be_in_bind = 2
bind.local_variables