diff options
author | Rokas Kupstys <rokups@zoho.com> | 2019-07-28 15:58:03 +0300 |
---|---|---|
committer | Rokas Kupstys <rokups@zoho.com> | 2019-08-01 08:55:07 +0300 |
commit | 06345e2aa5724879df00edf9fa87fdd034a7c641 (patch) | |
tree | be4ab4dbc409b8e40accdff9f38e5421c62f6053 /Source | |
parent | 0ff6893b2dc08b713db3ae71b125de15d629bb9a (diff) | |
download | swig-06345e2aa5724879df00edf9fa87fdd034a7c641.tar.gz |
Fix invalid code generated for "%constant enum EnumType ..." and add a test.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Modules/csharp.cxx | 2 | ||||
-rw-r--r-- | Source/Modules/java.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 76ec6a4fb..17100b330 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1533,7 +1533,7 @@ public: if (classname_substituted_flag) { if (SwigType_isenum(t)) { // This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on) - Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname)); + Printf(constants_code, "(%s)%s.%s();\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname)); } else { // This handles function pointers using the %constant directive Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname)); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 259f23f8e..fcc83819d 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1633,7 +1633,7 @@ public: if (classname_substituted_flag) { if (SwigType_isenum(t)) { // This handles wrapping of inline initialised const enum static member variables (not when wrapping enum items - ignored later on) - Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name, Swig_name_get(getNSpace(), symname)); + Printf(constants_code, "%s.swigToEnum(%s.%s());\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname)); } else { // This handles function pointers using the %constant directive Printf(constants_code, "new %s(%s.%s(), false);\n", return_type, full_imclass_name ? full_imclass_name : imclass_name, Swig_name_get(getNSpace(), symname)); |