|
|
|
@ -378,6 +378,28 @@ namespace ICSharpCode.Decompiler.IL.Transforms
@@ -378,6 +378,28 @@ namespace ICSharpCode.Decompiler.IL.Transforms
|
|
|
|
|
previousIndex = index; |
|
|
|
|
} |
|
|
|
|
AddMissingAssignmentsForConversions(int.MaxValue, ref delayedActions); |
|
|
|
|
|
|
|
|
|
if (deconstructionResults != null) |
|
|
|
|
{ |
|
|
|
|
int i = previousIndex + 1; |
|
|
|
|
while (i < deconstructionResults.Length) |
|
|
|
|
{ |
|
|
|
|
var v = deconstructionResults[i]; |
|
|
|
|
// this should only happen in release mode, where usually the last deconstruction element
|
|
|
|
|
// is not stored to a temporary, if it is used directly (and only once!)
|
|
|
|
|
// after the deconstruction.
|
|
|
|
|
if (v?.LoadCount == 1) |
|
|
|
|
{ |
|
|
|
|
delayedActions += (DeconstructInstruction deconstructInst) => { |
|
|
|
|
var freshVar = context.Function.RegisterVariable(VariableKind.StackSlot, v.Type); |
|
|
|
|
deconstructInst.Assignments.Instructions.Add(new StLoc(freshVar, new LdLoc(v))); |
|
|
|
|
v.LoadInstructions[0].Variable = freshVar; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return startPos != pos; |
|
|
|
|
|
|
|
|
|
void AddMissingAssignmentsForConversions(int index, ref Action<DeconstructInstruction> delayedActions) |
|
|
|
@ -397,6 +419,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
@@ -397,6 +419,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
|
|
|
|
|
stLoc.Variable = freshVar; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
previousIndex = conversionResultIndex; |
|
|
|
|
conversionStLocIndex++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|