Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotheus Pokorra <timotheus.pokorra@solidcharity.com>2019-08-09 06:54:40 +0300
committerMarek Safar <marek.safar@gmail.com>2019-08-12 23:06:21 +0300
commit8baeffc63eaba63a864d4868c230585ac34fb834 (patch)
tree607d68fdced27c565bc713624bd536cfb591b4c1
parentd90bb64110d3418463205047098c27351ff53d3a (diff)
Cecil 0.10: TypeDefinition and InterfaceImplementation
see https://cecil.pe/post/149243207656/mono-cecil-010-beta-1
-rw-r--r--gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs10
-rw-r--r--gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs4
-rw-r--r--gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs4
-rw-r--r--gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs6
-rw-r--r--gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs4
-rw-r--r--gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs10
-rw-r--r--gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs6
-rw-r--r--gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs4
-rw-r--r--gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs4
-rw-r--r--gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs4
-rw-r--r--gui-compare/CecilMetadata.cs4
11 files changed, 30 insertions, 30 deletions
diff --git a/gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs b/gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs
index efdcc0f0..d8de07ff 100644
--- a/gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs
+++ b/gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs
@@ -73,8 +73,8 @@ namespace Gendarme.Framework.Rocks {
if (type != null) {
yield return type;
- foreach (TypeReference super in type.Interfaces) {
- types.AddIfNew (super);
+ foreach (InterfaceImplementation super in type.Interfaces) {
+ types.AddIfNew (super.InterfaceType);
}
if (type.BaseType != null)
@@ -268,11 +268,11 @@ namespace Gendarme.Framework.Rocks {
while (type != null) {
// does the type implements it itself
if (type.HasInterfaces) {
- foreach (TypeReference iface in type.Interfaces) {
- if (iface.IsNamed (nameSpace, iname))
+ foreach (InterfaceImplementation iface in type.Interfaces) {
+ if (iface.InterfaceType.IsNamed (nameSpace, iname))
return true;
//if not, then maybe one of its parent interfaces does
- if (Implements (iface.Resolve (), nameSpace, iname))
+ if (Implements (iface.InterfaceType.Resolve (), nameSpace, iname))
return true;
}
}
diff --git a/gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs b/gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs
index b8828e90..5e08ab29 100644
--- a/gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs
@@ -96,8 +96,8 @@ namespace Gendarme.Rules.Design {
if (td == null)
return false;
- foreach (TypeReference intf_ref in td.Interfaces) {
- TypeDefinition intr = intf_ref.Resolve ();
+ foreach (InterfaceImplementation intf_ref in td.Interfaces) {
+ TypeDefinition intr = intf_ref.InterfaceType.Resolve ();
if (intr == null)
continue;
diff --git a/gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs b/gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs
index ddcb92aa..5d2a1598 100644
--- a/gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs
@@ -190,8 +190,8 @@ namespace Gendarme.Rules.Design {
}
if (iface.HasInterfaces) {
- foreach (TypeReference tr in iface.Interfaces) {
- TypeDefinition td = tr.Resolve ();
+ foreach (InterfaceImplementation tr in iface.Interfaces) {
+ TypeDefinition td = tr.InterfaceType.Resolve ();
if (td == null)
continue;
if (!DoesTypeStealthilyImplementInterface (type, td))
diff --git a/gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs b/gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs
index 11c45aa8..abb790c3 100644
--- a/gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs
@@ -109,11 +109,11 @@ namespace Gendarme.Rules.Design {
// rule only applies if the type implements IComparable or IComparable<T>
// Note: we do not use Implements rock because we do not want a recursive answer
bool icomparable = false;
- foreach (TypeReference iface in type.Interfaces) {
- if (iface.Namespace != "System")
+ foreach (InterfaceImplementation iface in type.Interfaces) {
+ if (iface.InterfaceType.Namespace != "System")
continue;
// catch both System.IComparable and System.IComparable`1<X>
- if (iface.Name.StartsWith ("IComparable", StringComparison.Ordinal)) {
+ if (iface.InterfaceType.Name.StartsWith ("IComparable", StringComparison.Ordinal)) {
icomparable = true;
break;
}
diff --git a/gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs b/gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs
index 697c61b6..f6e231bf 100644
--- a/gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs
@@ -235,8 +235,8 @@ namespace Gendarme.Rules.Design {
static bool DirectlyImplementsIDisposable (TypeDefinition type)
{
if (type.HasInterfaces) {
- foreach (TypeReference candidate in type.Interfaces) {
- if (candidate.IsNamed ("System", "IDisposable"))
+ foreach (InterfaceImplementation candidate in type.Interfaces) {
+ if (candidate.InterfaceType.IsNamed ("System", "IDisposable"))
return true;
}
}
diff --git a/gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs b/gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs
index a906ebd5..19bbdfa2 100644
--- a/gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs
@@ -159,12 +159,12 @@ namespace Gendarme.Rules.Maintainability {
{
TypeDefinition ifaceDef = null;
- foreach (TypeReference iface in type.Interfaces) {
+ foreach (InterfaceImplementation iface in type.Interfaces) {
// ignore non-cls-compliant interfaces
- if (iface.Name.StartsWith ("_", StringComparison.Ordinal))
+ if (iface.InterfaceType.Name.StartsWith ("_", StringComparison.Ordinal))
continue;
- TypeDefinition candidate = iface.Resolve ();
+ TypeDefinition candidate = iface.InterfaceType.Resolve ();
if ((candidate == null) || !candidate.IsVisible ())
continue;
@@ -428,8 +428,8 @@ namespace Gendarme.Rules.Maintainability {
static bool IsSignatureDictatedByInterface (IMemberDefinition method, MethodSignature sig)
{
- foreach (TypeReference intf_ref in method.DeclaringType.Interfaces) {
- TypeDefinition intr = intf_ref.Resolve ();
+ foreach (InterfaceImplementation intf_ref in method.DeclaringType.Interfaces) {
+ TypeDefinition intr = intf_ref.InterfaceType.Resolve ();
if (intr == null)
continue;
foreach (MethodDefinition md in intr.Methods) {
diff --git a/gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs b/gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs
index 31868ea2..43b49ec9 100644
--- a/gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs
@@ -159,9 +159,9 @@ namespace Gendarme.Rules.Maintainability {
void CheckInterfaces (TypeDefinition type)
{
- foreach (TypeReference intf in type.Interfaces) {
- if (IsObsolete (intf)) {
- string msg = String.Format (CultureInfo.InvariantCulture, "Implement obsolete interface '{0}'.", intf);
+ foreach (InterfaceImplementation intf in type.Interfaces) {
+ if (IsObsolete (intf.InterfaceType)) {
+ string msg = String.Format (CultureInfo.InvariantCulture, "Implement obsolete interface '{0}'.", intf.InterfaceType);
Runner.Report (type, type.IsVisible () ? Severity.Medium : Severity.Low, Confidence.Total, msg);
}
}
diff --git a/gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs b/gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs
index 7e4a8db7..f9c1a0b3 100644
--- a/gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs
@@ -148,8 +148,8 @@ namespace Gendarme.Rules.Naming {
if (!type.HasInterfaces)
return null;
- foreach (TypeReference interfaceReference in type.Interfaces) {
- TypeDefinition interfaceCandidate = interfaceReference.Resolve ();
+ foreach (InterfaceImplementation interfaceReference in type.Interfaces) {
+ TypeDefinition interfaceCandidate = interfaceReference.InterfaceType.Resolve ();
if ((interfaceCandidate == null) || !interfaceCandidate.HasMethods)
continue;
diff --git a/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs b/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs
index 671d8428..425cbe28 100644
--- a/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs
@@ -210,8 +210,8 @@ namespace Gendarme.Rules.Naming {
currentTypeSuffix = true;
} else {
// if no suffix for base type is found, we start looking through interfaces
- foreach (TypeReference iface in current.Interfaces) {
- if (TryGetCandidates (iface, out candidates)) {
+ foreach (InterfaceImplementation iface in current.Interfaces) {
+ if (TryGetCandidates (iface.InterfaceType, out candidates)) {
suffixes.AddRangeIfNew (candidates);
if (current == type)
currentTypeSuffix = true;
diff --git a/gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs b/gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs
index 37d0478a..24223fb6 100644
--- a/gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs
@@ -233,8 +233,8 @@ namespace Gendarme.Rules.Performance {
// check if this method is needed to satisfy an interface
TypeDefinition type = (method.DeclaringType as TypeDefinition);
if (type.HasInterfaces) {
- foreach (TypeReference tr in type.Interfaces) {
- TypeDefinition intf = tr.Resolve ();
+ foreach (InterfaceImplementation tr in type.Interfaces) {
+ TypeDefinition intf = tr.InterfaceType.Resolve ();
if (intf != null) {
foreach (MethodReference member in intf.Methods) {
if (name == member.Name)
diff --git a/gui-compare/CecilMetadata.cs b/gui-compare/CecilMetadata.cs
index df43b5e0..39590442 100644
--- a/gui-compare/CecilMetadata.cs
+++ b/gui-compare/CecilMetadata.cs
@@ -239,8 +239,8 @@ namespace GuiCompare {
var cache = new Dictionary<string, TypeReference> ();
foreach (var definition in WalkHierarchy (type))
- foreach (TypeReference iface in definition.Interfaces)
- cache [iface.FullName] = iface;
+ foreach (InterfaceImplementation iface in definition.Interfaces)
+ cache [iface.InterfaceType.FullName] = iface.InterfaceType;
return cache.Values;
}