Several fixes in v8 emitter.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13806 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c4ab879027
commit
2893df9f73
2 changed files with 12 additions and 6 deletions
|
|
@ -91,14 +91,17 @@ v8::Handle<v8::Object> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, in
|
||||||
v8::HandleScope scope;
|
v8::HandleScope scope;
|
||||||
|
|
||||||
v8::Local<v8::FunctionTemplate> class_templ;
|
v8::Local<v8::FunctionTemplate> class_templ;
|
||||||
|
v8::Handle<v8::ObjectTemplate> inst_templ;
|
||||||
if(info->clientdata == NULL) {
|
if(info->clientdata == NULL) {
|
||||||
// TODO: get class template for unknown types
|
class_templ = v8::FunctionTemplate::New();
|
||||||
//class_templ = _SwigObject_classRef;
|
class_templ->SetClassName(v8::String::NewSymbol(info->name));
|
||||||
|
inst_templ = class_templ->InstanceTemplate();
|
||||||
|
inst_templ->SetInternalFieldCount(1);
|
||||||
} else {
|
} else {
|
||||||
class_templ = *((v8::Local<v8::FunctionTemplate>*) info->clientdata);
|
class_templ = *((v8::Local<v8::FunctionTemplate>*) info->clientdata);
|
||||||
|
inst_templ = class_templ->InstanceTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
|
|
||||||
v8::Local<v8::Object> result = inst_templ->NewInstance();
|
v8::Local<v8::Object> result = inst_templ->NewInstance();
|
||||||
|
|
||||||
SWIG_PRV_DATA* cdata = (SWIG_PRV_DATA*) new SWIG_PRV_DATA;
|
SWIG_PRV_DATA* cdata = (SWIG_PRV_DATA*) new SWIG_PRV_DATA;
|
||||||
|
|
|
||||||
|
|
@ -1720,6 +1720,9 @@ int V8Emitter::exitClass(Node *n)
|
||||||
.replace(T_NAME, state.clazz(NAME))
|
.replace(T_NAME, state.clazz(NAME))
|
||||||
.pretty_print(f_wrappers);
|
.pretty_print(f_wrappers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: this makes sure that there is a swig_type added for this class */
|
||||||
|
SwigType_remember_clientdata(state.clazz(TYPE_MANGLED), NewString("0"));
|
||||||
|
|
||||||
// emit definition of v8 class template
|
// emit definition of v8 class template
|
||||||
Template t_def_class(getTemplate("jsv8_define_class_template"));
|
Template t_def_class(getTemplate("jsv8_define_class_template"));
|
||||||
|
|
@ -1768,7 +1771,7 @@ int V8Emitter::enterVariable(Node* n)
|
||||||
int V8Emitter::exitVariable(Node* n)
|
int V8Emitter::exitVariable(Node* n)
|
||||||
{
|
{
|
||||||
if(GetFlag(n, "ismember")) {
|
if(GetFlag(n, "ismember")) {
|
||||||
if(GetFlag(state.variable(), IS_STATIC)) {
|
if(GetFlag(state.variable(), IS_STATIC) || Equal(Getattr(n, "nodeType"), "enumitem") ) {
|
||||||
Template t_register(getTemplate("jsv8_register_static_variable"));
|
Template t_register(getTemplate("jsv8_register_static_variable"));
|
||||||
t_register.replace(T_PARENT, state.clazz(NAME_MANGLED))
|
t_register.replace(T_PARENT, state.clazz(NAME_MANGLED))
|
||||||
.replace(T_NAME, state.variable(NAME))
|
.replace(T_NAME, state.variable(NAME))
|
||||||
|
|
@ -1778,7 +1781,7 @@ int V8Emitter::exitVariable(Node* n)
|
||||||
} else {
|
} else {
|
||||||
Template t_register(getTemplate("jsv8_register_member_variable"));
|
Template t_register(getTemplate("jsv8_register_member_variable"));
|
||||||
t_register.replace(T_NAME_MANGLED, state.clazz(NAME_MANGLED))
|
t_register.replace(T_NAME_MANGLED, state.clazz(NAME_MANGLED))
|
||||||
.replace(T_NAME, state.clazz(NAME))
|
.replace(T_NAME, state.variable(NAME))
|
||||||
.replace(T_GETTER, state.variable(GETTER))
|
.replace(T_GETTER, state.variable(GETTER))
|
||||||
.replace(T_SETTER, state.variable(SETTER))
|
.replace(T_SETTER, state.variable(SETTER))
|
||||||
.pretty_print(f_init_wrappers);
|
.pretty_print(f_init_wrappers);
|
||||||
|
|
@ -1868,7 +1871,7 @@ void V8Emitter::marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, Mar
|
||||||
break;
|
break;
|
||||||
case Setter:
|
case Setter:
|
||||||
if (is_member && !is_static && i == 0) {
|
if (is_member && !is_static && i == 0) {
|
||||||
Printv(arg, "value", 0);
|
Printv(arg, "info.Holder()", 0);
|
||||||
} else {
|
} else {
|
||||||
Printv(arg, "value", 0);
|
Printv(arg, "value", 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue