Partial support for %constant and structs

Test case is slightly modified from the test case in issue #250

Use of constant objects does not seem to work in Python - the type is
SwigPyObject instead of constant_directive.Type1.
This commit is contained in:
William S Fulton 2014-12-18 06:37:49 +00:00
commit 2e01533b23
7 changed files with 32 additions and 48 deletions

View file

@ -1614,7 +1614,14 @@ int Swig_VargetToFunction(Node *n, int flags) {
Delete(mangled);
Delete(sname);
} else {
String *nname = SwigType_namestr(name);
String *nname = 0;
if (Equal(nodeType(n), "constant")) {
String *rawval = Getattr(n, "rawval");
String *value = rawval ? rawval : Getattr(n, "value");
nname = NewStringf("(%s)", value);
} else {
nname = SwigType_namestr(name);
}
call = Swig_wrapped_var_assign(type, nname, varcref);
cres = Swig_cresult(ty, Swig_cresult_name(), call);
Setattr(n, "wrap:action", cres);