Fix cstype typemap lookup for member variables so that a fully qualified variable name matches
This commit is contained in:
parent
afc2b884a4
commit
0e6af5c0ea
3 changed files with 45 additions and 15 deletions
|
|
@ -5,6 +5,14 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 2.0.10 (in progress)
|
Version 2.0.10 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2013-01-15: wsfulton
|
||||||
|
[C#] Fix cstype typemap lookup for member variables so that a fully qualified variable name
|
||||||
|
matches. For example:
|
||||||
|
%typemap(cstype) bool MVar::mvar "MyBool"
|
||||||
|
struct MVar {
|
||||||
|
bool mvar;
|
||||||
|
};
|
||||||
|
|
||||||
2013-01-11: Brant Kyser
|
2013-01-11: Brant Kyser
|
||||||
[Java, C#, D] SF Bug #1299 - Fix generated names for when %nspace is used on
|
[Java, C#, D] SF Bug #1299 - Fix generated names for when %nspace is used on
|
||||||
classes with the same name in two different namespaces.
|
classes with the same name in two different namespaces.
|
||||||
|
|
|
||||||
|
|
@ -117,3 +117,22 @@ void hoop(WasCrashing was) {}
|
||||||
enum BigNumbers { big=0x80000000, bigger };
|
enum BigNumbers { big=0x80000000, bigger };
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Member variable qualification
|
||||||
|
%typemap(cstype) bool "badtype1"
|
||||||
|
%typemap(cstype) bool mvar "badtype2"
|
||||||
|
%typemap(cstype) bool svar "badtype4"
|
||||||
|
%typemap(cstype) bool gvar "badtype5"
|
||||||
|
%typemap(cstype) bool MVar::mvar "bool"
|
||||||
|
%typemap(cstype) bool MVar::svar "bool"
|
||||||
|
%typemap(cstype) bool Glob::gvar "bool"
|
||||||
|
%inline %{
|
||||||
|
struct MVar {
|
||||||
|
bool mvar;
|
||||||
|
static bool svar;
|
||||||
|
};
|
||||||
|
namespace Glob {
|
||||||
|
bool gvar;
|
||||||
|
}
|
||||||
|
bool MVar::svar = false;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2310,15 +2310,18 @@ public:
|
||||||
// Get the C# variable type - obtained differently depending on whether a setter is required.
|
// Get the C# variable type - obtained differently depending on whether a setter is required.
|
||||||
String *variable_type = return_type;
|
String *variable_type = return_type;
|
||||||
if (setter_flag) {
|
if (setter_flag) {
|
||||||
assert(last_parm);
|
assert(last_parm); // (last parameter is the only parameter for properties)
|
||||||
p = last_parm; // (last parameter is the only parameter for properties)
|
/* Get variable type - ensure the variable name is fully resolved during typemap lookup via the symbol table set in NewParmNode */
|
||||||
SwigType *pt = Getattr(p, "type");
|
SwigType *cvariable_type = Getattr(last_parm, "type");
|
||||||
if ((tm = Getattr(p, "tmap:cstype"))) {
|
Parm *variable_parm = NewParmNode(cvariable_type, n);
|
||||||
substituteClassname(pt, tm);
|
if ((tm = Swig_typemap_lookup("cstype", variable_parm, "", 0))) {
|
||||||
String *cstypeout = Getattr(p, "tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap
|
String *cstypeout = Getattr(variable_parm, "tmap:cstype:out"); // the type in the cstype typemap's out attribute overrides the type in the typemap
|
||||||
variable_type = cstypeout ? cstypeout : tm;
|
if (cstypeout)
|
||||||
|
tm = cstypeout;
|
||||||
|
substituteClassname(cvariable_type, tm);
|
||||||
|
variable_type = tm;
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSOUT_UNDEF, input_file, line_number, "No csvarin typemap defined for %s\n", SwigType_str(pt, 0));
|
Swig_warning(WARN_CSHARP_TYPEMAP_CSOUT_UNDEF, input_file, line_number, "No cstype typemap defined for %s\n", SwigType_str(cvariable_type, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const String *csattributes = Getattr(n, "feature:cs:attributes");
|
const String *csattributes = Getattr(n, "feature:cs:attributes");
|
||||||
|
|
@ -2333,17 +2336,17 @@ public:
|
||||||
|
|
||||||
if (setter_flag) {
|
if (setter_flag) {
|
||||||
// Setter method
|
// Setter method
|
||||||
assert(last_parm);
|
assert(last_parm); // (last parameter is the only parameter for properties)
|
||||||
p = last_parm; // (last parameter is the only parameter for properties)
|
SwigType *cvariable_type = Getattr(last_parm, "type");
|
||||||
SwigType *pt = Getattr(p, "type");
|
Parm *variable_parm = NewParmNode(cvariable_type, n);
|
||||||
if ((tm = Getattr(p, "tmap:csvarin"))) {
|
if ((tm = Swig_typemap_lookup("csvarin", variable_parm, "", 0))) {
|
||||||
substituteClassname(pt, tm);
|
substituteClassname(cvariable_type, tm);
|
||||||
Replaceall(tm, "$csinput", "value");
|
Replaceall(tm, "$csinput", "value");
|
||||||
Replaceall(tm, "$imcall", imcall);
|
Replaceall(tm, "$imcall", imcall);
|
||||||
excodeSubstitute(n, tm, "csvarin", p);
|
excodeSubstitute(n, tm, "csvarin", variable_parm);
|
||||||
Printf(proxy_class_code, "%s", tm);
|
Printf(proxy_class_code, "%s", tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSOUT_UNDEF, input_file, line_number, "No csvarin typemap defined for %s\n", SwigType_str(pt, 0));
|
Swig_warning(WARN_CSHARP_TYPEMAP_CSOUT_UNDEF, input_file, line_number, "No csvarin typemap defined for %s\n", SwigType_str(cvariable_type, 0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Getter method
|
// Getter method
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue