From 360ef44e09e9072702215c46306731ccbbbc1d03 Mon Sep 17 00:00:00 2001 From: Oliver Buchtala Date: Sat, 8 Sep 2012 00:52:41 +0000 Subject: [PATCH] Clean up in v8 helper functions. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13763 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/javascript/v8/javascripthelpers.swg | 32 +++---------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg index bc2822c8f..b5b462b96 100644 --- a/Lib/javascript/v8/javascripthelpers.swg +++ b/Lib/javascript/v8/javascripthelpers.swg @@ -1,19 +1,5 @@ - %insert(runtime) %{ -/** - * Creates a class template for a class without extra initialization function. - */ -v8::Persistent SWIGV8_CreateClassTemplate(const char* symbol) { - v8::Local class_templ = v8::FunctionTemplate::New(); - class_templ->SetClassName(v8::String::NewSymbol(symbol)); - - v8::Handle inst_templ = class_templ->InstanceTemplate(); - inst_templ->SetInternalFieldCount(1); - - return v8::Persistent::New(class_templ); -} - /** * Creates a class template for a class with specified initialization function. */ @@ -31,22 +17,10 @@ v8::Handle SWIGV8_CreateNamespace(const char* name, v8::Hand Handle namespace = ObjectTemplate::New(); } -/** - * Sets the pimpl data of a V8 class. - */ -v8::Handle SWIGV8_SetInstance(const v8::Arguments& args, void* data) { - v8::HandleScope scope; - - v8::Handle self = args.Holder(); - self->SetInternalField(0, v8::External::New(data)); - - return self; -} - /** * Registers a class method with given name for a given class template. */ -void SWIGV8_AddClassMethod(v8::Handle class_templ, const char* symbol, v8::InvocationCallback _func) { +void SWIGV8_AddMemberFunction(v8::Handle class_templ, const char* symbol, v8::InvocationCallback _func) { v8::Handle proto_templ = class_templ->PrototypeTemplate(); proto_templ->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func)); } @@ -54,14 +28,14 @@ void SWIGV8_AddClassMethod(v8::Handle class_templ, const c /** * Registers a class method with given name for a given class template. */ -void SWIGV8_AddGlobalMethod(v8::Handle obj_templ, const char* symbol, v8::InvocationCallback _func) { +void SWIGV8_AddGlobalFunction(v8::Handle obj_templ, const char* symbol, v8::InvocationCallback _func) { obj_templ->Set(String::NewSymbol(symbol), v8::FunctionTemplate::New(_func)->GetFunction()); } /** * Registers a class property with given name for a given class template. */ -void SWIGV8_AddClassVariable(v8::Handle class_templ, const char* symbol, v8::AccessorGetter getter, v8::AccessorSetter setter) { +void SWIGV8_AddMemberVariable(v8::Handle class_templ, const char* symbol, v8::AccessorGetter getter, v8::AccessorSetter setter) { v8::Handle proto_templ = class_templ->InstanceTemplate(); proto_templ->SetAccessor(v8::String::NewSymbol(symbol), getter, setter); }