new explicitcall feature

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9188 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-07-04 21:00:55 +00:00
commit 32abf157f7
4 changed files with 46 additions and 10 deletions

View file

@ -381,8 +381,8 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
* set to "(*this)->" or some similar sequence.
* ----------------------------------------------------------------------------- */
String *
Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
static String *
Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self, String *explicit_qualifier) {
String *func, *nname;
int i = 0;
Parm *p = parms;
@ -426,11 +426,13 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
- gcc-3.4 forbids the use of 'template'.
the rest seems not caring very much,
*/
if (SwigType_istemplate(name)) {
Printf(func,"SWIGTEMPLATEDISAMBIGUATOR %s(", nname);
} else {
Printf(func,"%s(", nname);
}
if (SwigType_istemplate(name))
Printf(func,"SWIGTEMPLATEDISAMBIGUATOR ");
if (explicit_qualifier)
Printv(func, explicit_qualifier, "::", NIL);
Printf(func,"%s(", nname);
i++;
p = nextSibling(p);
@ -843,11 +845,16 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
/* Generate action code for the access */
if (!(flags & CWRAP_EXTEND)) {
String *call = Swig_cmethod_call(name,p,self);
/* Call the explicit method rather than allow for a polymorphic call */
String *explicit_qualifier = GetFlag(n,"explicitcall") ?
SwigType_namestr(Getattr(Getattr(parentNode(n),"typescope"),k_qname)) : 0;
String *call = Swig_cmethod_call(name,p,self,explicit_qualifier);
String *cres = Swig_cresult(Getattr(n,k_type),k_result, call);
Setattr(n,k_wrapaction, cres);
Delete(call);
Delete(cres);
Delete(explicit_qualifier);
} else {
/* Methods with default arguments are wrapped with additional methods for each default argument,
* however, only one extra %extend method is generated. */

View file

@ -479,7 +479,6 @@ extern int Swig_cargs(Wrapper *w, ParmList *l);
extern String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl);
extern String *Swig_cfunction_call(String_or_char *name, ParmList *parms);
extern String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self);
extern String *Swig_cconstructor_call(String_or_char *name);
extern String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms);
extern String *Swig_unref_call(Node *n);