fix #697 - miscounting comma in member lists

fix method for counting comma in member list
This commit is contained in:
Joseph C Wang 2016-11-12 00:23:41 +08:00
commit bff182d556
3 changed files with 19 additions and 4 deletions

View file

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