aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-25 16:29:26 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-25 16:29:26 +0000
commit9987d53e519cf84fe47ffbbd4f48be0bc40938c7 (patch)
tree1cbd036967f588026bf6038c39898fa20a531e4b /eval.c
parente98f7e1eaa18c33d211e6a0cf245eaf4b175c3c7 (diff)
downloadruby-9987d53e519cf84fe47ffbbd4f48be0bc40938c7.tar.gz
* yarvcore.h: add rb_thread_t#top_wrapper, top_self.
* eval_load.c (rb_load): support eval in wrapper module (load(file, true)). * eval.c: ditto. * eval_jump.h: ditto. * iseq.c: ditto. * vm.c: ditto. * yarvcore.c: ditto. * insns.def: add a empty line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/eval.c b/eval.c
index eea1098c05..582450941f 100644
--- a/eval.c
+++ b/eval.c
@@ -35,8 +35,6 @@ VALUE rb_eSysStackError;
extern int ruby_nerrs;
extern VALUE ruby_top_self;
-static VALUE ruby_wrapper; /* security wrapper */
-
static VALUE eval _((VALUE, VALUE, VALUE, char *, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
@@ -289,17 +287,20 @@ VALUE
rb_eval_string_wrap(const char *str, int *state)
{
int status;
- VALUE self = ruby_top_self;
- VALUE wrapper = ruby_wrapper;
+ rb_thread_t *th = GET_THREAD();
+ VALUE self = th->top_self;
+ VALUE wrapper = th->top_wrapper;
VALUE val;
- ruby_top_self = rb_obj_clone(ruby_top_self);
- rb_extend_object(ruby_top_self, ruby_wrapper);
+ th->top_wrapper = rb_module_new();
+ th->top_self = rb_obj_clone(ruby_top_self);
+ rb_extend_object(th->top_self, th->top_wrapper);
val = rb_eval_string_protect(str, &status);
- ruby_top_self = self;
- ruby_wrapper = wrapper;
+ th->top_self = self;
+ th->top_wrapper = wrapper;
+
if (state) {
*state = status;
}
@@ -2687,11 +2688,13 @@ rb_obj_extend(int argc, VALUE *argv, VALUE obj)
static VALUE
top_include(int argc, VALUE *argv, VALUE self)
{
+ rb_thread_t *th = GET_THREAD();
+
rb_secure(4);
- if (ruby_wrapper) {
+ if (th->top_wrapper) {
rb_warning
("main#include in the wrapped load is effective only in wrapper module");
- return rb_mod_include(argc, argv, ruby_wrapper);
+ return rb_mod_include(argc, argv, th->top_wrapper);
}
return rb_mod_include(argc, argv, rb_cObject);
}