Skip to content

Commit 4b4f977

Browse files
committed
[ASTGen]: precondition that position is within buffer
1 parent df9ae88 commit 4b4f977

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/ASTGen/Sources/ASTGen/Bridge.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ extension BridgedSourceLoc {
3232
at position: AbsolutePosition,
3333
in buffer: UnsafeBufferPointer<UInt8>
3434
) {
35-
if let start = buffer.baseAddress,
36-
position.utf8Offset >= 0 && position.utf8Offset < buffer.count {
37-
assert(position.utf8Offset >= 0 && position.utf8Offset < buffer.count)
38-
self = SourceLoc_advanced(BridgedSourceLoc(raw: start), SwiftInt(position.utf8Offset))
39-
} else {
40-
self = nil
41-
}
35+
precondition(position.utf8Offset >= 0 && position.utf8Offset < buffer.count)
36+
self = SourceLoc_advanced(BridgedSourceLoc(raw: buffer.baseAddress), SwiftInt(position.utf8Offset))
4237
}
4338
}
4439

0 commit comments

Comments
 (0)