Skip to content

Commit

Permalink
Merge branch 'tamuratak-master'
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
wsfulton committed May 17, 2016
2 parents 18000db + 1330337 commit 70f5a9c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/Modules/ruby.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2122,13 +2122,11 @@ class RUBY:public Language {
// 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) );

Expand All @@ -2150,7 +2148,11 @@ class RUBY:public Language {
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 ||
Expand All @@ -2171,7 +2173,6 @@ class RUBY:public Language {
Append(f->code, "\nreturn Qnil;\n");

Delete(methodName);
Delete(type);
Delete(protoTypes);

Printv(f->code, "}\n", NIL);
Expand Down

0 comments on commit 70f5a9c

Please sign in to comment.