Skip to content

Commit

Permalink
Fix #2053: Assert and NRE in LocalFunctionDecompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Jun 30, 2020
1 parent 6d70978 commit 74101ff
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ private void ReplaceReferencesToDisplayClassThis(Dictionary<MethodDefinitionHand
if (thisVar == null)
continue;
var compatibleArgument = FindCompatibleArgument(info, info.UseSites.SelectArray(u => u.Arguments[0]), ignoreStructure: true);
Debug.Assert(compatibleArgument != null);
if (compatibleArgument == null)
continue;
context.Step($"Replace 'this' with {compatibleArgument}", localFunction);
localFunction.AcceptVisitor(new DelegateConstruction.ReplaceDelegateTargetVisitor(compatibleArgument, thisVar));
DetermineCaptureAndDeclarationScope(info, -1, compatibleArgument);
Expand Down Expand Up @@ -208,7 +209,8 @@ private void PropagateClosureParameterArguments(Dictionary<MethodDefinitionHandl
if (targetVariable == null)
continue;
var compatibleArgument = FindCompatibleArgument(info, arguments);
Debug.Assert(compatibleArgument != null);
if (compatibleArgument == null)
continue;
context.Step($"Replace '{targetVariable}' with '{compatibleArgument}'", info.Definition);
info.Definition.AcceptVisitor(new DelegateConstruction.ReplaceDelegateTargetVisitor(compatibleArgument, targetVariable));
}
Expand Down

0 comments on commit 74101ff

Please sign in to comment.