public void EqualityNestedTest() { var instructions = GetInstructions("EqualityNested"); var field = GetField("intField"); Assert.IsTrue(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
public void EqualsNestedInverseTest() { var instructions = GetInstructions("EqualsNestedInverse"); var field = GetField("stringField"); Assert.IsTrue(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
public void NoEqualityTest() { var instructions = GetInstructions("NoEquality"); var field = GetField("stringField"); Assert.IsFalse(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
public void NoEqualsNoFieldTest() { var instructions = GetInstructions("NoEqualsNoField"); var field = GetField("intField"); Assert.IsFalse(HasEqualityChecker.AlreadyHasEquality(instructions, null)); }
public void StringEqualsOrdinalTest() { var instructions = GetInstructions("StringEqualsOrdinal"); var field = GetField("stringField"); Assert.IsTrue(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
public void EqualsShortCutTest() { var instructions = GetInstructions("EqualsShortCut"); var field = GetField("stringField"); Assert.True(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
public void EqualityShortCutInverseTest() { var instructions = GetInstructions("EqualityShortCutInverse"); var field = GetField("intField"); Assert.True(HasEqualityChecker.AlreadyHasEquality(instructions, field)); }
void ProcessTypes(List <TypeNode> notifyNodes) { foreach (var node in notifyNodes) { if (node.EventInvoker == null) { continue; } LogInfo("\t" + node.TypeDefinition.FullName); foreach (var propertyData in node.PropertyDatas) { var body = propertyData.PropertyDefinition.SetMethod.Body; var alreadyHasEquality = HasEqualityChecker.AlreadyHasEquality(propertyData.PropertyDefinition, propertyData.BackingFieldReference); body.SimplifyMacros(); body.MakeLastStatementReturn(); var propertyWeaver = new PropertyWeaver(this, propertyData, node, ModuleDefinition.TypeSystem); propertyWeaver.Execute(); if (!alreadyHasEquality) { var equalityCheckWeaver = new EqualityCheckWeaver(propertyData, this); equalityCheckWeaver.Execute(); } body.InitLocals = true; body.OptimizeMacros(); } ProcessTypes(node.Nodes); } }
public void EqualsNoFieldTest() { var instructions = GetInstructions("EqualsNoField"); Assert.True(HasEqualityChecker.AlreadyHasEquality(instructions, null)); }