|
|
@ -20,6 +20,7 @@ namespace Decompiler |
|
|
|
|
|
|
|
|
|
|
|
ByteCodeCollection body = new ByteCodeCollection(methodDef); |
|
|
|
ByteCodeCollection body = new ByteCodeCollection(methodDef); |
|
|
|
StackExpressionCollection exprCol = new StackExpressionCollection(body); |
|
|
|
StackExpressionCollection exprCol = new StackExpressionCollection(body); |
|
|
|
|
|
|
|
exprCol.Optimize(); |
|
|
|
|
|
|
|
|
|
|
|
foreach(VariableDefinition varDef in methodDef.Body.Variables) { |
|
|
|
foreach(VariableDefinition varDef in methodDef.Body.Variables) { |
|
|
|
Ast.VariableDeclaration astVar = new Ast.VariableDeclaration(varDef.Name); |
|
|
|
Ast.VariableDeclaration astVar = new Ast.VariableDeclaration(varDef.Name); |
|
|
@ -73,11 +74,11 @@ namespace Decompiler |
|
|
|
List<Ast.Expression> allArgs = new List<Ast.Expression>(); |
|
|
|
List<Ast.Expression> allArgs = new List<Ast.Expression>(); |
|
|
|
// Add args from stack
|
|
|
|
// Add args from stack
|
|
|
|
allArgs.AddRange(args); |
|
|
|
allArgs.AddRange(args); |
|
|
|
// Args generated by nested expressions
|
|
|
|
// Args generated by nested expressions (which must be closed)
|
|
|
|
foreach(StackExpression nestedExpr in expr.LastArguments) { |
|
|
|
foreach(StackExpression nestedExpr in expr.LastArguments) { |
|
|
|
allArgs.Add(new Ast.ParenthesizedExpression((Ast.Expression)MakeCodeDomExpression(methodDef, nestedExpr))); |
|
|
|
allArgs.Add(new Ast.ParenthesizedExpression((Ast.Expression)MakeCodeDomExpression(methodDef, nestedExpr))); |
|
|
|
} |
|
|
|
} |
|
|
|
return MakeCodeDomExpression(methodDef, expr.ExpressionByteCode, args); |
|
|
|
return MakeCodeDomExpression(methodDef, expr.ExpressionByteCode, allArgs.ToArray()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static object MakeCodeDomExpression(MethodDefinition methodDef, ByteCode byteCode, params Ast.Expression[] args) |
|
|
|
static object MakeCodeDomExpression(MethodDefinition methodDef, ByteCode byteCode, params Ast.Expression[] args) |
|
|
|