@@ -55,66 +55,21 @@ public override bool VisitClassDecl(Class @class)
5555 switch ( @class . Name )
5656 {
5757 case "basic_string" :
58- foreach ( var method in @class . Methods . Where ( m => ! m . IsDestructor &&
59- m . OriginalName != "c_str" && m . OriginalName != "assign" ) )
60- method . ExplicitlyIgnore ( ) ;
61- foreach ( var basicString in GetCharSpecializations ( @class ) )
62- {
63- basicString . GenerationKind = GenerationKind . Generate ;
64- foreach ( var method in basicString . Methods )
65- {
66- if ( method . IsDestructor || method . OriginalName == "c_str" ||
67- ( method . OriginalName == "assign" &&
68- method . Parameters . Count == 1 &&
69- method . Parameters [ 0 ] . Type . IsPointerToPrimitiveType ( ) ) ||
70- ( method . IsConstructor &&
71- ! method . Parameters . Where ( p => p . Kind == ParameterKind . Regular ) . Any ( ) ) )
72- {
73- method . GenerationKind = GenerationKind . Generate ;
74- method . Namespace . GenerationKind = GenerationKind . Generate ;
75- method . InstantiatedFrom . GenerationKind = GenerationKind . Generate ;
76- method . InstantiatedFrom . Namespace . GenerationKind = GenerationKind . Generate ;
77- }
78- else
79- {
80- method . ExplicitlyIgnore ( ) ;
81- }
82- }
83- }
84- break ;
8558 case "allocator" :
86- foreach ( var method in @class . Methods )
87- method . ExplicitlyIgnore ( ) ;
88- foreach ( var allocator in GetCharSpecializations ( @class ) )
89- {
90- foreach ( var method in allocator . Methods )
91- method . ExplicitlyIgnore ( ) ;
92- allocator . GenerationKind = GenerationKind . Generate ;
93- allocator . TemplatedDecl . TemplatedDecl . GenerationKind = GenerationKind . Generate ;
94- allocator . GenerationKind = GenerationKind . Generate ;
95- }
96- break ;
9759 case "char_traits" :
98- foreach ( var method in @class . Methods )
99- method . ExplicitlyIgnore ( ) ;
100- foreach ( var charTraits in GetCharSpecializations ( @class ) )
60+ @class . GenerationKind = GenerationKind . Generate ;
61+ foreach ( var specialization in from s in @class . Specializations
62+ let arg = s . Arguments [ 0 ] . Type . Type . Desugar ( )
63+ where arg . IsPrimitiveType ( PrimitiveType . Char )
64+ select s )
10165 {
102- foreach ( var method in charTraits . Methods )
103- method . ExplicitlyIgnore ( ) ;
104- charTraits . GenerationKind = GenerationKind . Generate ;
105- charTraits . TemplatedDecl . TemplatedDecl . GenerationKind = GenerationKind . Generate ;
66+ specialization . GenerationKind = GenerationKind . Generate ;
10667 }
10768 break ;
10869 }
10970 return true ;
11071 }
11172
112- private static IEnumerable < ClassTemplateSpecialization > GetCharSpecializations ( Class @class )
113- {
114- return @class . Specializations . Where ( s =>
115- s . Arguments [ 0 ] . Type . Type . Desugar ( ) . IsPrimitiveType ( PrimitiveType . Char ) ) ;
116- }
117-
11873 public override bool VisitEnumDecl ( Enumeration @enum )
11974 {
12075 if ( ! base . VisitEnumDecl ( @enum ) )
0 commit comments