mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm.c (collect_local_variables_in_env): remove unnecessary check
which causes: x=1;proc{local_variables}.call #=> [] * test/ruby/test_variable.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c504ea811
commit
18e46b81ff
3 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Mon May 12 23:37:57 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* vm.c (collect_local_variables_in_env): remove unnecessary check
|
||||||
|
which causes: x=1;proc{local_variables}.call #=> []
|
||||||
|
|
||||||
|
* test/ruby/test_variable.rb: add a test for above.
|
||||||
|
|
||||||
Mon May 12 23:05:24 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
Mon May 12 23:05:24 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* process.c, include/ruby/intern.h (rb_run_exec_options): externed.
|
* process.c, include/ruby/intern.h (rb_run_exec_options): externed.
|
||||||
|
|
|
@ -59,4 +59,11 @@ class TestVariable < Test::Unit::TestCase
|
||||||
lvar = 1
|
lvar = 1
|
||||||
assert_instance_of(Symbol, local_variables[0], "[ruby-dev:34008]")
|
assert_instance_of(Symbol, local_variables[0], "[ruby-dev:34008]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_local_variables2
|
||||||
|
x = 1
|
||||||
|
proc do |y|
|
||||||
|
assert_equal([:x, :y], local_variables.sort)
|
||||||
|
end.call
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
3
vm.c
3
vm.c
|
@ -280,9 +280,6 @@ static int
|
||||||
collect_local_variables_in_env(rb_env_t *env, VALUE ary)
|
collect_local_variables_in_env(rb_env_t *env, VALUE ary)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (env->block.lfp == env->block.dfp) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for (i = 0; i < env->block.iseq->local_table_size; i++) {
|
for (i = 0; i < env->block.iseq->local_table_size; i++) {
|
||||||
ID lid = env->block.iseq->local_table[i];
|
ID lid = env->block.iseq->local_table[i];
|
||||||
if (lid) {
|
if (lid) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue