|
|
|
@ -195,7 +195,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
@@ -195,7 +195,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
|
|
|
|
|
replacement = ame; |
|
|
|
|
} |
|
|
|
|
var expectedType = objectCreateExpression.Annotation<TypeInformation>().ExpectedType.Resolve(); |
|
|
|
|
if (expectedType != null && !IsDelegate(expectedType)) { |
|
|
|
|
if (expectedType != null && !expectedType.IsDelegate()) { |
|
|
|
|
var simplifiedDelegateCreation = (ObjectCreateExpression)objectCreateExpression.Clone(); |
|
|
|
|
simplifiedDelegateCreation.Arguments.Clear(); |
|
|
|
|
simplifiedDelegateCreation.Arguments.Add(replacement); |
|
|
|
@ -204,17 +204,6 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
@@ -204,17 +204,6 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
|
|
|
|
|
objectCreateExpression.ReplaceWith(replacement); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsDelegate(TypeDefinition type) |
|
|
|
|
{ |
|
|
|
|
if (type.BaseType != null && type.BaseType.Namespace == "System") { |
|
|
|
|
if (type.BaseType.Name == "MulticastDelegate") |
|
|
|
|
return true; |
|
|
|
|
if (type.BaseType.Name == "Delegate" && type.Name != "MulticastDelegate") |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
internal static bool IsPotentialClosure(DecompilerContext context, TypeDefinition potentialDisplayClass) |
|
|
|
|
{ |
|
|
|
|