예제 #1
0
파일: PdbReader.cs 프로젝트: atykhyy/cecil
        static void ReadScopeAndLocals(PdbScope scope, ScopeSymbol parent, MethodSymbols symbols)
        {
            if (scope == null)
                return;

            ScopeSymbol s = new ScopeSymbol ();
            s.start = (int) scope.offset;
            s.end   = (int)(scope.offset + scope.length);

            if (parent != null)
                parent.Scopes.Add (s);
            else
            if (symbols.scope == null)
                symbols.scope = s;
            else
                throw new InvalidDataException () ;

            foreach (PdbSlot slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= symbols.Variables.Count)
                    continue;

                VariableDefinition variable = symbols.Variables [index];
                variable.Name = slot.name;

                s.Variables.Add (variable);
            }

            ReadScopeAndLocals (scope.scopes, s, symbols);
        }
예제 #2
0
파일: PdbWriter.cs 프로젝트: atykhyy/cecil
        void WriteScope(MethodSymbols symbols, ScopeSymbol scope)
        {
            writer.OpenScope  (scope.Start);

            foreach (var s in scope.Scopes)
                WriteScope (symbols, s);

            DefineVariables   (symbols, scope.Variables, scope.Start, scope.End) ;
            writer.CloseScope (scope.End);
        }
예제 #3
0
파일: PdbReader.cs 프로젝트: atykhyy/cecil
 static void ReadScopeAndLocals(PdbScope [] scopes, ScopeSymbol parent, MethodSymbols symbols)
 {
     foreach (PdbScope scope in scopes)
         ReadScopeAndLocals (scope, parent, symbols);
 }