ParseCode() static private method

static private ParseCode ( int code_size, ParseContext context ) : void
code_size int
context ParseContext
return void
コード例 #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);
        }
コード例 #2
0
        private static void ParseFatMethod(ILParser.ParseContext context)
        {
            CodeReader code = context.Code;

            code.Advance(4);
            int           num           = code.ReadInt32();
            MetadataToken metadataToken = code.ReadToken();

            if (metadataToken != MetadataToken.Zero)
            {
                context.Variables = code.ReadVariables(metadataToken);
            }
            ILParser.ParseCode(num, context);
        }