@@ -69,7 +69,7 @@ private string GetWrapper(Module module)
69
69
70
70
private static string GetDerivedType ( string @namespace , string wrapper )
71
71
{
72
- return $@ "class { wrapper } { @namespace } : public { @namespace } {{ public: ";
72
+ return $ "class { wrapper } { @namespace } : public { @namespace } {{ public: ";
73
73
}
74
74
75
75
private void WrapConstructor ( Method method )
@@ -135,7 +135,7 @@ private void WrapDestructor(Method method)
135
135
bool isProtected = method . Access == AccessSpecifier . Protected ;
136
136
string @namespace = method . Namespace . Visit ( cppTypePrinter ) ;
137
137
if ( isProtected )
138
- Write ( $ " { GetDerivedType ( @namespace , wrapper ) } " ) ;
138
+ Write ( GetDerivedType ( @namespace , wrapper ) ) ;
139
139
else
140
140
Write ( "extern \" C\" { " ) ;
141
141
Write ( $ "void { wrapper } ") ;
@@ -173,13 +173,17 @@ private void TakeFunctionAddress(Function function)
173
173
Write ( $@ "{ returnType } ({ ( method != null && ! method . IsStatic ?
174
174
( @namespace + "::" ) : string . Empty ) } *{ wrapper } ){ signature } " ) ;
175
175
else
176
- Write ( $@ "auto { wrapper } ") ;
177
- Write ( $@ " = &{ functionName } ;") ;
176
+ Write ( $ "auto { wrapper } ") ;
178
177
if ( function . Access == AccessSpecifier . Protected )
179
178
{
179
+ Write ( $ " = &{ wrapper } { @namespace } ::{ functionName } ;") ;
180
180
WriteLine ( " };" ) ;
181
181
Write ( $ "auto { wrapper } protected = { wrapper } { @namespace } ::{ wrapper } ;") ;
182
182
}
183
+ else
184
+ {
185
+ Write ( $ " = &{ functionName } ;") ;
186
+ }
183
187
NewLine ( ) ;
184
188
}
185
189
@@ -189,19 +193,19 @@ private string GetSignature(Function function)
189
193
190
194
var paramTypes = string . Join ( ", " , function . Parameters . Where (
191
195
p => p . Kind == ParameterKind . Regular ) . Select (
192
- p => cppTypePrinter . VisitParameterDecl ( p ) ) ) ;
196
+ cppTypePrinter . VisitParameterDecl ) ) ;
193
197
194
198
var variadicType = function . IsVariadic ?
195
- ( function . Parameters . Where (
196
- p => p . Kind == ParameterKind . Regular ) . Any ( ) ? ", ..." : "..." ) :
199
+ ( function . Parameters . Any (
200
+ p => p . Kind == ParameterKind . Regular ) ? ", ..." : "..." ) :
197
201
string . Empty ;
198
202
199
- var @const = method != null && method . IsConst ? " const" : string . Empty ;
203
+ var @const = method ? . IsConst == true ? " const" : string . Empty ;
200
204
201
205
var refQualifier = method == null || method . RefQualifier == RefQualifier . None ?
202
206
string . Empty : ( method . RefQualifier == RefQualifier . LValue ? " &" : " &&" ) ;
203
207
204
- return $@ "({ paramTypes } { variadicType } ){ @const } { refQualifier } ";
208
+ return $ "({ paramTypes } { variadicType } ){ @const } { refQualifier } ";
205
209
}
206
210
207
211
private string GetFunctionName ( Function function , string @namespace )
@@ -219,16 +223,16 @@ private void WriteRedeclaration(Function function, string returnType,
219
223
{
220
224
Stack < string > parentsOpen = GenerateNamespace ( function ) ;
221
225
var functionType = ( FunctionType ) function . FunctionType . Type ;
222
- Write ( $@ "{ string . Join ( string . Empty , parentsOpen ) } ") ;
226
+ Write ( $ "{ string . Concat ( parentsOpen ) } ") ;
223
227
if ( function . IsConstExpr )
224
228
Write ( "constexpr " ) ;
225
229
Write ( returnType ) ;
226
230
Write ( " " ) ;
227
- Write ( parentsOpen . Any ( ) ? function . OriginalName : functionName ) ;
231
+ Write ( parentsOpen . Count > 0 ? function . OriginalName : functionName ) ;
228
232
Write ( paramTypes ) ;
229
233
if ( functionType . ExceptionSpecType == ExceptionSpecType . BasicNoexcept )
230
234
Write ( " noexcept" ) ;
231
- WriteLine ( $ ";{ string . Join ( string . Empty , parentsOpen . Select ( p => " }" ) ) } ") ;
235
+ WriteLine ( $ ";{ string . Concat ( parentsOpen . Select ( p => " }" ) ) } ") ;
232
236
}
233
237
234
238
private static Stack < string > GenerateNamespace ( Function function )
0 commit comments