@@ -1709,11 +1709,11 @@ class CSHARP:public Language {
1709
1709
* addInterfaceNameAndUpcasts()
1710
1710
* ----------------------------------------------------------------------------- */
1711
1711
1712
- void addInterfaceNameAndUpcasts (SwigType *smart, String *interface_list, String *interface_upcasts, Hash *base_list, String *c_classname) {
1712
+ void addInterfaceNameAndUpcasts (SwigType *smart, String *interface_list, String *interface_upcasts, Hash *base_list, SwigType *c_classname) {
1713
1713
List *keys = Keys (base_list);
1714
1714
for (Iterator it = First (keys); it.item ; it = Next (it)) {
1715
1715
Node *base = Getattr (base_list, it.item );
1716
- String *c_baseclass = SwigType_namestr ( Getattr (base, " name" ) );
1716
+ SwigType *c_baseclassname = Getattr (base, " name" );
1717
1717
String *interface_name = Getattr (base, " interface:name" );
1718
1718
if (Len (interface_list))
1719
1719
Append (interface_list, " , " );
@@ -1733,12 +1733,11 @@ class CSHARP:public Language {
1733
1733
Replaceall (cptr_method_name, " $interfacename" , interface_name);
1734
1734
1735
1735
String *upcast_method_name = Swig_name_member (getNSpace (), getClassPrefix (), cptr_method_name);
1736
- upcastsCode (smart, upcast_method_name, c_classname, c_baseclass );
1736
+ upcastsCode (smart, upcast_method_name, c_classname, c_baseclassname );
1737
1737
1738
1738
Delete (upcast_method_name);
1739
1739
Delete (cptr_method_name);
1740
1740
Delete (interface_code);
1741
- Delete (c_baseclass);
1742
1741
}
1743
1742
Delete (keys);
1744
1743
}
@@ -1749,37 +1748,42 @@ class CSHARP:public Language {
1749
1748
* Add code for C++ casting to base class
1750
1749
* ----------------------------------------------------------------------------- */
1751
1750
1752
- void upcastsCode (SwigType *smart, String *upcast_method_name, String *c_classname, String *c_baseclass ) {
1751
+ void upcastsCode (SwigType *smart, String *upcast_method_name, SwigType *c_classname, SwigType *c_baseclassname ) {
1753
1752
String *wname = Swig_name_wrapper (upcast_method_name);
1754
1753
1755
1754
Printv (imclass_cppcasts_code, " \n [global::System.Runtime.InteropServices.DllImport(\" " , dllimport, " \" , EntryPoint=\" " , wname, " \" )]\n " , NIL);
1756
1755
Printf (imclass_cppcasts_code, " public static extern global::System.IntPtr %s(global::System.IntPtr jarg1);\n " , upcast_method_name);
1757
1756
1758
1757
Replaceall (imclass_cppcasts_code, " $csclassname" , proxy_class_name);
1759
1758
1759
+ String *classname = SwigType_namestr (c_classname);
1760
+ String *baseclassname = SwigType_namestr (c_baseclassname);
1760
1761
if (smart) {
1761
1762
String *smartnamestr = SwigType_namestr (smart);
1762
1763
String *bsmartnamestr = SwigType_namestr (smart);
1763
1764
1764
- SwigType *rclassname = SwigType_typedef_resolve_all (c_classname);
1765
- SwigType *rbaseclass = SwigType_typedef_resolve_all (c_baseclass);
1766
- Replaceall (bsmartnamestr, rclassname, rbaseclass);
1767
-
1768
- Delete (rclassname);
1769
- Delete (rbaseclass);
1765
+ SwigType *rclassname = SwigType_typedef_resolve_all (classname);
1766
+ SwigType *rbaseclassname = SwigType_typedef_resolve_all (baseclassname);
1767
+ Replaceall (bsmartnamestr, rclassname, rbaseclassname);
1770
1768
1771
1769
Printv (upcasts_code,
1772
1770
" SWIGEXPORT " , bsmartnamestr, " * SWIGSTDCALL " , wname, " (" , smartnamestr, " *jarg1) {\n " ,
1773
1771
" return jarg1 ? new " , bsmartnamestr, " (*jarg1) : 0;\n "
1774
1772
" }\n " , " \n " , NIL);
1773
+
1774
+ Delete (rbaseclassname);
1775
+ Delete (rclassname);
1775
1776
Delete (bsmartnamestr);
1776
1777
Delete (smartnamestr);
1777
1778
} else {
1778
1779
Printv (upcasts_code,
1779
- " SWIGEXPORT " , c_baseclass , " * SWIGSTDCALL " , wname, " (" , c_classname , " *jarg1) {\n " ,
1780
- " return (" , c_baseclass , " *)jarg1;\n "
1780
+ " SWIGEXPORT " , baseclassname , " * SWIGSTDCALL " , wname, " (" , classname , " *jarg1) {\n " ,
1781
+ " return (" , baseclassname , " *)jarg1;\n "
1781
1782
" }\n " , " \n " , NIL);
1782
1783
}
1784
+
1785
+ Delete (baseclassname);
1786
+ Delete (classname);
1783
1787
Delete (wname);
1784
1788
}
1785
1789
@@ -1788,10 +1792,9 @@ class CSHARP:public Language {
1788
1792
* ----------------------------------------------------------------------------- */
1789
1793
1790
1794
void emitProxyClassDefAndCPPCasts (Node *n) {
1791
- String *c_classname = SwigType_namestr ( Getattr (n, " name" ) );
1792
- String *c_baseclass = NULL ;
1795
+ SwigType *c_classname = Getattr (n, " name" );
1796
+ SwigType *c_baseclassname = NULL ;
1793
1797
String *baseclass = NULL ;
1794
- String *c_baseclassname = NULL ;
1795
1798
String *interface_list = NewStringEmpty ();
1796
1799
String *interface_upcasts = NewStringEmpty ();
1797
1800
SwigType *typemap_lookup_type = Getattr (n, " classtypeobj" );
@@ -1813,12 +1816,13 @@ class CSHARP:public Language {
1813
1816
Iterator base = First (baselist);
1814
1817
while (base.item ) {
1815
1818
if (!(GetFlag (base.item , " feature:ignore" ) || Getattr (base.item , " feature:interface" ))) {
1816
- String *baseclassname = Getattr (base.item , " name" );
1819
+ SwigType *baseclassname = Getattr (base.item , " name" );
1817
1820
if (!c_baseclassname) {
1818
- c_baseclassname = baseclassname;
1819
- baseclass = Copy (getProxyName (baseclassname));
1820
- if (baseclass)
1821
- c_baseclass = SwigType_namestr (baseclassname);
1821
+ String *name = getProxyName (baseclassname);
1822
+ if (name) {
1823
+ c_baseclassname = baseclassname;
1824
+ baseclass = name;
1825
+ }
1822
1826
} else {
1823
1827
/* Warn about multiple inheritance for additional base class(es) */
1824
1828
String *proxyclassname = Getattr (n, " classtypeobj" );
@@ -1834,15 +1838,14 @@ class CSHARP:public Language {
1834
1838
if (interface_bases)
1835
1839
addInterfaceNameAndUpcasts (smart, interface_list, interface_upcasts, interface_bases, c_classname);
1836
1840
1837
- bool derived = baseclass && getProxyName (c_baseclassname) ;
1841
+ bool derived = baseclass != 0 ;
1838
1842
if (derived && purebase_notderived)
1839
1843
pure_baseclass = empty_string;
1840
1844
const String *wanted_base = baseclass ? baseclass : pure_baseclass;
1841
1845
1842
1846
if (purebase_replace) {
1843
1847
wanted_base = pure_baseclass;
1844
1848
derived = false ;
1845
- Delete (baseclass);
1846
1849
baseclass = NULL ;
1847
1850
if (purebase_notderived)
1848
1851
Swig_error (Getfile (n), Getline (n), " The csbase typemap for proxy %s must contain just one of the 'replace' or 'notderived' attributes.\n " , typemap_lookup_type);
@@ -2033,12 +2036,11 @@ class CSHARP:public Language {
2033
2036
2034
2037
if (derived) {
2035
2038
String *upcast_method_name = Swig_name_member (getNSpace (), getClassPrefix (), smart != 0 ? " SWIGSmartPtrUpcast" : " SWIGUpcast" );
2036
- upcastsCode (smart, upcast_method_name, c_classname, c_baseclass );
2039
+ upcastsCode (smart, upcast_method_name, c_classname, c_baseclassname );
2037
2040
Delete (upcast_method_name);
2038
2041
}
2039
2042
2040
2043
Delete (smart);
2041
- Delete (baseclass);
2042
2044
}
2043
2045
2044
2046
/* ----------------------------------------------------------------------
0 commit comments