Several fixes in generator for v8 initializer function.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13796 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Oliver Buchtala 2012-09-08 01:08:03 +00:00
commit 46cff47ada
3 changed files with 60 additions and 61 deletions

View file

@ -21,28 +21,26 @@ void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, cons
proto_templ->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func));
}
/**
* Registers a class method with given name for a given class template.
*/
void SWIGV8_AddGlobalFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, v8::InvocationCallback _func) {
v8::Handle<v8::ObjectTemplate> obj_templ = class_templ->InstanceTemplate();
obj_templ->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func)->GetFunction());
}
/**
* Registers a class property with given name for a given class template.
*/
void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, v8::AccessorGetter getter, v8::AccessorSetter setter) {
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
proto_templ->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
}
/**
* Registers a class method with given name for a given class template.
* Registers a class method with given name for a given object.
*/
void SWIGV8_AddGlobalVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol, v8::AccessorGetter getter, v8::AccessorSetter setter) {
v8::Handle<v8::ObjectTemplate> obj_templ = class_templ->InstanceTemplate();
obj_templ->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol, v8::InvocationCallback _func) {
obj->Set(v8::String::NewSymbol(symbol), v8::FunctionTemplate::New(_func)->GetFunction());
}
/**
* Registers a class method with given name for a given object.
*/
void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol, v8::AccessorGetter getter, v8::AccessorSetter setter) {
obj->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
}
%} // v8_helper_functions