Corrected generation of "set" methods for R.
The function "OutputClassMemberTable" tags methods generated for a class so that R wrapper code supporting syntax like: WrappedClass$VarName <- value The comments in the function indicate that it is looking for method names ending in "_set", but in fact it was searching for methods ending in just "set", This was resulting in class methods ending in set (names like GetOffset, SetOffset etc) being placed in the wrong accessor functions and thus not being available in the normal way. There is probably a more appropriate way to tag the _set functions when they are being created, which is a future step. This patch makes the behaviour conform to the original intention.
This commit is contained in:
parent
c90239bce6
commit
52bec200f7
1 changed files with 7 additions and 3 deletions
|
|
@ -989,9 +989,10 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
int klen = Len(key);
|
||||
int isSet = 0;
|
||||
if (klen > 4) {
|
||||
ptr = &ptr[Len(key) - 4];
|
||||
ptr = &ptr[klen - 4];
|
||||
isSet = strcmp(ptr, "_set") == 0;
|
||||
}
|
||||
|
||||
// OutputArrayMethod(className, el, out);
|
||||
OutputMemberReferenceMethod(className, isSet, el, out);
|
||||
|
||||
|
|
@ -1278,7 +1279,9 @@ void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
|
|||
if(isSet < 0) {
|
||||
int n = Len(name);
|
||||
char *ptr = Char(name);
|
||||
isSet = Strcmp(NewString(&ptr[n-3]), "set") == 0;
|
||||
if (n>4) {
|
||||
isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
|
||||
}
|
||||
}
|
||||
|
||||
List *l = isSet ? class_member_set_functions : class_member_functions;
|
||||
|
|
@ -1758,7 +1761,8 @@ int R::functionWrapper(Node *n) {
|
|||
|
||||
int n = Len(iname);
|
||||
char *ptr = Char(iname);
|
||||
bool isSet(Strcmp(NewString(&ptr[n-3]), "set") == 0);
|
||||
bool isSet(0);
|
||||
if (n > 4) isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
|
||||
|
||||
|
||||
String *tmp = NewString("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue