PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/LinFu.AOP/InstructionProvider.cs

http://github.com/philiplaureano/LinFu
C# | 27 lines | 16 code | 2 blank | 9 comment | 0 complexity | 7228917681ec013df7b2357e3f577cd5 MD5 | raw file
 1using System.Collections.Generic;
 2using LinFu.AOP.Cecil.Interfaces;
 3using Mono.Cecil;
 4using Mono.Cecil.Cil;
 5
 6namespace LinFu.AOP.Cecil
 7{
 8    /// <summary>
 9    ///     Represents the default implementation of the <see cref="IInstructionProvider" /> class.
10    /// </summary>
11    internal class InstructionProvider : IInstructionProvider
12    {
13        /// <summary>
14        ///     Determines the instructions for a given method.
15        /// </summary>
16        /// <param name="method">The source method that contains the instructions.</param>
17        /// <returns>The set of instructions for the given method.</returns>
18        public IEnumerable<Instruction> GetInstructions(MethodDefinition method)
19        {
20            // Save the old instructions
21            var oldInstructions = new LinkedList<Instruction>();
22            foreach (Instruction instruction in method.Body.Instructions) oldInstructions.AddLast(instruction);
23
24            return oldInstructions;
25        }
26    }
27}