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); }
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); }
static void ReadScopeAndLocals(PdbScope [] scopes, ScopeSymbol parent, MethodSymbols symbols) { foreach (PdbScope scope in scopes) ReadScopeAndLocals (scope, parent, symbols); }