@@ -1760,49 +1760,43 @@ impl CodeGenerator for CompInfo {
1760
1760
}
1761
1761
1762
1762
let mut method_names = Default :: default ( ) ;
1763
- if ctx. options ( ) . codegen_config . methods {
1764
- for method in self . methods ( ) {
1765
- assert ! ( method. kind( ) != MethodKind :: Constructor ) ;
1766
- method. codegen_method ( ctx,
1767
- & mut methods,
1768
- & mut method_names,
1769
- result,
1770
- whitelisted_items,
1771
- self ) ;
1772
- }
1773
- }
1774
-
1775
- if ctx. options ( ) . codegen_config . constructors {
1776
- for sig in self . constructors ( ) {
1777
- Method :: new ( MethodKind :: Constructor ,
1778
- * sig,
1779
- /* const */
1780
- false )
1781
- . codegen_method ( ctx,
1782
- & mut methods,
1783
- & mut method_names,
1784
- result,
1785
- whitelisted_items,
1786
- self ) ;
1787
- }
1788
- }
1789
-
1790
- if ctx. options ( ) . codegen_config . destructors {
1791
- if let Some ( ( is_virtual, destructor) ) = self . destructor ( ) {
1792
- let kind = if is_virtual {
1793
- MethodKind :: VirtualDestructor
1794
- } else {
1795
- MethodKind :: Destructor
1796
- } ;
1763
+ for method in self . methods ( ) {
1764
+ assert ! ( method. kind( ) != MethodKind :: Constructor ) ;
1765
+ method. codegen_method ( ctx,
1766
+ & mut methods,
1767
+ & mut method_names,
1768
+ result,
1769
+ whitelisted_items,
1770
+ self ) ;
1771
+ }
1772
+
1773
+ for sig in self . constructors ( ) {
1774
+ Method :: new ( MethodKind :: Constructor ,
1775
+ * sig,
1776
+ /* const */
1777
+ false )
1778
+ . codegen_method ( ctx,
1779
+ & mut methods,
1780
+ & mut method_names,
1781
+ result,
1782
+ whitelisted_items,
1783
+ self ) ;
1784
+ }
1785
+
1786
+ if let Some ( ( is_virtual, destructor) ) = self . destructor ( ) {
1787
+ let kind = if is_virtual {
1788
+ MethodKind :: VirtualDestructor
1789
+ } else {
1790
+ MethodKind :: Destructor
1791
+ } ;
1797
1792
1798
- Method :: new ( kind, destructor, false )
1799
- . codegen_method ( ctx,
1800
- & mut methods,
1801
- & mut method_names,
1802
- result,
1803
- whitelisted_items,
1804
- self ) ;
1805
- }
1793
+ Method :: new ( kind, destructor, false )
1794
+ . codegen_method ( ctx,
1795
+ & mut methods,
1796
+ & mut method_names,
1797
+ result,
1798
+ whitelisted_items,
1799
+ self ) ;
1806
1800
}
1807
1801
}
1808
1802
@@ -1897,6 +1891,17 @@ impl MethodCodegen for Method {
1897
1891
result : & mut CodegenResult < ' a > ,
1898
1892
whitelisted_items : & ItemSet ,
1899
1893
_parent : & CompInfo ) {
1894
+ let config = & ctx. options ( ) . codegen_config ;
1895
+ match self . kind ( ) {
1896
+ MethodKind :: Constructor if !config. constructors => return ,
1897
+ MethodKind :: Destructor if !config. destructors => return ,
1898
+ MethodKind :: VirtualDestructor if !config. destructors => return ,
1899
+ MethodKind :: Static if !config. methods => return ,
1900
+ MethodKind :: Normal if !config. methods => return ,
1901
+ MethodKind :: Virtual if !config. methods => return ,
1902
+ _ => { }
1903
+ }
1904
+
1900
1905
if self . is_virtual ( ) {
1901
1906
return ; // FIXME
1902
1907
}
0 commit comments