Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Implemented by ensuring the 'type' attribute in the Node is set up correctly and using the usual Swig_typemap_lookup on the Node.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13873 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c4e4b4b610
commit
f6229d4b73
12 changed files with 201 additions and 348 deletions
|
|
@ -3449,13 +3449,11 @@ public:
|
|||
* --------------------------------------------------------------- */
|
||||
|
||||
int classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||
String *empty_str = NewString("");
|
||||
String *classname = Getattr(parent, "sym:name");
|
||||
String *c_classname = Getattr(parent, "name");
|
||||
String *name = Getattr(n, "name");
|
||||
String *symname = Getattr(n, "sym:name");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
SwigType *returntype = Getattr(n, "returntype");
|
||||
SwigType *returntype = Getattr(n, "type");
|
||||
String *overloaded_name = getOverloadedName(n);
|
||||
String *storage = Getattr(n, "storage");
|
||||
String *value = Getattr(n, "value");
|
||||
|
|
@ -3544,14 +3542,12 @@ public:
|
|||
}
|
||||
|
||||
/* Create the intermediate class wrapper */
|
||||
Parm *tp = NewParm(returntype, empty_str, n);
|
||||
|
||||
tm = Swig_typemap_lookup("imtype", tp, "", 0);
|
||||
tm = Swig_typemap_lookup("imtype", n, "", 0);
|
||||
if (tm) {
|
||||
String *imtypeout = Getattr(tp, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap
|
||||
String *imtypeout = Getattr(n, "tmap:imtype:out"); // the type in the imtype typemap's out attribute overrides the type in the typemap
|
||||
if (imtypeout)
|
||||
tm = imtypeout;
|
||||
const String *im_directoroutattributes = Getattr(tp, "tmap:imtype:directoroutattributes");
|
||||
const String *im_directoroutattributes = Getattr(n, "tmap:imtype:directoroutattributes");
|
||||
if (im_directoroutattributes) {
|
||||
Printf(callback_def, " %s\n", im_directoroutattributes);
|
||||
Printf(director_delegate_definitions, " %s\n", im_directoroutattributes);
|
||||
|
|
@ -3564,10 +3560,7 @@ public:
|
|||
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(returntype, 0));
|
||||
}
|
||||
|
||||
Parm *retpm = NewParm(returntype, empty_str, n);
|
||||
|
||||
if ((c_ret_type = Swig_typemap_lookup("ctype", retpm, "", 0))) {
|
||||
|
||||
if ((c_ret_type = Swig_typemap_lookup("ctype", n, "", 0))) {
|
||||
if (!is_void && !ignored_method) {
|
||||
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
||||
Wrapper_add_localv(w, "jresult", jretval_decl, "= 0", NIL);
|
||||
|
|
@ -3578,8 +3571,6 @@ public:
|
|||
SwigType_str(returntype, 0), SwigType_namestr(c_classname), SwigType_namestr(name));
|
||||
output_director = false;
|
||||
}
|
||||
|
||||
Delete(retpm);
|
||||
}
|
||||
|
||||
Swig_director_parms_fixup(l);
|
||||
|
|
@ -3731,7 +3722,7 @@ public:
|
|||
|
||||
/* header declaration, start wrapper definition */
|
||||
String *target;
|
||||
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : type;
|
||||
SwigType *rtype = Getattr(n, "conversion_operator") ? 0 : Getattr(n, "classDirectorMethods:type");
|
||||
target = Swig_method_decl(rtype, decl, qualified_name, l, 0, 0);
|
||||
Printf(w->def, "%s", target);
|
||||
Delete(qualified_name);
|
||||
|
|
@ -3778,9 +3769,7 @@ public:
|
|||
String *upcall = NewStringf("%s(%s)", symname, imcall_args);
|
||||
|
||||
if (!is_void) {
|
||||
Parm *tp = NewParm(returntype, empty_str, n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup("csdirectorout", tp, "", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("csdirectorout", n, "", 0))) {
|
||||
substituteClassname(returntype, tm);
|
||||
Replaceall(tm, "$cscall", upcall);
|
||||
|
||||
|
|
@ -3788,7 +3777,6 @@ public:
|
|||
}
|
||||
|
||||
Delete(tm);
|
||||
Delete(tp);
|
||||
} else
|
||||
Printf(callback_code, " %s;\n", upcall);
|
||||
|
||||
|
|
@ -3804,10 +3792,9 @@ public:
|
|||
if (!is_void) {
|
||||
String *jresult_str = NewString("jresult");
|
||||
String *result_str = NewString("c_result");
|
||||
Parm *tp = NewParm(returntype, result_str, n);
|
||||
|
||||
/* Copy jresult into c_result... */
|
||||
if ((tm = Swig_typemap_lookup("directorout", tp, result_str, w))) {
|
||||
if ((tm = Swig_typemap_lookup("directorout", n, result_str, w))) {
|
||||
Replaceall(tm, "$input", jresult_str);
|
||||
Replaceall(tm, "$result", result_str);
|
||||
Printf(w->code, "%s\n", tm);
|
||||
|
|
@ -3818,7 +3805,6 @@ public:
|
|||
output_director = false;
|
||||
}
|
||||
|
||||
Delete(tp);
|
||||
Delete(jresult_str);
|
||||
Delete(result_str);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue