@@ -32,9 +32,9 @@ public AnalysisContext(Instruction current, int position) {
3232 /// <param name="afterThisExec">Analyze after this instruction</param>
3333 /// <returns>Return all possible uses of the top value on the stack/returns>
3434 public static Instruction [ ] TraceStackValueConsumers ( MethodDefinition caller , Instruction afterThisExec ) {
35- var visited = new HashSet < ( Instruction , int ) > ( ) ;
36- var results = new HashSet < Instruction > ( ) ;
37- var workStack = new Stack < AnalysisContext > ( ) ;
35+ HashSet < ( Instruction , int ) > visited = new HashSet < ( Instruction , int ) > ( ) ;
36+ HashSet < Instruction > results = new HashSet < Instruction > ( ) ;
37+ Stack < AnalysisContext > workStack = new Stack < AnalysisContext > ( ) ;
3838
3939 Instruction initialInstruction = afterThisExec . Next ;
4040
@@ -126,7 +126,7 @@ private static IEnumerable<Instruction> GetNextInstructions(Instruction current)
126126 cachedJumpSitess ??= BuildJumpSitesMap ( caller ) ;
127127
128128 // initialize analysis queue
129- var workStack = new Stack < ( Instruction current , int stackBalance , HashSet < Instruction > visited ) > ( ) ;
129+ Stack < ( Instruction current , int stackBalance , HashSet < Instruction > visited ) > workStack = new Stack < ( Instruction current , int stackBalance , HashSet < Instruction > visited ) > ( ) ;
130130
131131 workStack . Push ( ( afterThisExec , - 1 , [ ] ) ) ;
132132
@@ -195,7 +195,7 @@ public static StackTopTypePath[] AnalyzeStackTopTypeAllPaths(MethodDefinition ca
195195 cachedJumpSitess ??= BuildJumpSitesMap ( caller ) ;
196196
197197 // initialize analysis queue
198- var workStack = new Stack < ( ReversibleLinkedList < Instruction > path , Instruction current , int stackBalance , HashSet < Instruction > visited ) > ( ) ;
198+ Stack < ( ReversibleLinkedList < Instruction > path , Instruction current , int stackBalance , HashSet < Instruction > visited ) > workStack = new Stack < ( ReversibleLinkedList < Instruction > path , Instruction current , int stackBalance , HashSet < Instruction > visited ) > ( ) ;
199199
200200 workStack . Push ( ( new ( ) , afterThisExec , - 1 , [ ] ) ) ;
201201
@@ -345,7 +345,7 @@ public static bool CheckSinglePredecessor(
345345 }
346346
347347 static void FindEndpoints ( IEnumerable < Instruction > nodes , out Instruction min , out Instruction max , out HashSet < Instruction > block ) {
348- var nodeSet = new HashSet < Instruction > ( nodes ) ;
348+ HashSet < Instruction > nodeSet = new HashSet < Instruction > ( nodes ) ;
349349
350350 if ( nodeSet . Count == 0 ) throw new ArgumentException ( "Node set must contain at least one node" ) ;
351351
@@ -475,20 +475,20 @@ private static bool IsUnreachablePredecessor(Instruction instr) {
475475 var parameter = IL . GetReferencedParameter ( method , instruction ) ;
476476 return parameter . ParameterType ;
477477 case Code . Ldfld :
478- var field = ( FieldReference ) instruction . Operand ;
478+ FieldReference field = ( FieldReference ) instruction . Operand ;
479479 return field . FieldType ;
480480 case Code . Ldsfld :
481481 field = ( FieldReference ) instruction . Operand ;
482482 return field . FieldType ;
483483 case Code . Call :
484484 case Code . Callvirt :
485- var methodCall = ( MethodReference ) instruction . Operand ;
485+ MethodReference methodCall = ( MethodReference ) instruction . Operand ;
486486 return IL . GetMethodReturnType ( methodCall , method ) ;
487487 case Code . Calli :
488- var sig = ( CallSite ) instruction . Operand ;
488+ CallSite sig = ( CallSite ) instruction . Operand ;
489489 return sig . ReturnType ;
490490 case Code . Newobj :
491- var ctor = ( MethodReference ) instruction . Operand ;
491+ MethodReference ctor = ( MethodReference ) instruction . Operand ;
492492 return ctor . DeclaringType ;
493493 case Code . Newarr :
494494 return new ArrayType ( ( TypeReference ) instruction . Operand ) ;
@@ -628,7 +628,7 @@ private static bool IsUnreachablePredecessor(Instruction instr) {
628628 case Code . Ldind_Ref :
629629 var referencePaths = AnalyzeInstructionArgsSources ( method , instruction , cachedJumpSites ) . First ( ) ;
630630 var referenceInstructions = referencePaths . ParametersSources [ 0 ] . Instructions ;
631- var referenceType = ( ByReferenceType ) AnalyzeStackTopType ( method , referenceInstructions . Last ( ) , cachedJumpSites ) ! ;
631+ ByReferenceType referenceType = ( ByReferenceType ) AnalyzeStackTopType ( method , referenceInstructions . Last ( ) , cachedJumpSites ) ! ;
632632 return referenceType . ElementType ;
633633
634634 case Code . Ldobj : return ( TypeReference ) instruction . Operand ;
@@ -734,15 +734,15 @@ public static FlowPath<ParameterSource>[] AnalyzeParametersSources(MethodDefinit
734734 cachedJumpSitess ??= BuildJumpSitesMap ( caller ) ;
735735
736736 // Resolve method signature
737- var callee = ( MethodReference ) target . Operand ;
737+ MethodReference callee = ( MethodReference ) target . Operand ;
738738 bool hasThis = ( target . OpCode == OpCodes . Call || target . OpCode == OpCodes . Callvirt ) && callee . HasThis ;
739739 int paramCount = callee . Parameters . Count + ( hasThis ? 1 : 0 ) ;
740740 if ( target . OpCode == OpCodes . Newobj )
741741 paramCount = callee . Parameters . Count ;
742742
743743 // Initialize analysis queue
744- var workStack = new Stack < ReverseAnalysisContext > ( ) ;
745- var initialDemand = new StackDemand ( paramCount , GetPushCount ( caller . Body , target ) ) ;
744+ Stack < ReverseAnalysisContext > workStack = new Stack < ReverseAnalysisContext > ( ) ;
745+ StackDemand initialDemand = new StackDemand ( paramCount , GetPushCount ( caller . Body , target ) ) ;
746746 workStack . Push ( new ReverseAnalysisContext (
747747 current : target ,
748748 previous : target . Previous ,
@@ -765,7 +765,7 @@ public static FlowPath<ParameterSource>[] AnalyzeParametersSources(MethodDefinit
765765
766766 // Clone context to prevent state pollution
767767 var stackDemand = ctx . StackDemand . Clone ( ) ;
768- var path = new ReversibleLinkedList < Instruction > ( ctx . Path ) ;
768+ ReversibleLinkedList < Instruction > path = new ReversibleLinkedList < Instruction > ( ctx . Path ) ;
769769
770770 // Process tail instruction's reverse stack effect
771771 int originalPush = GetPushCount ( caller . Body , ctx . Current ) ;
@@ -860,8 +860,8 @@ public static FlowPath<InstructionArgsSource>[] AnalyzeInstructionArgsSources(Me
860860 var argsCount = GetInstructionArgCount ( caller . Body , target ) ;
861861
862862 // initialize analysis queue
863- var workStack = new Stack < ReverseAnalysisContext > ( ) ;
864- var initialDemand = new StackDemand ( argsCount , GetPushCount ( caller . Body , target ) ) ;
863+ Stack < ReverseAnalysisContext > workStack = new Stack < ReverseAnalysisContext > ( ) ;
864+ StackDemand initialDemand = new StackDemand ( argsCount , GetPushCount ( caller . Body , target ) ) ;
865865
866866 workStack . Push ( new ReverseAnalysisContext (
867867 current : target ,
@@ -885,7 +885,7 @@ public static FlowPath<InstructionArgsSource>[] AnalyzeInstructionArgsSources(Me
885885
886886 // Clone context to prevent polluting
887887 var stackDemand = ctx . StackDemand . Clone ( ) ;
888- var path = new ReversibleLinkedList < Instruction > ( ctx . Path ) ;
888+ ReversibleLinkedList < Instruction > path = new ReversibleLinkedList < Instruction > ( ctx . Path ) ;
889889
890890 // Process the reverse stack effect of the tail instruction
891891 int originalPush = GetPushCount ( caller . Body , ctx . Current ) ;
@@ -946,7 +946,7 @@ public static FlowPath<InstructionArgsSource>[] AnalyzeInstructionArgsSources(Me
946946 return BuildFlowPaths ( caller . Body , paths ) ;
947947 }
948948 public static Dictionary < Instruction , List < Instruction > > BuildJumpSitesMap ( MethodDefinition method ) {
949- var jumpTargets = new Dictionary < Instruction , List < Instruction > > ( ) ;
949+ Dictionary < Instruction , List < Instruction > > jumpTargets = new Dictionary < Instruction , List < Instruction > > ( ) ;
950950 foreach ( var instruction in method . Body . Instructions ) {
951951 if ( instruction . Operand is ILLabel label ) {
952952 var target = label . Target ;
@@ -997,7 +997,7 @@ private static List<ParameterSource> AnalyzeMethodCallPath(MethodDefinition call
997997 if ( target . OpCode == OpCodes . Newobj )
998998 paramCount = callee . Parameters . Count ;
999999
1000- var parameters = new List < ParameterSource > ( ) ;
1000+ List < ParameterSource > parameters = new List < ParameterSource > ( ) ;
10011001 int currentIndex = path . Length - 1 ;
10021002
10031003 for ( int i = 0 ; i < paramCount ; i ++ ) {
@@ -1006,7 +1006,7 @@ private static List<ParameterSource> AnalyzeMethodCallPath(MethodDefinition call
10061006 var ( start , end ) = FindArgRange ( path , deltas , currentIndex ) ;
10071007 if ( start == - 1 ) break ;
10081008
1009- var paramInstructions = new List < Instruction > ( ) ;
1009+ List < Instruction > paramInstructions = new List < Instruction > ( ) ;
10101010 for ( int j = start ; j <= end ; j ++ )
10111011 paramInstructions . Add ( path [ j ] ) ;
10121012
@@ -1033,7 +1033,7 @@ private static List<ParameterSource> AnalyzeMethodCallPath(MethodDefinition call
10331033 private static List < InstructionArgsSource > AnalyzeInstructionArgs ( MethodBody body , Instruction target , int argsCount , Instruction [ ] path ) {
10341034 path = [ .. path . Take ( path . Length - 1 ) ] ;
10351035 var deltas = ComputeStackDeltas ( body , path ) ;
1036- var argsSources = new List < InstructionArgsSource > ( ) ;
1036+ List < InstructionArgsSource > argsSources = new List < InstructionArgsSource > ( ) ;
10371037
10381038 int currentIndex = path . Length - 1 ;
10391039
@@ -1043,7 +1043,7 @@ private static List<InstructionArgsSource> AnalyzeInstructionArgs(MethodBody bod
10431043 var ( start , end ) = FindArgRange ( path , deltas , currentIndex ) ;
10441044 if ( start == - 1 ) break ;
10451045
1046- var argInstructions = new List < Instruction > ( ) ;
1046+ List < Instruction > argInstructions = new List < Instruction > ( ) ;
10471047 for ( int j = start ; j <= end ; j ++ )
10481048 argInstructions . Add ( path [ j ] ) ;
10491049
@@ -1148,7 +1148,7 @@ public static int GetPopCount(MethodBody body, Instruction instruction) {
11481148 return 0 ;
11491149 case StackBehaviour . Varpop :
11501150 if ( instruction . OpCode == OpCodes . Call || instruction . OpCode == OpCodes . Callvirt || instruction . OpCode == OpCodes . Newobj ) {
1151- var methodRef = ( MethodReference ) instruction . Operand ;
1151+ MethodReference methodRef = ( MethodReference ) instruction . Operand ;
11521152 int count = methodRef . Parameters . Count ;
11531153 if ( instruction . OpCode != OpCodes . Newobj && methodRef . HasThis )
11541154 count ++ ;
@@ -1187,11 +1187,11 @@ public static int GetPushCount(MethodBody body, Instruction instruction) {
11871187 return 2 ;
11881188 case StackBehaviour . Varpush :
11891189 if ( instruction . OpCode == OpCodes . Call || instruction . OpCode == OpCodes . Callvirt ) {
1190- var method = ( MethodReference ) instruction . Operand ;
1190+ MethodReference method = ( MethodReference ) instruction . Operand ;
11911191 return method . ReturnType . FullName == "System.Void" ? 0 : 1 ;
11921192 }
11931193 else if ( instruction . OpCode == OpCodes . Calli ) {
1194- var sig = ( CallSite ) instruction . Operand ;
1194+ CallSite sig = ( CallSite ) instruction . Operand ;
11951195 return sig . ReturnType . FullName == "System.Void" ? 0 : 1 ;
11961196 }
11971197 else if ( instruction . OpCode == OpCodes . Newobj ) {
0 commit comments