internal override void Match(MatchContext context) { if (!pattern.TryMatch(context)) { context.success = false; return; } context.field = (FieldInfo) context._instruction.Previous.Operand; }
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; }
internal bool TryMatch(MatchContext context) { Instruction instruction = context._instruction; Match(context); if (context.success) return true; context.Reset(instruction); return false; }
internal abstract void Match(MatchContext context);
internal override void Match(MatchContext context) { pattern.TryMatch(context); }
internal override void Match(MatchContext context) { if (context._instruction == null) { context.success = false; return; } context.success = context._instruction.OpCode == opcode; context.Advance(); }
internal override void Match(MatchContext context) { if (!a.TryMatch(context)) b.Match(context); }
internal abstract void Match(MatchContext context);
internal override void Match(MatchContext context) { foreach (ILPattern pattern in patterns) { pattern.Match(context); if (!context.success) break; } }
internal override void Match(MatchContext context) { pattern.TryMatch(context); }