public EquatableWeaver(ModuleWeaver moduleWeaver) { _logger = moduleWeaver; _typeSystem = moduleWeaver.TypeSystem; _moduleDefinition = moduleWeaver.ModuleDefinition; _systemReferences = moduleWeaver.SystemReferences; var hashCodeMethod = InjectStaticHashCodeClass(_moduleDefinition); _aggregateHashCodeMethod = InjectAggregateMethod(hashCodeMethod); _getHashCode = InjectGetHashCodeMethod(hashCodeMethod, _systemReferences); _getStringHashCode = InjectGetStringHashCodeMethod(hashCodeMethod, _systemReferences); }
public CaseClassBuilder( TypeDefinition caseClassesFactory, ModuleDefinition moduleDefinition, global::Fody.TypeSystem typeSystem, Func <string, TypeDefinition> findType) { _factoryType = caseClassesFactory; _moduleDefinition = moduleDefinition; _typeSystem = typeSystem; _findType = findType; _deepEqualityComparer = _moduleDefinition.ImportReference(typeof(DeepEqualityComparer)).Resolve(); }
public SystemReferences(global::Fody.TypeSystem typeSystem, ModuleDefinition moduleDefinition, IAssemblyResolver assemblyResolver) { var coreTypes = new CoreTypes(moduleDefinition, assemblyResolver); IEquatable = coreTypes.GetType(typeof(IEquatable <>)); StringEquals = coreTypes.GetMethod <string, string, string, StringComparison>(nameof(string.Equals)); ObjectEquals = coreTypes.GetMethod <object, object, object>(nameof(object.Equals)); ObjectGetHashCode = coreTypes.GetMethod <object>(nameof(object.GetHashCode)); StringComparer = coreTypes.GetType <StringComparer>(); StringComparerGetHashCode = coreTypes.GetMethod <StringComparer, string>(nameof(StringComparer.GetHashCode)); StringComparerEquals = coreTypes.GetMethod <StringComparer, string, string>(nameof(StringComparer.Equals)); GeneratedCodeAttributeCtor = coreTypes.GetMethod <GeneratedCodeAttribute, string, string>(".ctor"); DebuggerNonUserCodeAttributeCtor = coreTypes.GetMethod <DebuggerNonUserCodeAttribute>(".ctor"); TypeSystem = typeSystem; }