|
|
@ -171,9 +171,11 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// Add the IL range associated with this instruction to the current sequence point.
|
|
|
|
// Add the IL range associated with this instruction to the current sequence point.
|
|
|
|
if (!inst.ILRange.IsEmpty && current.Intervals != null) { |
|
|
|
if (HasUsableILRange(inst) && current.Intervals != null) { |
|
|
|
current.Intervals.Add(inst.ILRange); |
|
|
|
current.Intervals.Add(inst.ILRange); |
|
|
|
current.Function = inst.Parent.Ancestors.OfType<ILFunction>().FirstOrDefault(); |
|
|
|
var function = inst.Parent.Ancestors.OfType<ILFunction>().FirstOrDefault(); |
|
|
|
|
|
|
|
Debug.Assert(current.Function == null || current.Function == function); |
|
|
|
|
|
|
|
current.Function = function; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Do not add instructions of lambdas/delegates.
|
|
|
|
// Do not add instructions of lambdas/delegates.
|
|
|
@ -187,6 +189,13 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal static bool HasUsableILRange(ILInstruction inst) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (inst.ILRange.IsEmpty) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
return !(inst is BlockContainer || inst is Block); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Called after the visitor is done to return the results.
|
|
|
|
/// Called after the visitor is done to return the results.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -227,6 +236,13 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
newList.Add(sequencePoint); |
|
|
|
newList.Add(sequencePoint); |
|
|
|
pos = sequencePoint.EndOffset; |
|
|
|
pos = sequencePoint.EndOffset; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (pos < function.CecilMethod.Body.CodeSize) { |
|
|
|
|
|
|
|
var hidden = new SequencePoint(); |
|
|
|
|
|
|
|
hidden.Offset = pos; |
|
|
|
|
|
|
|
hidden.EndOffset = function.CecilMethod.Body.CodeSize; |
|
|
|
|
|
|
|
hidden.SetHidden(); |
|
|
|
|
|
|
|
newList.Add(hidden); |
|
|
|
|
|
|
|
} |
|
|
|
dict[function] = newList; |
|
|
|
dict[function] = newList; |
|
|
|
} |
|
|
|
} |
|
|
|
return dict; |
|
|
|
return dict; |
|
|
|