ruby: use nodeType attribute to determine whether functions are constructors.

get return type each time.
This commit is contained in:
Takashi Tamura 2016-04-08 12:13:43 +09:00
commit 7ef1b04a86

View file

@ -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);