@@ -201,7 +201,8 @@ public override TypePrinterResult VisitPointerType(PointerType pointer,
201201 // * Any pointer type.
202202 // * Any user-defined struct type that contains fields of unmanaged types only.
203203 var finalPointee = ( pointee . GetFinalPointee ( ) ?? pointee ) . Desugar ( ) ;
204- if ( finalPointee . IsPrimitiveType ( ) )
204+ Enumeration @enum ;
205+ if ( finalPointee . IsPrimitiveType ( ) || finalPointee . TryGetEnum ( out @enum ) )
205206 {
206207 // Skip one indirection if passed by reference
207208 bool isRefParam = Parameter != null && ( Parameter . IsOut || Parameter . IsInOut ) ;
@@ -220,18 +221,8 @@ public override TypePrinterResult VisitPointerType(PointerType pointer,
220221 var result = pointer . QualifiedPointee . Visit ( this ) ;
221222 allowStrings = true ;
222223
223- return ! isRefParam && result . Type == IntPtrType ? "void**" : result + "*" ;
224- }
225-
226- Enumeration @enum ;
227- if ( pointee . TryGetEnum ( out @enum ) )
228- {
229- // Skip one indirection if passed by reference
230- if ( isManagedContext && Parameter != null && ( Parameter . IsOut || Parameter . IsInOut )
231- && pointee == finalPointee )
232- return pointer . QualifiedPointee . Visit ( this ) ;
233-
234- return pointer . QualifiedPointee . Visit ( this ) + "*" ;
224+ string @ref = Parameter != null && Parameter . IsIndirect ? string . Empty : "*" ;
225+ return ! isRefParam && result . Type == this . IntPtrType ? "void**" : result + @ref ;
235226 }
236227
237228 Class @class ;
@@ -738,8 +729,6 @@ private static string GetParameterUsage(ParameterUsage usage)
738729
739730 public override TypePrinterResult VisitFieldDecl ( Field field )
740731 {
741- var cSharpSourcesDummy = new CSharpSources ( Context , new List < TranslationUnit > ( ) ) ;
742-
743732 PushMarshalKind ( MarshalKind . NativeField ) ;
744733 var fieldTypePrinted = field . QualifiedType . Visit ( this ) ;
745734 PopMarshalKind ( ) ;
0 commit comments