Browse Source

Rename ITypeDefinition.HasExtensionMethods to ITypeDefinition.HasExtensions

pull/3530/head
Siegfried Pammer 11 months ago
parent
commit
68ae8ae833
  1. 2
      ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
  3. 6
      ICSharpCode.Decompiler/TypeSystem/ITypeDefinition.cs
  4. 4
      ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs
  5. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
  6. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs

2
ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs

@ -1496,7 +1496,7 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem @@ -1496,7 +1496,7 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem
Assert.That(method.IsExtensionMethod);
Assert.That(method.ReducedFrom, Is.Null);
Assert.That(type.HasExtensionMethods);
Assert.That(type.HasExtensions);
}
[Test]

2
ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs

@ -2215,7 +2215,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver @@ -2215,7 +2215,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
// TODO: maybe make this a property on INamespace?
return
from c in ns.Types
where c.IsStatic && c.HasExtensionMethods && c.TypeParameters.Count == 0 && lookup.IsAccessible(c, false)
where c.IsStatic && c.HasExtensions && c.TypeParameters.Count == 0 && lookup.IsAccessible(c, false)
from m in c.Methods
where m.IsExtensionMethod
select m;

6
ICSharpCode.Decompiler/TypeSystem/ITypeDefinition.cs

@ -71,10 +71,10 @@ namespace ICSharpCode.Decompiler.TypeSystem @@ -71,10 +71,10 @@ namespace ICSharpCode.Decompiler.TypeSystem
new IType? DeclaringType { get; } // solves ambiguity between IType.DeclaringType and IEntity.DeclaringType
/// <summary>
/// Gets whether this type contains extension methods.
/// Gets whether this type contains extension methods or C# 14 extensions.
/// </summary>
/// <remarks>This property is used to speed up the search for extension methods.</remarks>
bool HasExtensionMethods { get; }
/// <remarks>This property is used to speed up the search for extension members.</remarks>
bool HasExtensions { get; }
/// <summary>
/// The nullability specified in the [NullableContext] attribute on the type.

4
ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs

@ -48,7 +48,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -48,7 +48,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public IReadOnlyList<ITypeParameter> TypeParameters { get; }
public KnownTypeCode KnownTypeCode { get; }
public IType EnumUnderlyingType { get; }
public bool HasExtensionMethods { get; }
public bool HasExtensions { get; }
public Nullability NullableContext { get; }
// lazy-loaded:
@ -132,7 +132,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -132,7 +132,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
else
{
this.Kind = TypeKind.Class;
this.HasExtensionMethods = this.IsStatic
this.HasExtensions = this.IsStatic
&& (module.TypeSystemOptions & TypeSystemOptions.ExtensionMethods) == TypeSystemOptions.ExtensionMethods
&& td.GetCustomAttributes().HasKnownAttribute(metadata, KnownAttribute.Extension);
}

2
ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs

@ -173,7 +173,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -173,7 +173,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
IType IType.DeclaringType => null;
IType IEntity.DeclaringType => null;
bool ITypeDefinition.HasExtensionMethods => false;
bool ITypeDefinition.HasExtensions => false;
bool ITypeDefinition.IsReadOnly => false;
TypeKind IType.Kind => typeKind;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs

@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin @@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
IEnumerable<IEntity> ScanType(ITypeDefinition analyzedType, ITypeDefinition type, AnalyzerContext context)
{
if (!type.HasExtensionMethods)
if (!type.HasExtensions)
yield break;
if (analyzedType.ParentModule?.MetadataFile == null)

Loading…
Cancel
Save