Mono.Cecil.Mdb.MdbReader.AddScope C# (CSharp) Method

AddScope() static private method

static private AddScope ( Collection scopes, ScopeDebugInformation scope ) : bool
scopes Collection
scope Mono.Cecil.Cil.ScopeDebugInformation
return bool
        static bool AddScope(Collection<ScopeDebugInformation> scopes, ScopeDebugInformation scope)
        {
            foreach (var sub_scope in scopes) {
                if (sub_scope.HasScopes && AddScope (sub_scope.Scopes, scope))
                    return true;

                if (scope.Start.Offset >= sub_scope.Start.Offset && scope.End.Offset <= sub_scope.End.Offset) {
                    sub_scope.Scopes.Add (scope);
                    return true;
                }
            }

            return false;
        }

Usage Example

Esempio n. 1
0
 private static Scope[] ReadScopes(MethodEntry entry, MethodBody body, InstructionMapper mapper)
 {
     CodeBlockEntry[] blocks = entry.GetCodeBlocks();
     Scope[]          scopes = new Scope[blocks.Length];
     CodeBlockEntry[] array  = blocks;
     for (int i = 0; i < array.Length; i++)
     {
         CodeBlockEntry block = array[i];
         if (block.BlockType == CodeBlockEntry.Type.Lexical)
         {
             Scope scope = new Scope();
             scope.Start         = mapper(block.StartOffset);
             scope.End           = mapper(block.EndOffset);
             scopes[block.Index] = scope;
             if (body.Scope == null)
             {
                 body.Scope = scope;
             }
             if (!MdbReader.AddScope(body.Scope, scope))
             {
                 body.Scope = scope;
             }
         }
     }
     return(scopes);
 }
All Usage Examples Of Mono.Cecil.Mdb.MdbReader::AddScope