private static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern) { MatchContext result = ILPattern.Match(method, pattern); if (!result.success) throw new NotSupportedException(); return result.field; }
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; }
private static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern) { MatchContext result = ILPattern.Match(method, pattern); if (!result.success) { throw new NotSupportedException(); } return(result.field); }
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); }
public FieldPattern(ILPattern pattern) { this.pattern = pattern; }
public EitherPattern(ILPattern a, ILPattern b) { this.a = a; this.b = b; }
public static ILPattern Either(ILPattern a, ILPattern b) { return(new EitherPattern(a, b)); }
public OptionalPattern(ILPattern optional) { pattern = optional; }
public static ILPattern Optional(ILPattern pattern) { return(new OptionalPattern(pattern)); }
public static ILPattern Either(ILPattern a, ILPattern b) { return new EitherPattern(a, b); }
public SequencePattern(ILPattern[] patterns) { this.patterns = patterns; }
public static ILPattern Optional(ILPattern pattern) { return new OptionalPattern(pattern); }