ruby-changes:4904
From: ko1@a...
Date: Mon, 12 May 2008 23:42:29 +0900 (JST)
Subject: [ruby-changes:4904] mame - Ruby:r16397 (trunk): * vm.c (collect_local_variables_in_env): remove unnecessary check
mame 2008-05-12 23:42:17 +0900 (Mon, 12 May 2008)
New Revision: 16397
Modified files:
trunk/ChangeLog
trunk/test/ruby/test_variable.rb
trunk/vm.c
Log:
* 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.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_variable.rb?r1=16397&r2=16396&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16397&r2=16396&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=16397&r2=16396&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16396)
+++ ChangeLog (revision 16397)
@@ -1,3 +1,10 @@
+Mon May 12 23:37:57 2008 Yusuke Endoh <mame@t...>
+
+ * 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@r...>
* process.c, include/ruby/intern.h (rb_run_exec_options): externed.
Index: vm.c
===================================================================
--- vm.c (revision 16396)
+++ vm.c (revision 16397)
@@ -280,9 +280,6 @@
collect_local_variables_in_env(rb_env_t *env, VALUE ary)
{
int i;
- if (env->block.lfp == env->block.dfp) {
- return 0;
- }
for (i = 0; i < env->block.iseq->local_table_size; i++) {
ID lid = env->block.iseq->local_table[i];
if (lid) {
Index: test/ruby/test_variable.rb
===================================================================
--- test/ruby/test_variable.rb (revision 16396)
+++ test/ruby/test_variable.rb (revision 16397)
@@ -59,4 +59,11 @@
lvar = 1
assert_instance_of(Symbol, local_variables[0], "[ruby-dev:34008]")
end
+
+ def test_local_variables2
+ x = 1
+ proc do |y|
+ assert_equal([:x, :y], local_variables.sort)
+ end.call
+ end
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/