Merge branch 'tamuratak-master'

* tamuratak-master:
  Revert introduction of minor memory leak in Ruby wrappers
  ruby: use nodeType attribute to determine whether functions are constructors.       get return type each time.
This commit is contained in:
William S Fulton 2016-05-17 20:05:20 +01:00
commit 70f5a9ceed
1 changed files with 6 additions and 5 deletions

View File

@ -2122,13 +2122,11 @@ public:
// Generate prototype list, go to first node
Node *sibl = n;
String* type = SwigType_str(Getattr(sibl,"type"),NULL);
while (Getattr(sibl, "sym:previousSibling"))
sibl = Getattr(sibl, "sym:previousSibling"); // go all the way up
// Constructors will be treated specially
const bool isCtor = Cmp(Getattr(sibl,"feature:new"), "1") == 0;
const bool isCtor = (!Cmp(Getattr(sibl, "nodeType"), "constructor"));
const bool isMethod = ( Cmp(Getattr(sibl, "ismember"), "1") == 0 &&
(!isCtor) );
@ -2150,7 +2148,11 @@ public:
String *protoTypes = NewString("");
do {
Append( protoTypes, "\n\" ");
if ( !isCtor ) Printv( protoTypes, type, " ", NIL );
if (!isCtor) {
SwigType *type = SwigType_str(Getattr(sibl, "type"), NULL);
Printv(protoTypes, type, " ", NIL);
Delete(type);
}
Printv(protoTypes, methodName, NIL );
Parm* p = Getattr(sibl, "wrap:parms");
if (p && (current == MEMBER_FUNC || current == MEMBER_VAR ||
@ -2171,7 +2173,6 @@ public:
Append(f->code, "\nreturn Qnil;\n");
Delete(methodName);
Delete(type);
Delete(protoTypes);
Printv(f->code, "}\n", NIL);