@@ -153,25 +153,21 @@ private void WrapConstructor(Method method, string wrapper, string @params)
153153 Context . ParserOptions . IsItaniumLikeAbi ) . Select (
154154 p => cppTypePrinter . VisitParameter ( p ) ) ) ;
155155
156- string @namespace = method . Namespace . Visit ( cppTypePrinter ) ;
157- Class @class = ( Class ) method . Namespace ;
158- bool needSubclass = method . Access == AccessSpecifier . Protected || @class . IsAbstract ;
159- if ( needSubclass )
156+ if ( method . Access != AccessSpecifier . Protected )
157+ Write ( "extern \" C\" " ) ;
158+ Write ( $ "{ GetExporting ( ) } void { wrapper } ({ signature } ) ") ;
159+
160+ if ( method . Access == AccessSpecifier . Protected ||
161+ ( ( Class ) method . Namespace ) . IsAbstract )
160162 {
161- Write ( $ "extern \" C\" { GetExporting ( ) } void { wrapper } ({ signature } ) ") ;
162- WriteLine ( $ "{{ ::new ({ Helpers . InstanceField } ) { wrapper } { method . Namespace . Name } ({ @params } ); }}") ;
163+ Write ( $@ "{{ ::new ({ Helpers . InstanceField } ) {
164+ wrapper } { method . Namespace . Name } ({ @params } ); }}" ) ;
165+ WriteLine ( method . Access == AccessSpecifier . Protected ? " };" : string . Empty ) ;
163166 }
164167 else
165168 {
166- Write ( "extern \" C\" " ) ;
167- if ( needSubclass )
168- Write ( $@ "class { wrapper } { method . Namespace . Namespace . Name } : public {
169- method . Namespace . Namespace . Visit ( cppTypePrinter ) } {{ " ) ;
170- Write ( $ "{ GetExporting ( ) } void { wrapper } ({ signature } ) ") ;
171- Write ( $ "{{ ::new ({ Helpers . InstanceField } ) { @namespace } ({ @params } ); }}") ;
172- if ( needSubclass )
173- Write ( "; }" ) ;
174- NewLine ( ) ;
169+ string @namespace = method . Namespace . Visit ( cppTypePrinter ) ;
170+ WriteLine ( $ "{{ ::new ({ Helpers . InstanceField } ) { @namespace } ({ @params } ); }}") ;
175171 }
176172
177173 foreach ( var param in method . Parameters . Where ( p =>
0 commit comments