@@ -33,7 +33,7 @@ namespace ICSharpCode.Decompiler.Disassembler
3333 /// </summary>
3434 public sealed class ReflectionDisassembler
3535 {
36- ITextOutput output ;
36+ readonly ITextOutput output ;
3737 CancellationToken cancellationToken ;
3838 bool isInType ; // whether we are currently disassembling a whole type (-> defaultCollapsed for foldings)
3939 MethodBodyDisassembler methodBodyDisassembler ;
@@ -213,8 +213,9 @@ void DisassembleMethodInternal(MethodDefinition method)
213213 output . WriteLine ( ) ;
214214 }
215215 }
216+ WriteParameterAttributes ( 0 , method . MethodReturnType , method . MethodReturnType ) ;
216217 foreach ( var p in method . Parameters ) {
217- WriteParameterAttributes ( p ) ;
218+ WriteParameterAttributes ( p . Index + 1 , p , p ) ;
218219 }
219220 WriteSecurityDeclarations ( method ) ;
220221
@@ -613,22 +614,17 @@ void WriteParameters(Collection<ParameterDefinition> parameters)
613614 }
614615 }
615616
616- bool HasParameterAttributes ( ParameterDefinition p )
617+ void WriteParameterAttributes ( int index , IConstantProvider cp , ICustomAttributeProvider cap )
617618 {
618- return p . HasConstant || p . HasCustomAttributes ;
619- }
620-
621- void WriteParameterAttributes ( ParameterDefinition p )
622- {
623- if ( ! HasParameterAttributes ( p ) )
619+ if ( ! cp . HasConstant && ! cap . HasCustomAttributes )
624620 return ;
625- output . Write ( ".param [{0}]" , p . Index + 1 ) ;
626- if ( p . HasConstant ) {
621+ output . Write ( ".param [{0}]" , index ) ;
622+ if ( cp . HasConstant ) {
627623 output . Write ( " = " ) ;
628- WriteConstant ( p . Constant ) ;
624+ WriteConstant ( cp . Constant ) ;
629625 }
630626 output . WriteLine ( ) ;
631- WriteAttributes ( p . CustomAttributes ) ;
627+ WriteAttributes ( cap . CustomAttributes ) ;
632628 }
633629
634630 void WriteConstant ( object constant )
0 commit comments