Browse Source

Do not wrap local functions in checked blocks.

pull/1612/head
Siegfried Pammer 6 years ago
parent
commit
91af32ef94
  1. 6
      ICSharpCode.Decompiler/CSharp/Transforms/AddCheckedBlocks.cs

6
ICSharpCode.Decompiler/CSharp/Transforms/AddCheckedBlocks.cs

@ -296,9 +296,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -296,9 +296,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
costUncheckedContextCheckedBlockOpen += stmtResult.CostInCheckedContext;
nodesUncheckedContextCheckedBlockOpen += stmtResult.NodesToInsertInCheckedContext;
if (statement is LabelStatement) {
if (statement is LabelStatement || statement is LocalFunctionDeclarationStatement) {
// We can't move labels into blocks because that might cause goto-statements
// to be unable to just to the labels.
// to be unable to jump to the labels.
// Also, we can't move local functions into blocks, because that might cause
// them to become out of scope from the call-sites.
costCheckedContextUncheckedBlockOpen = Cost.Infinite;
costUncheckedContextCheckedBlockOpen = Cost.Infinite;
}

Loading…
Cancel
Save