Exemplo n.º 1
0
        public SequencePoint(Instruction instruction, Document document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            this.offset   = new InstructionOffset(instruction);
            this.document = document;
        }
Exemplo n.º 2
0
        internal SequencePoint(int offset, Document document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            this.offset   = new InstructionOffset(offset);
            this.document = document;
        }
Exemplo n.º 3
0
        public ScopeDebugInformation(Instruction start, Instruction end)
            : this()
        {
            if (start == null)
            {
                throw new ArgumentNullException("start");
            }

            this.start = new InstructionOffset(start);

            if (end != null)
            {
                this.end = new InstructionOffset(end);
            }
        }
Exemplo n.º 4
0
 public StateMachineScope(Instruction start, Instruction end)
 {
     this.start = new InstructionOffset(start);
     this.end   = end != null ? new InstructionOffset(end) : new InstructionOffset();
 }
Exemplo n.º 5
0
 internal StateMachineScope(int start, int end)
 {
     this.start = new InstructionOffset(start);
     this.end   = new InstructionOffset(end);
 }
Exemplo n.º 6
0
 public AsyncMethodBodyDebugInformation()
     : base(KindIdentifier)
 {
     this.catch_handler = new InstructionOffset(-1);
 }
Exemplo n.º 7
0
 internal AsyncMethodBodyDebugInformation(int catchHandler)
     : base(KindIdentifier)
 {
     this.catch_handler = new InstructionOffset(catchHandler);
 }
Exemplo n.º 8
0
        InstructionOffset ResolveInstructionOffset(InstructionOffset inputOffset, ref InstructionOffsetCache cache)
        {
            if (inputOffset.IsResolved)
            {
                return(inputOffset);
            }

            int offset = inputOffset.Offset;

            if (cache.Offset == offset)
            {
                return(new InstructionOffset(cache.Instruction));
            }

            if (cache.Offset > offset)
            {
                // This should be rare - we're resolving offset pointing to a place before the current cache position
                // resolve by walking the instructions from start and don't cache the result.
                int size = 0;
                for (int i = 0; i < items.Length; i++)
                {
                    if (size == offset)
                    {
                        return(new InstructionOffset(items [i]));
                    }

                    if (size > offset)
                    {
                        return(new InstructionOffset(items [i - 1]));
                    }

                    size += items [i].GetSize();
                }

                // Offset is larger than the size of the body - so it points after the end
                return(new InstructionOffset());
            }
            else
            {
                // The offset points after the current cache position - so continue counting and update the cache
                int size = cache.Offset;
                for (int i = cache.Index; i < items.Length; i++)
                {
                    cache.Index       = i;
                    cache.Offset      = size;
                    cache.Instruction = items [i];

                    if (cache.Offset == offset)
                    {
                        return(new InstructionOffset(cache.Instruction));
                    }

                    if (cache.Offset > offset)
                    {
                        return(new InstructionOffset(items [i - 1]));
                    }

                    size += items [i].GetSize();
                }

                return(new InstructionOffset());
            }
        }