@@ -55,66 +55,21 @@ public override bool VisitClassDecl(Class @class)
55
55
switch ( @class . Name )
56
56
{
57
57
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 ;
85
58
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 ;
97
59
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 )
101
65
{
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 ;
106
67
}
107
68
break ;
108
69
}
109
70
return true ;
110
71
}
111
72
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
-
118
73
public override bool VisitEnumDecl ( Enumeration @enum )
119
74
{
120
75
if ( ! base . VisitEnumDecl ( @enum ) )
0 commit comments