Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Sep 28, 2023
1 parent 8cf969e commit a7c4eed
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions PropertyChanged.Fody/IsChangedMethodFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ bool FindIsChangedEventInvokerMethodDefinition(TypeDefinition type, out MethodDe
var propertyDefinition = type.Properties
.FirstOrDefault(x =>
x.Name == isChangedPropertyName &&
x.SetMethod != null &&
x.SetMethod.IsPublic
x.SetMethod is {IsPublic: true}
);

if (propertyDefinition != null)
Expand Down
7 changes: 2 additions & 5 deletions PropertyChanged.Fody/MethodFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ MethodDefinition FindEventInvokerMethodDefinition(TypeDefinition type)
.OrderByDescending(GetInvokerPriority)
.FirstOrDefault(IsEventInvokerMethod);

if (methodDefinition != null &&
methodDefinition.IsPrivate &&
methodDefinition.IsFinal &&
methodDefinition.IsVirtual &&
if (methodDefinition is {IsPrivate: true, IsFinal: true, IsVirtual: true} &&
methodDefinition.Overrides.Count == 1)
{
// Explicitly implemented interfaces should call the interface method instead
Expand All @@ -148,7 +145,7 @@ MethodReference FindExplicitImplementation(TypeDefinition type)
{
return type.GetAllInterfaces()
.Select(i => i.Resolve())
.Where(i => i != null && i.IsPublic)
.Where(i => i is {IsPublic: true})
.SelectMany(i => i.Methods.Where(m => EventInvokerNames.Contains($"{i.FullName}.{m.Name}")))
.OrderByDescending(GetInvokerPriority)
.FirstOrDefault(IsEventInvokerMethod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public bool IsFlag
set => _isFlag = value;
}

// ReSharper disable once MemberCanBeMadeStatic.Local
bool GetFlag() => false;

public event PropertyChangedEventHandler PropertyChanged;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ComplexHierarchy;

public class ClassChild3 : ClassChild2
public class ClassChild3 : ClassChild2
{
public string Property2 { get; set; }
}
1 change: 1 addition & 0 deletions TestAssemblies/AssemblyWithInheritance/Classes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public override int Property2

public override int Property3 { get; set; }

// ReSharper disable once MemberCanBeMadeStatic.Local
int DoSomeDummyStuff(int a, int b, int c)
{
return a + b + c;
Expand Down
1 change: 1 addition & 0 deletions Tests/AlreadyNotifyFinderTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Xunit;
// ReSharper disable MemberCanBeMadeStatic.Local

// ReSharper disable ValueParameterNotUsed
// ReSharper disable UnusedParameter.Local
Expand Down
1 change: 1 addition & 0 deletions Tests/RecursiveIlFinderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void Method2()
Method1();
}

// ReSharper disable once MemberCanBeMadeStatic.Local
void Method3()
{
Debug.WriteLine("a");
Expand Down

0 comments on commit a7c4eed

Please sign in to comment.