コード例 #1
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
        static FieldInfo GetBackingField(MethodInfo method, ILPattern pattern)
        {
            //Debug.WriteLine("Enter on Reflection.EMIT and works!");
            var result = ILPattern.Match(method, pattern);

            if (!result.success)
            {
                throw new NotSupportedException();
            }
            // Debug.WriteLine("Exit on Reflection.EMIT and works!");
            return(result.field);
        }
コード例 #2
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
        public static MatchContext Match(MethodBase method, ILPattern pattern)
        {
            var instructions = method.GetInstructions();

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

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

            pattern.Match(context);
            return(context);
        }
コード例 #3
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
 public OptionalPattern(ILPattern optional)
 {
     this.pattern = optional;
 }
コード例 #4
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
 public static ILPattern Optional(ILPattern pattern)
 {
     return(new OptionalPattern(pattern));
 }
コード例 #5
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
 public FieldPattern(ILPattern pattern)
 {
     this.pattern = pattern;
 }
コード例 #6
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
 public EitherPattern(ILPattern a, ILPattern b)
 {
     this.a = a;
     this.b = b;
 }
コード例 #7
0
ファイル: PropertyResolver.cs プロジェクト: morecraf/Siaqodb
 public static ILPattern Either(ILPattern a, ILPattern b)
 {
     return(new EitherPattern(a, b));
 }