summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 00:13:44 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-19 00:13:44 +0000
commite5405de1620db41b599a29f559e3749f19491a98 (patch)
treedd506ad60e9256c9e9046867e6108a60fe84c3c3 /eval.c
parenta20f520455526b06abc5c5647347fee7edcbc8f0 (diff)
downloadruby-e5405de1620db41b599a29f559e3749f19491a98.tar.gz
ruby-e5405de1620db41b599a29f559e3749f19491a98.tar.xz
ruby-e5405de1620db41b599a29f559e3749f19491a98.zip
* eval.c, vm_eval.c (rb_f_local_variables): move definition from eval.c
to vm_eval.c because vm_collect_local_variables_in_heap() should be static function. * vm.c (vm_collect_local_variables_in_heap): make it static. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/eval.c b/eval.c
index 5c0ede478..0cd873d0e 100644
--- a/eval.c
+++ b/eval.c
@@ -1040,64 +1040,6 @@ errat_setter(VALUE val, ID id, VALUE *var)
set_backtrace(err, val);
}
-int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary);
-
-/*
- * call-seq:
- * local_variables => array
- *
- * Returns the names of the current local variables.
- *
- * fred = 1
- * for i in 1..10
- * # ...
- * end
- * local_variables #=> ["fred", "i"]
- */
-
-static VALUE
-rb_f_local_variables(void)
-{
- VALUE ary = rb_ary_new();
- rb_thread_t *th = GET_THREAD();
- rb_control_frame_t *cfp =
- vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
- int i;
-
- while (cfp) {
- if (cfp->iseq) {
- for (i = 0; i < cfp->iseq->local_table_size; i++) {
- ID lid = cfp->iseq->local_table[i];
- if (lid) {
- const char *vname = rb_id2name(lid);
- /* should skip temporary variable */
- if (vname) {
- rb_ary_push(ary, ID2SYM(lid));
- }
- }
- }
- }
- if (cfp->lfp != cfp->dfp) {
- /* block */
- VALUE *dfp = GC_GUARDED_PTR_REF(cfp->dfp[0]);
-
- if (vm_collect_local_variables_in_heap(th, dfp, ary)) {
- break;
- }
- else {
- while (cfp->dfp != dfp) {
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- }
- }
- }
- else {
- break;
- }
- }
- return ary;
-}
-
-
/*
* call-seq:
* __method__ => symbol
@@ -1134,7 +1076,6 @@ Init_eval(void)
rb_define_global_function("fail", rb_f_raise, -1);
rb_define_global_function("global_variables", rb_f_global_variables, 0); /* in variable.c */
- rb_define_global_function("local_variables", rb_f_local_variables, 0);
rb_define_global_function("__method__", rb_f_method_name, 0);
rb_define_global_function("__callee__", rb_f_method_name, 0);