Skip to content

Commit 68f731f

Browse files
forkibaronfel
authored andcommitted
Remove tryRawToLabel (#8293)
1 parent f5d909a commit 68f731f

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/absil/ilread.fs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,15 +2459,11 @@ and seekReadImplMap (ctxt: ILMetadataReader) nm midx =
24592459
and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start seqpoints =
24602460
let labelsOfRawOffsets = new Dictionary<_, _>(sz/2)
24612461
let ilOffsetsOfLabels = new Dictionary<_, _>(sz/2)
2462-
let tryRawToLabel rawOffset =
2463-
match labelsOfRawOffsets.TryGetValue rawOffset with
2464-
| true, v -> Some v
2465-
| _ -> None
2466-
2462+
24672463
let rawToLabel rawOffset =
2468-
match tryRawToLabel rawOffset with
2469-
| Some l -> l
2470-
| None ->
2464+
match labelsOfRawOffsets.TryGetValue rawOffset with
2465+
| true, l -> l
2466+
| _ ->
24712467
let lab = generateCodeLabel()
24722468
labelsOfRawOffsets.[rawOffset] <- lab
24732469
lab
@@ -2696,9 +2692,9 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s
26962692
// the start of the next instruction referred to by the raw offset.
26972693
let raw2nextLab rawOffset =
26982694
let isInstrStart x =
2699-
match tryRawToLabel x with
2700-
| None -> false
2701-
| Some lab -> ilOffsetsOfLabels.ContainsKey lab
2695+
match labelsOfRawOffsets.TryGetValue x with
2696+
| true, lab -> ilOffsetsOfLabels.ContainsKey lab
2697+
| _ -> false
27022698
if isInstrStart rawOffset then rawToLabel rawOffset
27032699
elif isInstrStart (rawOffset+1) then rawToLabel (rawOffset+1)
27042700
else failwith ("the bytecode raw offset "+string rawOffset+" did not refer either to the start or end of an instruction")

0 commit comments

Comments
 (0)