예제 #1
0
        private static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern) {
            MatchContext result = ILPattern.Match(method, pattern);
            if (!result.success)
                throw new NotSupportedException();

            return result.field;
        }
예제 #2
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;
        }
예제 #3
0
        private static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern)
        {
            MatchContext result = ILPattern.Match(method, pattern);

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

            return(result.field);
        }
예제 #4
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);
        }
예제 #5
0
 public FieldPattern(ILPattern pattern)
 {
     this.pattern = pattern;
 }
예제 #6
0
 public EitherPattern(ILPattern a, ILPattern b)
 {
     this.a = a;
     this.b = b;
 }
예제 #7
0
 public static ILPattern Either(ILPattern a, ILPattern b)
 {
     return(new EitherPattern(a, b));
 }
예제 #8
0
 public OptionalPattern(ILPattern optional)
 {
     pattern = optional;
 }
예제 #9
0
 public static ILPattern Optional(ILPattern pattern)
 {
     return(new OptionalPattern(pattern));
 }
예제 #10
0
 public FieldPattern(ILPattern pattern) {
     this.pattern = pattern;
 }
예제 #11
0
 public EitherPattern(ILPattern a, ILPattern b) {
     this.a = a;
     this.b = b;
 }
예제 #12
0
 public static ILPattern Either(ILPattern a, ILPattern b) {
     return new EitherPattern(a, b);
 }
예제 #13
0
 public SequencePattern(ILPattern[] patterns) {
     this.patterns = patterns;
 }
예제 #14
0
 public OptionalPattern(ILPattern optional) {
     pattern = optional;
 }
예제 #15
0
 public static ILPattern Optional(ILPattern pattern) {
     return new OptionalPattern(pattern);
 }