Browse Source

Reject MoveNext() methods with more than one cachedStateVar.

pull/1633/head
Daniel Grunwald 6 years ago
parent
commit
5177c56d88
  1. 3
      ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

3
ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

@ -354,6 +354,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
throw new SymbolicAnalysisFailedException(); throw new SymbolicAnalysisFailedException();
if (blockContainer.EntryPoint.IncomingEdgeCount != 1) if (blockContainer.EntryPoint.IncomingEdgeCount != 1)
throw new SymbolicAnalysisFailedException(); throw new SymbolicAnalysisFailedException();
cachedStateVar = null;
int pos = 0; int pos = 0;
while (blockContainer.EntryPoint.Instructions[pos] is StLoc stloc) { while (blockContainer.EntryPoint.Instructions[pos] is StLoc stloc) {
// stloc V_1(ldfld <>4__this(ldloc this)) // stloc V_1(ldfld <>4__this(ldloc this))
@ -361,7 +362,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
throw new SymbolicAnalysisFailedException(); throw new SymbolicAnalysisFailedException();
if (!target.MatchLdThis()) if (!target.MatchLdThis())
throw new SymbolicAnalysisFailedException(); throw new SymbolicAnalysisFailedException();
if (field.MemberDefinition == stateField) { if (field.MemberDefinition == stateField && cachedStateVar == null) {
// stloc(cachedState, ldfld(valuetype StateMachineStruct::<>1__state, ldloc(this))) // stloc(cachedState, ldfld(valuetype StateMachineStruct::<>1__state, ldloc(this)))
cachedStateVar = stloc.Variable; cachedStateVar = stloc.Variable;
} else if (fieldToParameterMap.TryGetValue((IField)field.MemberDefinition, out var param)) { } else if (fieldToParameterMap.TryGetValue((IField)field.MemberDefinition, out var param)) {

Loading…
Cancel
Save