/// <summary> /// Emits optimal <see cref="OpCodes.Ldloc"/> instructions by a given <paramref name="index"/>. /// </summary> /// <remarks> /// Optimal meaning Creating the special OpCodes(e.g. <see cref="OpCodes.Ldloc_0"/>...) /// if <paramref name="index"/> is smaller than 4. /// </remarks> /// <param name="processor">The <see cref="ILProcessor"/>.</param> /// <param name="index">The index of the variable to load.</param> public static void EmitLdloca(this ILProcessor processor, int index) { processor.Append(processor.CreateLdloca(index)); }
/// <summary> /// Emits optimal <see cref="OpCodes.Ldloc"/> instructions by a given <paramref name="variable"/>. /// </summary> /// <remarks> /// <see cref="EmitLdloc(ILProcessor, int)"/> /// </remarks> /// <param name="processor">The <see cref="ILProcessor"/>.</param> /// <param name="variable">The variable to load.</param> public static void EmitLdloca(this ILProcessor processor, VariableDefinition variable) { processor.Append(processor.CreateLdloca(variable)); }
/// <summary> /// Creates optimal <see cref="OpCodes.Ldloca"/> instructions by a given <paramref name="variable"/>. /// </summary> /// <remarks> /// <see cref="CreateLdloca(ILProcessor, int)"/> /// </remarks> /// <param name="processor">The <see cref="ILProcessor"/>.</param> /// <param name="variable">The variable to load.</param> /// <returns>The created <see cref="Instruction"/>.</returns> public static Instruction CreateLdloca(this ILProcessor processor, VariableDefinition variable) { return(processor.CreateLdloca(variable.Index)); }