From 7ef1b04a86acf27b4a7304a576f106084f7f1405 Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Fri, 8 Apr 2016 12:13:43 +0900 Subject: [PATCH] ruby: use nodeType attribute to determine whether functions are constructors. get return type each time. --- Source/Modules/ruby.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index ddf47c1b0..3ba816dee 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -2110,13 +2110,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) ); @@ -2138,7 +2136,7 @@ public: 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 || @@ -2159,7 +2157,6 @@ public: Append(f->code, "\nreturn Qnil;\n"); Delete(methodName); - Delete(type); Delete(protoTypes); Printv(f->code, "}\n", NIL);