Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for when the conditionals follow is itself and the else path was …

…a return/break/throw
  • Loading branch information...
commit a43849edc20374b27f8c00a391c5005380035521 1 parent 2bb3289
@flaub authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/DotWeb.Decompiler/Core/StatementsGenerator.cs
View
15 src/DotWeb.Decompiler/Core/StatementsGenerator.cs
@@ -269,10 +269,14 @@ class Context
if (succ.DfsTraversed != DfsTraversal.Alpha) {
if (succ != conditional.Follow) {
// ELSE part
- var output = ifStmt.FalseStatements;
+ List<CodeStatement> output;
if (isBreak)
output = stmts;
- WriteCode(block, (BasicBlock)succ, output, context.NewUntil(conditional.Follow));
+ else
+ output = ifStmt.FalseStatements;
+ isBreak = WriteCode(block, (BasicBlock)succ, output, context.NewUntil(conditional.Follow));
+ if (block == conditional.Follow)
+ return isBreak;
}
}
else if (!emptyThen) {
@@ -401,13 +405,10 @@ class Context
private bool WriteBasicBlock(BasicBlock block, List<CodeStatement> stmts) {
foreach (var stmt in block.Statements) {
- if (stmt is CodeGotoStatement)
- continue;
-
AddStatement(stmts, stmt);
}
- if (block.FlowControl == FlowControl.Return ||
+ if (block.FlowControl == FlowControl.Return ||
block.FlowControl == FlowControl.Throw) {
var lastReturn = stmts.LastOrDefault() as CodeReturnStatement;
@@ -425,8 +426,10 @@ class Context
}
}
}
+
return true;
}
+
return false;
}

0 comments on commit a43849e

Please sign in to comment.
Something went wrong with that request. Please try again.