CreateContext() static private method

static private CreateContext ( MethodDefinition method, IILVisitor visitor ) : ParseContext
method MethodDefinition
visitor IILVisitor
return ParseContext
Esempio n. 1
0
        public static void Parse(MethodDefinition method, IILVisitor visitor)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }
            if (!method.HasBody || !method.HasImage)
            {
                throw new ArgumentException();
            }
            ILParser.ParseContext parseContext = ILParser.CreateContext(method, visitor);
            CodeReader            code         = parseContext.Code;

            code.MoveTo(method.RVA);
            byte num  = code.ReadByte();
            int  num1 = num & 3;

            if (num1 == 2)
            {
                ILParser.ParseCode(num >> 2, parseContext);
                return;
            }
            if (num1 != 3)
            {
                throw new NotSupportedException();
            }
            code.position--;
            ILParser.ParseFatMethod(parseContext);
        }