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
0a22fa0df1
commit
c90239bce6
1 changed files with 9 additions and 4 deletions
|
|
@ -974,7 +974,9 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
String *key;
|
||||
int i, n = Len(keys);
|
||||
/* Loop over all the <Class>_set and <Class>_get entries in the table. */
|
||||
|
||||
/* This function checks for names ending in _set - perhaps it should */
|
||||
/* use attributes of some other form, as it potentially clashes with */
|
||||
/* methods ending in _set */
|
||||
if(n && outputNamespaceInfo) {
|
||||
Printf(s_namespace, "exportClasses(");
|
||||
}
|
||||
|
|
@ -984,9 +986,12 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
|
||||
String *className = Getitem(el, 0);
|
||||
char *ptr = Char(key);
|
||||
ptr = &ptr[Len(key) - 3];
|
||||
int isSet = strcmp(ptr, "set") == 0;
|
||||
|
||||
int klen = Len(key);
|
||||
int isSet = 0;
|
||||
if (klen > 4) {
|
||||
ptr = &ptr[Len(key) - 4];
|
||||
isSet = strcmp(ptr, "_set") == 0;
|
||||
}
|
||||
// OutputArrayMethod(className, el, out);
|
||||
OutputMemberReferenceMethod(className, isSet, el, out);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue