check/fix the %delobject feature for member methods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8604 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-29 01:21:52 +00:00
commit ab03eb18e7
2 changed files with 13 additions and 8 deletions

View file

@ -116,7 +116,7 @@ protected:
~G() { }
public:
void destroy() { delete this; }
static void destroy(G *g) { delete g; }
};
class GG : public G {

View file

@ -943,20 +943,25 @@ int Language::cDeclaration(Node *n) {
int
Language::functionHandler(Node *n) {
Parm *p;
p = Getattr(n,"parms");
String *storage = Getattr(n,"storage");
int isfriend = CurrentClass && Cmp(storage,"friend") == 0;
int isstatic = CurrentClass && Cmp(storage,"static") == 0 &&
!(SmartPointer && Getattr(n,"allocate:smartpointeraccess"));
Parm *p= Getattr(n,"parms");
if (GetFlag(n,"feature:del")) {
/* the method acts like a delete operator, ie, we need to disown the parameter */
if (p) Setattr(p,"wrap:disown","1");
if (CurrentClass && !isstatic && !isfriend) {
SetFlag(n,"feature:self:disown");
} else {
if (p) SetFlag(p,"wrap:disown");
}
}
if (!CurrentClass) {
globalfunctionHandler(n);
} else {
String *storage = Getattr(n,"storage");
if (Cmp(storage,"static") == 0 &&
!(SmartPointer && Getattr(n,"allocate:smartpointeraccess"))) {
if (isstatic) {
staticmemberfunctionHandler(n);
} else if (Cmp(storage,"friend") == 0) {
} else if (isfriend) {
globalfunctionHandler(n);
} else {
memberfunctionHandler(n);