AddScope() static private method

static private AddScope ( Collection scopes, ScopeDebugInformation scope ) : bool
scopes Collection
scope Mono.Cecil.Cil.ScopeDebugInformation
return bool
Beispiel #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);
 }
Beispiel #2
0
        private static bool AddScope(Scope provider, Scope scope)
        {
            bool result;

            {
                // foreach(var sub_scope in provider.Scopes)
                var __enumerator1 = (provider.Scopes).GetEnumerator();
                while (__enumerator1.MoveNext())
                {
                    var sub_scope = (Scope)__enumerator1.Current;
                    {
                        if (MdbReader.AddScope(sub_scope, scope))
                        {
                            result = true;
                            return(result);
                        }
                        if (scope.Start.Offset >= sub_scope.Start.Offset && scope.End.Offset <= sub_scope.End.Offset)
                        {
                            sub_scope.Scopes.Add(scope);
                            result = true;
                            return(result);
                        }
                    }
                }
            }
            result = false;
            return(result);
        }
Beispiel #3
0
        private static bool AddScope(Scope provider, Scope scope)
        {
            bool result;

            foreach (Scope sub_scope in provider.Scopes)
            {
                if (MdbReader.AddScope(sub_scope, scope))
                {
                    result = true;
                    return(result);
                }
                if (scope.Start.Offset >= sub_scope.Start.Offset && scope.End.Offset <= sub_scope.End.Offset)
                {
                    sub_scope.Scopes.Add(scope);
                    result = true;
                    return(result);
                }
            }
            result = false;
            return(result);
        }