-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from brandhuf/fix-generics
Fix dependencies to generics and compiler generated types
- Loading branch information
Showing
99 changed files
with
3,624 additions
and
1,463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2019 Florian Gather <[email protected]> | ||
// Copyright 2019 Fritz Brandhuber <[email protected]> | ||
// Copyright 2020 Pavel Fischer <[email protected]> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace ArchUnitNET.Domain.Dependencies | ||
{ | ||
public class AccessFieldDependency : IMemberMemberDependency | ||
{ | ||
// ReSharper disable once SuggestBaseTypeForParameter | ||
public AccessFieldDependency(IMember originMember, FieldMember accessedField) | ||
{ | ||
OriginMember = originMember; | ||
TargetMember = accessedField; | ||
} | ||
|
||
public IMember OriginMember { get; } | ||
public IMember TargetMember { get; } | ||
|
||
public IEnumerable<GenericArgument> TargetGenericArguments => Enumerable.Empty<GenericArgument>(); | ||
public IEnumerable<GenericArgument> TargetMemberGenericArguments => Enumerable.Empty<GenericArgument>(); | ||
|
||
public IType Origin => OriginMember.DeclaringType; | ||
public IType Target => TargetMember.DeclaringType; | ||
|
||
public bool TargetIsArray => false; | ||
public IEnumerable<int> TargetArrayDimensions => Enumerable.Empty<int>(); | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (ReferenceEquals(this, obj)) | ||
{ | ||
return true; | ||
} | ||
|
||
return obj.GetType() == GetType() && Equals((AccessFieldDependency) obj); | ||
} | ||
|
||
private bool Equals(IMemberMemberDependency other) | ||
{ | ||
return Equals(TargetMember, other.TargetMember) && Equals(OriginMember, other.OriginMember); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return ((TargetMember != null ? TargetMember.GetHashCode() : 0) * 397) ^ | ||
(OriginMember != null ? OriginMember.GetHashCode() : 0); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2019 Florian Gather <[email protected]> | ||
// Copyright 2019 Fritz Brandhuber <[email protected]> | ||
// Copyright 2020 Pavel Fischer <[email protected]> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
namespace ArchUnitNET.Domain.Dependencies | ||
{ | ||
public class CastTypeDependency : MemberTypeInstanceDependency | ||
{ | ||
public CastTypeDependency(IMember originMember, ITypeInstance<IType> castTypeInstance) | ||
: base(originMember, castTypeInstance) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.