Example #1
0
            internal override void Match(MatchContext context) {
                if (!pattern.TryMatch(context)) {
                    context.success = false;
                    return;
                }

                context.field = (FieldInfo) context._instruction.Previous.Operand;
            }
Example #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;
        }
Example #3
0
        internal bool TryMatch(MatchContext context) {
            Instruction instruction = context._instruction;
            Match(context);

            if (context.success)
                return true;

            context.Reset(instruction);
            return false;
        }
Example #4
0
 internal abstract void Match(MatchContext context);
Example #5
0
 internal override void Match(MatchContext context)
 {
     pattern.TryMatch(context);
 }
Example #6
0
            internal override void Match(MatchContext context) {
                if (context._instruction == null) {
                    context.success = false;
                    return;
                }

                context.success = context._instruction.OpCode == opcode;
                context.Advance();
            }
Example #7
0
 internal override void Match(MatchContext context) {
     if (!a.TryMatch(context))
         b.Match(context);
 }
Example #8
0
 internal abstract void Match(MatchContext context);
Example #9
0
            internal override void Match(MatchContext context) {
                foreach (ILPattern pattern in patterns) {
                    pattern.Match(context);

                    if (!context.success)
                        break;
                }
            }
Example #10
0
 internal override void Match(MatchContext context) {
     pattern.TryMatch(context);
 }