Prevent merge if it's 'this'

This commit is contained in:
de4dot 2014-04-16 19:15:11 +02:00
parent c3eacf9000
commit 82896a018f
3 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,8 @@ namespace de4dot.code.renamer {
}
public void Merge(ExistingNames other) {
if (this == other)
return;
foreach (var key in other.allNames.Keys)
allNames[key] = true;
}

View File

@ -113,6 +113,8 @@ namespace de4dot.code.renamer {
protected abstract string FixName(string prefix, string name);
public virtual TypeNames Merge(TypeNames other) {
if (this == other)
return this;
foreach (var pair in other.typeNames) {
NameCreator nc;
if (typeNames.TryGetValue(pair.Key, out nc))

View File

@ -61,6 +61,8 @@ namespace de4dot.code.renamer {
}
public VariableNameState Merge(VariableNameState other) {
if (this == other)
return this;
existingVariableNames.Merge(other.existingVariableNames);
existingMethodNames.Merge(other.existingMethodNames);
existingPropertyNames.Merge(other.existingPropertyNames);