PropertyWeaver.AddBeforeAfterOnChangedCall C# (CSharp) Method

AddBeforeAfterOnChangedCall() private method

private AddBeforeAfterOnChangedCall ( int index, Mono.Cecil.PropertyDefinition property, MethodReference methodReference ) : int
index int
property Mono.Cecil.PropertyDefinition
methodReference Mono.Cecil.MethodReference
return int
    int AddBeforeAfterOnChangedCall(int index, PropertyDefinition property, MethodReference methodReference)
    {
        var beforeVariable = new VariableDefinition(typeSystem.Object);
        setMethodBody.Variables.Add(beforeVariable);
        var afterVariable = new VariableDefinition(typeSystem.Object);
        setMethodBody.Variables.Add(afterVariable);
        index = InsertVariableAssignmentFromCurrentValue(index, property, afterVariable);

        index = instructions.Insert(index,
            Instruction.Create(OpCodes.Ldarg_0),
            Instruction.Create(OpCodes.Ldloc, beforeVariable),
            Instruction.Create(OpCodes.Ldloc, afterVariable),
            CreateCall(methodReference)
            );

        return AddBeforeVariableAssignment(index, property, beforeVariable);
    }