|
|
|
@ -19,6 +19,7 @@
@@ -19,6 +19,7 @@
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.Decompiler.CSharp; |
|
|
|
|
using ICSharpCode.Decompiler.CSharp.OutputVisitor; |
|
|
|
|
using ICSharpCode.Decompiler.CSharp.Resolver; |
|
|
|
@ -26,6 +27,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax;
@@ -26,6 +27,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax;
|
|
|
|
|
using ICSharpCode.Decompiler.IL; |
|
|
|
|
using ICSharpCode.Decompiler.Semantics; |
|
|
|
|
using ICSharpCode.Decompiler.TypeSystem; |
|
|
|
|
using ICSharpCode.Decompiler.TypeSystem.Implementation; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.Decompiler |
|
|
|
|
{ |
|
|
|
@ -110,6 +112,7 @@ namespace ICSharpCode.Decompiler
@@ -110,6 +112,7 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
if (symbol != null && node.Role == Roles.Type && node.Parent is ObjectCreateExpression) { |
|
|
|
|
symbol = node.Parent.GetSymbol(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (node is IdentifierExpression && node.Role == Roles.TargetExpression && node.Parent is InvocationExpression && symbol is IMember member) { |
|
|
|
|
var declaringType = member.DeclaringType; |
|
|
|
|
if (declaringType != null && declaringType.Kind == TypeKind.Delegate) |
|
|
|
@ -123,10 +126,8 @@ namespace ICSharpCode.Decompiler
@@ -123,10 +126,8 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
if (symbol == null) |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
//if (settings.AutomaticEvents && member is FieldDefinition) {
|
|
|
|
|
// var field = (FieldDefinition)member;
|
|
|
|
|
// return field.DeclaringType.Events.FirstOrDefault(ev => ev.Name == field.Name) ?? member;
|
|
|
|
|
//}
|
|
|
|
|
if (symbol is LocalFunctionMethod) |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
return symbol; |
|
|
|
|
} |
|
|
|
@ -142,14 +143,18 @@ namespace ICSharpCode.Decompiler
@@ -142,14 +143,18 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
if (letClauseVariable != null) |
|
|
|
|
return letClauseVariable; |
|
|
|
|
|
|
|
|
|
var gotoStatement = node as GotoStatement; |
|
|
|
|
if (gotoStatement != null) |
|
|
|
|
{ |
|
|
|
|
if (node is GotoStatement gotoStatement) { |
|
|
|
|
var method = nodeStack.Select(nd => nd.GetSymbol() as IMethod).FirstOrDefault(mr => mr != null); |
|
|
|
|
if (method != null) |
|
|
|
|
return method + gotoStatement.Label; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (node.Role == Roles.TargetExpression && node.Parent is InvocationExpression) { |
|
|
|
|
var symbol = node.Parent.GetSymbol(); |
|
|
|
|
if (symbol is LocalFunctionMethod) |
|
|
|
|
return symbol; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -177,8 +182,8 @@ namespace ICSharpCode.Decompiler
@@ -177,8 +182,8 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
return method + label.Label; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (node is LocalFunctionDeclarationStatement) { |
|
|
|
|
var localFunction = node.GetResolveResult() as MemberResolveResult; |
|
|
|
|
if (node is MethodDeclaration && node.Parent is LocalFunctionDeclarationStatement) { |
|
|
|
|
var localFunction = node.Parent.GetResolveResult() as MemberResolveResult; |
|
|
|
|
if (localFunction != null) |
|
|
|
|
return localFunction.Member; |
|
|
|
|
} |
|
|
|
@ -404,7 +409,7 @@ namespace ICSharpCode.Decompiler
@@ -404,7 +409,7 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
|
|
|
|
|
public static bool IsDefinition(ref AstNode node) |
|
|
|
|
{ |
|
|
|
|
if (node is EntityDeclaration) |
|
|
|
|
if (node is EntityDeclaration && !(node.Parent is LocalFunctionDeclarationStatement)) |
|
|
|
|
return true; |
|
|
|
|
if (node is VariableInitializer && node.Parent is FieldDeclaration) { |
|
|
|
|
node = node.Parent; |
|
|
|
|