Removed a Py_None from cwrap.c.
Added SetNoneComparison in lang.cxx, which allows the language module to specify how to determine whether the empty argument was given for the 'self' pointer. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4473 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e3d8bf0d68
commit
636daff4e1
4 changed files with 24 additions and 5 deletions
|
|
@ -609,7 +609,8 @@ Swig_directormap(Node *module, String *type) {
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
Swig_ConstructorToFunction(Node *n, String *classname, int cplus, int flags)
|
||||
Swig_ConstructorToFunction(Node *n, String *classname,
|
||||
String *none_comparison, int cplus, int flags)
|
||||
{
|
||||
ParmList *parms;
|
||||
SwigType *type;
|
||||
|
|
@ -649,16 +650,22 @@ Swig_ConstructorToFunction(Node *n, String *classname, int cplus, int flags)
|
|||
String *name = Getattr(parent, "sym:name");
|
||||
String* directorname = NewStringf("__DIRECTOR__%s", name);
|
||||
String* action = NewString("");
|
||||
String* tmp_none_comparison = Copy(none_comparison);
|
||||
|
||||
Replaceall( tmp_none_comparison, "$arg", "arg1" );
|
||||
|
||||
/* if Python class has been subclassed, create a director instance.
|
||||
* otherwise, just create a normal instance.
|
||||
*/
|
||||
Printv(action, "if (arg1 != Py_None) { // subclassed\n",
|
||||
// arty: arg1 != Py_None => tmp_none_comparison
|
||||
Printv(action, "if (",tmp_none_comparison,") { // subclassed\n",
|
||||
Swig_cresult(type, "result", Swig_cppconstructor_director_call(directorname, parms)),
|
||||
"} else {\n",
|
||||
Swig_cresult(type, "result", Swig_cppconstructor_nodirector_call(classname, parms)),
|
||||
"}\n",
|
||||
NULL);
|
||||
Setattr(n, "wrap:action", action);
|
||||
Delete(tmp_none_comparison);
|
||||
Delete(action);
|
||||
Delete(directorname);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -436,7 +436,9 @@ extern String *Swig_cmemberget_call(String_or_char *name, SwigType *t, String
|
|||
/* --- Transformations --- */
|
||||
|
||||
extern int Swig_MethodToFunction(Node *n, String *classname, int flags);
|
||||
extern int Swig_ConstructorToFunction(Node *n, String *classname, int cplus, int flags);
|
||||
extern int Swig_ConstructorToFunction(Node *n, String *classname,
|
||||
String *none_comparison,
|
||||
int cplus, int flags);
|
||||
extern int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags);
|
||||
extern int Swig_MembersetToFunction(Node *n, String *classname, int flags);
|
||||
extern int Swig_MembergetToFunction(Node *n, String *classname, int flags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue