refactor: ban std.debug.assert (#10168)

* Ban `std.debug.assert`

* Create .clangd

* Update lint.yml

* Update linter.ts

* update

* lint

* Update linter.ts

* Update linter.ts

* update

* Update linter.ts

* update

* Update linter.ts

* more

* Update install.zig

* words

* Remove UB
This commit is contained in:
Jarred Sumner
2024-04-11 17:52:29 -07:00
committed by GitHub
parent 0f10d4f1be
commit 688844b472
149 changed files with 1314 additions and 1105 deletions

View File

@@ -443,8 +443,8 @@ pub const LineColumnOffset = struct {
defer this.columns = columns;
var offset: u32 = 0;
while (strings.indexOfNewlineOrNonASCII(input, offset)) |i| {
std.debug.assert(i >= offset);
std.debug.assert(i < input.len);
assert(i >= offset);
assert(i < input.len);
var iter = strings.CodepointIterator.initOffset(input, i);
var cursor = strings.CodepointIterator.Cursor{ .i = @as(u32, @truncate(iter.i)) };
@@ -581,7 +581,7 @@ pub const SourceMapPieces = struct {
j.push(mappings[start_of_run..potential_end_of_run]);
std.debug.assert(shift.before.lines == shift.after.lines);
assert(shift.before.lines == shift.after.lines);
const shift_column_delta = shift.after.columns - shift.before.columns;
const encode = encodeVLQ(decode_result.value + shift_column_delta - prev_shift_column_delta);
@@ -839,7 +839,7 @@ pub const LineOffsetTable = struct {
pub const List = std.MultiArrayList(LineOffsetTable);
pub fn findLine(byte_offsets_to_start_of_line: []const u32, loc: Logger.Loc) i32 {
std.debug.assert(loc.start > -1); // checked by caller
assert(loc.start > -1); // checked by caller
var original_line: usize = 0;
const loc_start = @as(usize, @intCast(loc.start));
@@ -862,7 +862,7 @@ pub const LineOffsetTable = struct {
}
pub fn findIndex(byte_offsets_to_start_of_line: []const u32, loc: Logger.Loc) ?usize {
std.debug.assert(loc.start > -1); // checked by caller
assert(loc.start > -1); // checked by caller
var original_line: usize = 0;
const loc_start = @as(usize, @intCast(loc.start));
@@ -924,7 +924,7 @@ pub const LineOffsetTable = struct {
}
if (c > 0x7F and columns_for_non_ascii.items.len == 0) {
std.debug.assert(@intFromPtr(
assert(@intFromPtr(
remaining.ptr,
) >= @intFromPtr(
contents.ptr,
@@ -1466,3 +1466,5 @@ pub const DebugIDFormatter = struct {
try writer.writeAll(&buf);
}
};
const assert = bun.assert;