示例#1
0
        internal static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            if (method == null)
                throw new ArgumentNullException("method");

            if (pattern == null)
                throw new ArgumentNullException("pattern");

            var instructions = (IList<Instruction>) MethodBodyReader.GetInstructions(method).AsReadOnly();
            if (instructions.Count == 0)
                throw new ArgumentException();

            var context = new MatchContext(instructions[0]);
            pattern.Match(context);
            return context;
        }
示例#2
0
文件: ILPattern.cs 项目: Myvar/Eclang
        internal static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            if (pattern == null)
            {
                throw new ArgumentNullException("pattern");
            }

            var instructions = (IList <Instruction>)MethodBodyReader.GetInstructions(method).AsReadOnly();

            if (instructions.Count == 0)
            {
                throw new ArgumentException();
            }

            var context = new MatchContext(instructions[0]);

            pattern.Match(context);
            return(context);
        }
示例#3
0
 private static ILPattern Optional(ILPattern pattern)
 {
     return new OptionalPattern(pattern);
 }
示例#4
0
 internal SequencePattern(ILPattern[] patterns)
 {
     _patterns = patterns;
 }
示例#5
0
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }
示例#6
0
文件: ILPattern.cs 项目: Myvar/Eclang
 private static ILPattern Optional(ILPattern pattern)
 {
     return(new OptionalPattern(pattern));
 }
示例#7
0
文件: ILPattern.cs 项目: Myvar/Eclang
 internal OptionalPattern(ILPattern optional)
 {
     _pattern = optional;
 }