private Instruction GetLdArgInstruction() { if (CanInline) { var ldArgInstruction = OpCodeHelper.Clone(_pushInstruction); _inlinedInstructions.Add(ldArgInstruction); return(ldArgInstruction); } return(OpCodeHelper.CreateLoadLoc(GetVariableDefinition())); }
private VariableDefinition GetVariableDefinition() { if (_variableDefinition == null) { _variableDefinition = new VariableDefinition(_inlineMethodWeaver._parameters[_paramIndex].ParameterType); _inlineMethodWeaver._parentMethod.Body.Variables.Add(_variableDefinition); // revert inline if (_inlinedInstructions.Count > 0) { foreach (var inlinedInstruction in _inlinedInstructions) { OpCodeHelper.ReplaceInstruction(inlinedInstruction, OpCodeHelper.CreateLoadLoc(_variableDefinition)); } _inlinedInstructions.Clear(); } } return(_variableDefinition); }