summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 02:16:28 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-27 02:16:28 +0000
commit846ca98acfdc83f645e619ff8d9f1f794dcc7adc (patch)
treeb4591151b2a55fe2428f276d106f4de2ca43f2d0 /iseq.c
parent63e21a7195ee434acd5de4d48556dbf20eba312b (diff)
merges r21079 from trunk into ruby_1_9_1.
* 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 3b93ff0255..988b822cc8 100644
--- a/iseq.c
+++ b/iseq.c
@@ -310,6 +310,15 @@ rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent)
&COMPILE_OPTION_DEFAULT);
}
+VALUE
+rb_iseq_new_main(NODE *node, VALUE filename)
+{
+ rb_thread_t *th = GET_THREAD();
+ VALUE parent = th->base_block->iseq->self;
+ return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), filename,
+ parent, ISEQ_TYPE_EVAL, &COMPILE_OPTION_DEFAULT);
+}
+
static VALUE
rb_iseq_new_with_bopt_and_opt(NODE *node, VALUE name, VALUE filename,
VALUE parent, VALUE type, VALUE bopt,