Skip to content

Commit

Permalink
ruby: use nodeType attribute to determine whether functions are const…
Browse files Browse the repository at this point in the history
…ructors.

      get return type each time.
  • Loading branch information
tamuratak committed Apr 8, 2016
1 parent ec2c67f commit 7ef1b04
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Source/Modules/ruby.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2110,13 +2110,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 @@ -2138,7 +2136,7 @@ class RUBY:public Language {
String *protoTypes = NewString("");
do {
Append( protoTypes, "\n\" ");
if ( !isCtor ) Printv( protoTypes, type, " ", NIL );
if ( !isCtor ) Printv( protoTypes, SwigType_str(Getattr(sibl,"type"), NULL), " ", NIL );
Printv(protoTypes, methodName, NIL );
Parm* p = Getattr(sibl, "wrap:parms");
if (p && (current == MEMBER_FUNC || current == MEMBER_VAR ||
Expand All @@ -2159,7 +2157,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 7ef1b04

Please sign in to comment.