From 3a67d33091fee43747ead2b7aa157337a05700bb Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 27 Dec 2008 01:15:56 +0000 Subject: * vm.c (Init_VM): create and define TOPLEVEL_BINDING at first. * vm.c (vm_set_main_stack, rb_iseq_eval_main): added. * parse.y (rb_parser_compile_file): fix to check parse_in_eval flag. * eval.c (ruby_exec_node): use rb_iseq_eval_main() instead of rb_iseq_eval(). * iseq.c (rb_iseq_new_main), vm_core.h: added. main script (specified by -e or script name) should be run under TOPLEVEL_BINDING using Kernel#eval. Above changes simulate Kernel#eval behaviour. [ruby-dev:37240] * compile.c (make_name_for_block): skip iseq except block type. this fix is needed for [ruby-dev:37240], and also fixes [ruby-dev:35392]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index e21cffd17..1fa566268 100644 --- a/vm_core.h +++ b/vm_core.h @@ -431,6 +431,7 @@ typedef struct rb_thread_struct /* iseq.c */ VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE); VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent); +VALUE rb_iseq_new_main(NODE *node, VALUE filename); VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE); VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*); VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line); @@ -576,6 +577,7 @@ void rb_vm_bugreport(void); /* functions about thread/vm execution */ VALUE rb_iseq_eval(VALUE iseqval); +VALUE rb_iseq_eval_main(VALUE iseqval); void rb_enable_interrupt(void); void rb_disable_interrupt(void); int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp); -- cgit