Esempio n. 1
0
        /// <summary>
        /// Read in the method bytecode bodies
        /// </summary>
        private void ReadMethodBodies()
        {
            uint bodyCount = this.abcdtr.ReadU30();

#if DEBUG
            if (this.ReadLog != null)
            {
                this.ReadLog.AppendLine("Body count: " + bodyCount);
            }
#endif

            while (bodyCount-- > 0)
            {
                Method m = this.code.GetMethod((int)this.abcdtr.ReadU30());

                m.MaxStack       = this.abcdtr.ReadU30();
                m.LocalCount     = this.abcdtr.ReadU30();
                m.InitScopeDepth = this.abcdtr.ReadU30();
                m.MaxScopeDepth  = this.abcdtr.ReadU30();

                m.Bytes = this.abcdtr.ReadByteBlock((int)this.abcdtr.ReadU30());
#if DEBUG
                if (this.ReadLog != null)
                {
                    this.ReadLog.AppendLine("Method: " + m);
                    this.ReadLog.AppendLine("  max stack: " + m.MaxStack);
                    this.ReadLog.AppendLine("  locals: " + m.LocalCount);
                    this.ReadLog.AppendLine("  init scope depth: " + m.InitScopeDepth);
                    this.ReadLog.AppendLine("  max scope depth: " + m.MaxScopeDepth);
                }
#endif
                /* Read exception handlers, but ignore for now */
                uint exceptionCount = this.abcdtr.ReadU30();
                while (exceptionCount-- > 0)
                {
                    ExceptionHandler eh = new ExceptionHandler();

                    eh.From   = (int)this.abcdtr.ReadU30();
                    eh.To     = (int)this.abcdtr.ReadU30();
                    eh.Target = (int)this.abcdtr.ReadU30();

                    eh.CatchType = this.code.GetMultiname((int)this.abcdtr.ReadU30());
                    eh.VarName   = this.code.GetMultiname((int)this.abcdtr.ReadU30());

                    m.AddExceptionHandler(eh);
                }

                uint traitCount = this.abcdtr.ReadU30();
                while (traitCount-- > 0)
                {
                    m.AddTrait(this.ReadTrait());
                }
            }
        }