Skip to content

Commit 5410276

Browse files
authored
Fix5481 (#5486)
* Fixes: #5470 * Fix #5481
1 parent f0d373a commit 5410276

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/absil/ilwritepdb.fs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,16 @@ let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sou
416416

417417
let collectScopes scope =
418418
let list = new List<PdbMethodScope>()
419-
let rec toList scope =
420-
list.Add scope
421-
scope.Children |> Seq.iter(fun s -> toList s)
422-
toList scope
419+
let rec toList scope parent =
420+
let nested =
421+
match parent with
422+
| Some p -> scope.StartOffset <> p.StartOffset || scope.EndOffset <> p.EndOffset
423+
| None -> true
424+
425+
if nested then list.Add scope
426+
scope.Children |> Seq.iter(fun s -> toList s (if nested then Some scope else parent))
427+
428+
toList scope None
423429
list.ToArray() |> Array.sortWith<PdbMethodScope> scopeSorter
424430

425431
collectScopes scope |> Seq.iter(fun s ->

0 commit comments

Comments
 (0)