コード例 #1
0
ファイル: ILPattern.cs プロジェクト: aries544/eXpand
        public static MatchContext Match(MethodBase method, ILPattern pattern) {
            IList<Instruction> instructions = method.GetInstructions();
            if (instructions.Count == 0)
                throw new ArgumentException();

            var context = new MatchContext(instructions[0]);
            pattern.Match(context);
            return context;
        }
コード例 #2
0
        private static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern)
        {
            MatchContext result = ILPattern.Match(method, pattern);

            if (!result.success)
            {
                throw new NotSupportedException();
            }

            return(result.field);
        }
コード例 #3
0
        public static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            IList <Instruction> instructions = method.GetInstructions();

            if (instructions.Count == 0)
            {
                throw new ArgumentException();
            }

            var context = new MatchContext(instructions[0]);

            pattern.Match(context);
            return(context);
        }