Allow comparing privatescope fields/methods
This commit is contained in:
parent
6cac38c4ab
commit
bbe41696b1
|
@ -519,6 +519,7 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class FieldRefKey : IFieldRefKey {
|
sealed class FieldRefKey : IFieldRefKey {
|
||||||
|
static SigComparerOptions SIG_COMPARER_FLAGS = SigComparerOptions.PrivateScopeFieldIsComparable;
|
||||||
readonly IField fieldRef;
|
readonly IField fieldRef;
|
||||||
|
|
||||||
public IField FieldRef {
|
public IField FieldRef {
|
||||||
|
@ -530,14 +531,14 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
return new SigComparer().GetHashCode(fieldRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).GetHashCode(fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj) {
|
public override bool Equals(object obj) {
|
||||||
var other = obj as FieldRefKey;
|
var other = obj as FieldRefKey;
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return false;
|
return false;
|
||||||
return new SigComparer().Equals(fieldRef, other.fieldRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).Equals(fieldRef, other.fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
@ -546,6 +547,7 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class MethodRefKey : IMethodRefKey {
|
sealed class MethodRefKey : IMethodRefKey {
|
||||||
|
static SigComparerOptions SIG_COMPARER_FLAGS = SigComparerOptions.PrivateScopeMethodIsComparable;
|
||||||
readonly IMethod methodRef;
|
readonly IMethod methodRef;
|
||||||
|
|
||||||
public IMethod MethodRef {
|
public IMethod MethodRef {
|
||||||
|
@ -557,14 +559,14 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
return new SigComparer().GetHashCode(methodRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).GetHashCode(methodRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj) {
|
public override bool Equals(object obj) {
|
||||||
var other = obj as MethodRefKey;
|
var other = obj as MethodRefKey;
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return false;
|
return false;
|
||||||
return new SigComparer().Equals(methodRef, other.methodRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).Equals(methodRef, other.methodRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
@ -573,6 +575,7 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class FieldRefAndDeclaringTypeKey : IFieldRefKey {
|
sealed class FieldRefAndDeclaringTypeKey : IFieldRefKey {
|
||||||
|
static SigComparerOptions SIG_COMPARER_FLAGS = SigComparerOptions.CompareMethodFieldDeclaringType | SigComparerOptions.PrivateScopeFieldIsComparable;
|
||||||
readonly IField fieldRef;
|
readonly IField fieldRef;
|
||||||
|
|
||||||
public IField FieldRef {
|
public IField FieldRef {
|
||||||
|
@ -584,14 +587,14 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
return new SigComparer(SigComparerOptions.CompareMethodFieldDeclaringType).GetHashCode(fieldRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).GetHashCode(fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj) {
|
public override bool Equals(object obj) {
|
||||||
var other = obj as FieldRefAndDeclaringTypeKey;
|
var other = obj as FieldRefAndDeclaringTypeKey;
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return false;
|
return false;
|
||||||
return new SigComparer(SigComparerOptions.CompareMethodFieldDeclaringType).Equals(fieldRef, other.fieldRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).Equals(fieldRef, other.fieldRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
@ -600,6 +603,7 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class MethodRefAndDeclaringTypeKey : IMethodRefKey {
|
sealed class MethodRefAndDeclaringTypeKey : IMethodRefKey {
|
||||||
|
static SigComparerOptions SIG_COMPARER_FLAGS = SigComparerOptions.CompareMethodFieldDeclaringType | SigComparerOptions.PrivateScopeMethodIsComparable;
|
||||||
readonly IMethod methodRef;
|
readonly IMethod methodRef;
|
||||||
|
|
||||||
public IMethod MethodRef {
|
public IMethod MethodRef {
|
||||||
|
@ -611,14 +615,14 @@ namespace de4dot.blocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
return new SigComparer(SigComparerOptions.CompareMethodFieldDeclaringType).GetHashCode(methodRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).GetHashCode(methodRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj) {
|
public override bool Equals(object obj) {
|
||||||
var other = obj as MethodRefAndDeclaringTypeKey;
|
var other = obj as MethodRefAndDeclaringTypeKey;
|
||||||
if (other == null)
|
if (other == null)
|
||||||
return false;
|
return false;
|
||||||
return new SigComparer(SigComparerOptions.CompareMethodFieldDeclaringType).Equals(methodRef, other.methodRef);
|
return new SigComparer(SIG_COMPARER_FLAGS).Equals(methodRef, other.methodRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user