// note: sadly it's not possible to cache all the [count] allocations and reuse them. // a NRE is throw if the size of the arrays does not match SequencePointCount :( void ReadSequencePoints(ISymbolMethod method, IDictionary instructions) { int count = method.SequencePointCount; int [] offsets = new int [count]; ISymbolDocument [] docs = new ISymbolDocument [count]; int [] startColumn = new int [count]; int [] endColumn = new int [count]; int [] startRow = new int [count]; int [] endRow = new int [count]; method.GetSequencePoints(offsets, docs, startRow, startColumn, endRow, endColumn); for (int i = 0; i < offsets.Length; i++) { Cil.Instruction instr = (Cil.Instruction)instructions [offsets [i]]; Cil.SequencePoint sp = new Cil.SequencePoint(GetDocument(docs [i])); sp.StartLine = startRow [i]; sp.StartColumn = startColumn [i]; sp.EndLine = endRow [i]; sp.EndColumn = endColumn [i]; instr.SequencePoint = sp; } }
static Cil.Instruction GetInstruction(Cil.MethodBody body, IDictionary instructions, int offset) { Cil.Instruction instr = (Cil.Instruction)instructions [offset]; if (instr != null) { return(instr); } return(body.Instructions.Outside); }
Cil.Instruction GetInstruction(Cil.MethodBody body, Hashtable instructions, int offset) { Cil.Instruction instr = (Cil.Instruction)instructions [offset]; if (instr != null) { return(instr); } return(body.Instructions.Outside); }