mirror of https://github.com/swig/swig
fix #697 - miscounting comma in member lists
fix method for counting comma in member list
This commit is contained in:
parent
6310cdb28a
commit
bff182d556
|
@ -19,7 +19,8 @@ C_TEST_CASES += \
|
|||
CPP_TEST_CASES += \
|
||||
r_double_delete \
|
||||
r_overload_array \
|
||||
r_sexp
|
||||
r_sexp \
|
||||
r_overload_comma
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
%module r_overload_comma
|
||||
|
||||
%inline %{
|
||||
class r_overload_comma
|
||||
{
|
||||
public:
|
||||
int getMember1()const {return _member1;}
|
||||
void setMember1ThatEndsWithWord_get(int arg) { _member1=arg; }
|
||||
void setMember1ThatEndsWithWord_get(char* arg) {_member1=atoi(arg);}
|
||||
|
||||
private:
|
||||
int _member1;
|
||||
};
|
||||
%}
|
|
@ -1064,7 +1064,7 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
|
|||
|
||||
if (!isSet && varaccessor > 0) {
|
||||
Printf(f->code, "%svaccessors = c(", tab8);
|
||||
int vcount = 0;
|
||||
int first = 1;
|
||||
for(j = 0; j < numMems; j+=3) {
|
||||
String *item = Getitem(el, j);
|
||||
String *dup = Getitem(el, j + 1);
|
||||
|
@ -1072,8 +1072,8 @@ int R::OutputMemberReferenceMethod(String *className, int isSet,
|
|||
ptr = &ptr[Len(dup) - 3];
|
||||
|
||||
if (!strcmp(ptr, "get")) {
|
||||
vcount++;
|
||||
Printf(f->code, "'%s'%s", item, vcount < varaccessor ? ", " : "");
|
||||
Printf(f->code, "%s'%s'", first ? "" : ", ", item);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
Printf(f->code, ");\n");
|
||||
|
|
Loading…
Reference in New Issue