1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

move context to new style

This commit is contained in:
Charles Lowell 2010-05-18 15:45:36 +03:00
parent ce2c640b9b
commit adec237865
2 changed files with 17 additions and 9 deletions

View file

@ -65,17 +65,26 @@ namespace {
unwrap(self)->Exit(); unwrap(self)->Exit();
return self; return self;
} }
VALUE IsEntered(VALUE self) {
if (Context::InContext()) {
return rr_v82rb(unwrap(self) == Context::GetEntered());
} else {
return Qfalse;
}
}
} }
void rr_init_cxt() { void rr_init_cxt() {
VALUE Context = V8_C_Context = rr_define_class("Context"); VALUE ContextClass = V8_C_Context = rr_define_class("Context");
rr_define_singleton_method(Context, "new", New, -1); rr_define_singleton_method(ContextClass, "new", New, -1);
rr_define_singleton_method(Context, "New", New, -1); rr_define_singleton_method(ContextClass, "New", New, -1);
rr_define_singleton_method(Context, "InContext", InContext, 0); rr_define_singleton_method(ContextClass, "InContext", InContext, 0);
rr_define_singleton_method(Context, "GetEntered", GetEntered, 0); rr_define_singleton_method(ContextClass, "GetEntered", GetEntered, 0);
rr_define_method(Context, "Global", Global, 0); rr_define_method(ContextClass, "Global", Global, 0);
rr_define_method(Context, "Enter", Enter, 0); rr_define_method(ContextClass, "Enter", Enter, 0);
rr_define_method(Context, "Exit", Exit, 0); rr_define_method(ContextClass, "Exit", Exit, 0);
rr_define_method(ContextClass, "IsEntered", IsEntered, 0);
} }
VALUE rr_reflect_v8_context(Handle<Context> value) { VALUE rr_reflect_v8_context(Handle<Context> value) {

View file

@ -5,7 +5,6 @@
#include "v8.h" #include "v8.h"
#include "v8_ref.h" #include "v8_ref.h"
extern VALUE V8_C_Object;
extern VALUE V8_C_Context; extern VALUE V8_C_Context;
void rr_init_cxt(); void rr_init_cxt();