mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
zig: remove Location.suggestion (#23478)
This commit is contained in:
@@ -2335,9 +2335,6 @@ pub const api = struct {
|
||||
/// line_text
|
||||
line_text: []const u8,
|
||||
|
||||
/// suggestion
|
||||
suggestion: []const u8,
|
||||
|
||||
/// offset
|
||||
offset: u32 = 0,
|
||||
|
||||
@@ -2349,7 +2346,6 @@ pub const api = struct {
|
||||
this.line = try reader.readValue(i32);
|
||||
this.column = try reader.readValue(i32);
|
||||
this.line_text = try reader.readValue([]const u8);
|
||||
this.suggestion = try reader.readValue([]const u8);
|
||||
this.offset = try reader.readValue(u32);
|
||||
return this;
|
||||
}
|
||||
@@ -2360,7 +2356,6 @@ pub const api = struct {
|
||||
try writer.writeInt(this.line);
|
||||
try writer.writeInt(this.column);
|
||||
try writer.writeValue(@TypeOf(this.line_text), this.line_text);
|
||||
try writer.writeValue(@TypeOf(this.suggestion), this.suggestion);
|
||||
try writer.writeInt(this.offset);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -833,7 +833,6 @@ const OnBeforeParsePlugin = struct {
|
||||
@max(this.column, -1),
|
||||
@max(this.column_end - this.column, 0),
|
||||
if (source_line_text.len > 0) bun.handleOom(allocator.dupe(u8, source_line_text)) else null,
|
||||
null,
|
||||
);
|
||||
var msg = Logger.Msg{ .data = .{ .location = location, .text = bun.handleOom(allocator.dupe(u8, this.message())) } };
|
||||
switch (this.level) {
|
||||
|
||||
@@ -86,8 +86,6 @@ pub const Location = struct {
|
||||
length: usize = 0,
|
||||
/// Text on the line, avoiding the need to refetch the source code
|
||||
line_text: ?string = null,
|
||||
// TODO: remove this unused field
|
||||
suggestion: ?string = null,
|
||||
// TODO: document or remove
|
||||
offset: usize = 0,
|
||||
|
||||
@@ -96,7 +94,6 @@ pub const Location = struct {
|
||||
cost += this.file.len;
|
||||
cost += this.namespace.len;
|
||||
if (this.line_text) |text| cost += text.len;
|
||||
if (this.suggestion) |text| cost += text.len;
|
||||
return cost;
|
||||
}
|
||||
|
||||
@@ -104,7 +101,6 @@ pub const Location = struct {
|
||||
builder.count(this.file);
|
||||
builder.count(this.namespace);
|
||||
if (this.line_text) |text| builder.count(text);
|
||||
if (this.suggestion) |text| builder.count(text);
|
||||
}
|
||||
|
||||
pub fn clone(this: Location, allocator: std.mem.Allocator) !Location {
|
||||
@@ -115,7 +111,6 @@ pub const Location = struct {
|
||||
.column = this.column,
|
||||
.length = this.length,
|
||||
.line_text = if (this.line_text != null) try allocator.dupe(u8, this.line_text.?) else null,
|
||||
.suggestion = if (this.suggestion != null) try allocator.dupe(u8, this.suggestion.?) else null,
|
||||
.offset = this.offset,
|
||||
};
|
||||
}
|
||||
@@ -128,7 +123,6 @@ pub const Location = struct {
|
||||
.column = this.column,
|
||||
.length = this.length,
|
||||
.line_text = if (this.line_text != null) string_builder.append(this.line_text.?) else null,
|
||||
.suggestion = if (this.suggestion != null) string_builder.append(this.suggestion.?) else null,
|
||||
.offset = this.offset,
|
||||
};
|
||||
}
|
||||
@@ -140,7 +134,6 @@ pub const Location = struct {
|
||||
.line = this.line,
|
||||
.column = this.column,
|
||||
.line_text = this.line_text orelse "",
|
||||
.suggestion = this.suggestion orelse "",
|
||||
.offset = @as(u32, @truncate(this.offset)),
|
||||
};
|
||||
}
|
||||
@@ -148,7 +141,7 @@ pub const Location = struct {
|
||||
// don't really know what's safe to deinit here!
|
||||
pub fn deinit(_: *Location, _: std.mem.Allocator) void {}
|
||||
|
||||
pub fn init(file: string, namespace: string, line: i32, column: i32, length: u32, line_text: ?string, suggestion: ?string) Location {
|
||||
pub fn init(file: string, namespace: string, line: i32, column: i32, length: u32, line_text: ?string) Location {
|
||||
return Location{
|
||||
.file = file,
|
||||
.namespace = namespace,
|
||||
@@ -156,7 +149,6 @@ pub const Location = struct {
|
||||
.column = column,
|
||||
.length = length,
|
||||
.line_text = line_text,
|
||||
.suggestion = suggestion,
|
||||
.offset = length,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user