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