public AtomGetterMethodWeaver(AtomWeaverV2 weaver, PropertyDefinition property, FieldReference atomField, AtomOptions options) { _atomField = atomField; _options = options; _property = property; _atomDebugName = weaver._generateDebugNames ? $"{property.DeclaringType.FullName}::{property.Name}" : null; _resultVariable = new VariableDefinition(property.PropertyType); _nullCheckEndInstruction = Instruction.Create(OpCodes.Nop); _directEvalEndInstruction = Instruction.Create(OpCodes.Nop); _loadResultInstruction = Instruction.Create(OpCodes.Ldloc, _resultVariable); var propertyType = property.PropertyType; _atomCreateMethod = Helpers.MakeGenericMethod(weaver._atomCreateMethod, propertyType); _atomPullCtorMethod = Helpers.MakeHostInstanceGeneric(weaver._atomPullCtorMethod, propertyType); _tryEnterMethod = Helpers.MakeHostInstanceGeneric(weaver._atomDirectEvalMethod, propertyType); _atomGetMethod = Helpers.MakeHostInstanceGeneric(weaver._atomGetValueMethod, propertyType); var body = property.GetMethod.Body; body.InitLocals = true; body.Variables.Add(_resultVariable); }
public AtomSetterMethodWeaver(AtomWeaverV2 weaver, PropertyDefinition property, FieldReference atomField) { _atomField = atomField; _property = property; _nullCheckEndInstruction = Instruction.Create(OpCodes.Nop); _preReturnInstruction = Instruction.Create(OpCodes.Nop); var propertyType = property.PropertyType; _compAndInvalidateMethod = Helpers.MakeHostInstanceGeneric(weaver._atomCompAndInvalidateMethod, propertyType); }