diff options
author | Siegfried Pammer <siegfriedpammer@gmail.com> | 2016-06-18 03:55:38 +0300 |
---|---|---|
committer | Siegfried Pammer <siegfriedpammer@gmail.com> | 2016-06-18 03:55:38 +0300 |
commit | 43306b8912c6806f3c19d8a288ddeeaca07df5d2 (patch) | |
tree | a07a0c5ae1c754df090f75bb72fd356a1f04f8fb | |
parent | 2d6d964fcdd8854451779f994bf3271d2896d6be (diff) |
fix bug in CecilLoader introduced by ShortenInterfaceImplNames
-rw-r--r-- | ICSharpCode.NRefactory.Cecil/CecilLoader.cs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/ICSharpCode.NRefactory.Cecil/CecilLoader.cs b/ICSharpCode.NRefactory.Cecil/CecilLoader.cs index 402c4c79..4abc463b 100644 --- a/ICSharpCode.NRefactory.Cecil/CecilLoader.cs +++ b/ICSharpCode.NRefactory.Cecil/CecilLoader.cs @@ -1383,18 +1383,17 @@ namespace ICSharpCode.NRefactory.TypeSystem m.IsExtensionMethod = true; } - if (ShortenInterfaceImplNames) { - int lastDot = method.Name.LastIndexOf('.'); - if (lastDot >= 0 && method.HasOverrides) { - // To be consistent with the parser-initialized type system, shorten the method name: + int lastDot = method.Name.LastIndexOf('.'); + if (lastDot >= 0 && method.HasOverrides) { + // To be consistent with the parser-initialized type system, shorten the method name: + if (ShortenInterfaceImplNames) m.Name = method.Name.Substring(lastDot + 1); - m.IsExplicitInterfaceImplementation = true; - foreach (var or in method.Overrides) { - m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference( - accessorOwner != null ? SymbolKind.Accessor : SymbolKind.Method, - ReadTypeReference(or.DeclaringType), - or.Name, or.GenericParameters.Count, m.Parameters.Select(p => p.Type).ToList())); - } + m.IsExplicitInterfaceImplementation = true; + foreach (var or in method.Overrides) { + m.ExplicitInterfaceImplementations.Add(new DefaultMemberReference( + accessorOwner != null ? SymbolKind.Accessor : SymbolKind.Method, + ReadTypeReference(or.DeclaringType), + or.Name, or.GenericParameters.Count, m.Parameters.Select(p => p.Type).ToList())); } } @@ -1678,7 +1677,8 @@ namespace ICSharpCode.NRefactory.TypeSystem var accessor = p.Getter ?? p.Setter; if (accessor != null && accessor.IsExplicitInterfaceImplementation) { - p.Name = property.Name.Substring(property.Name.LastIndexOf('.') + 1); + if (ShortenInterfaceImplNames) + p.Name = property.Name.Substring(property.Name.LastIndexOf('.') + 1); p.IsExplicitInterfaceImplementation = true; foreach (var mr in accessor.ExplicitInterfaceImplementations) { p.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); @@ -1711,7 +1711,8 @@ namespace ICSharpCode.NRefactory.TypeSystem var accessor = e.AddAccessor ?? e.RemoveAccessor ?? e.InvokeAccessor; if (accessor != null && accessor.IsExplicitInterfaceImplementation) { - e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1); + if (ShortenInterfaceImplNames) + e.Name = ev.Name.Substring(ev.Name.LastIndexOf('.') + 1); e.IsExplicitInterfaceImplementation = true; foreach (var mr in accessor.ExplicitInterfaceImplementations) { e.ExplicitInterfaceImplementations.Add(new AccessorOwnerMemberReference(mr)); |