diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/bindings/header-gen.zig | 6 | ||||
-rw-r--r-- | src/bun.js/bindings/headers-cpp.h | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/headers.h | 2 | ||||
-rw-r--r-- | src/bun.js/bindings/static_export.zig | 2 | ||||
-rw-r--r-- | src/bun.js/javascript.zig | 1 | ||||
-rw-r--r-- | src/bun.js/module_loader.zig | 1 | ||||
-rw-r--r-- | src/bun.js/webcore/streams.zig | 8 | ||||
-rw-r--r-- | src/http_client_async.zig | 3 | ||||
-rw-r--r-- | src/js_printer.zig | 2 | ||||
-rw-r--r-- | src/string_immutable.zig | 7 |
10 files changed, 16 insertions, 18 deletions
diff --git a/src/bun.js/bindings/header-gen.zig b/src/bun.js/bindings/header-gen.zig index 179c884d5..cb1629de7 100644 --- a/src/bun.js/bindings/header-gen.zig +++ b/src/bun.js/bindings/header-gen.zig @@ -23,9 +23,9 @@ const ENABLE_REWRITE_RETURN = false; pub fn cTypeLabel(comptime Type: type) ?[]const u8 { return switch (comptime Type) { - *StaticExport.c_char => "char*", - [*c]u8, *const StaticExport.c_char => "const char*", - StaticExport.c_char => "char", + *c_char => "char*", + [*c]u8, *const c_char => "const char*", + c_char => "char", *void => "void", bool => "bool", usize => "size_t", diff --git a/src/bun.js/bindings/headers-cpp.h b/src/bun.js/bindings/headers-cpp.h index 2b9349144..f90e2f0d9 100644 --- a/src/bun.js/bindings/headers-cpp.h +++ b/src/bun.js/bindings/headers-cpp.h @@ -1,4 +1,4 @@ -//-- AUTOGENERATED FILE -- 1681365101 +//-- AUTOGENERATED FILE -- 1681462444 // clang-format off #pragma once diff --git a/src/bun.js/bindings/headers.h b/src/bun.js/bindings/headers.h index fbf902a8a..b547edc44 100644 --- a/src/bun.js/bindings/headers.h +++ b/src/bun.js/bindings/headers.h @@ -1,5 +1,5 @@ // clang-format off -//-- AUTOGENERATED FILE -- 1681365101 +//-- AUTOGENERATED FILE -- 1681462444 #pragma once #include <stddef.h> diff --git a/src/bun.js/bindings/static_export.zig b/src/bun.js/bindings/static_export.zig index a3d47e56e..2a5189210 100644 --- a/src/bun.js/bindings/static_export.zig +++ b/src/bun.js/bindings/static_export.zig @@ -12,5 +12,3 @@ pub fn Decl(comptime this: *const @This()) std.builtin.Type.Declaration { pub fn wrappedName(comptime this: *const @This()) []const u8 { return comptime "wrap" ++ this.symbol_name; } - -pub const c_char = enum(u8) { _ }; diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index 3b8b8903e..3616e174d 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -1,7 +1,6 @@ const std = @import("std"); const is_bindgen: bool = std.meta.globalOption("bindgen", bool) orelse false; const StaticExport = @import("./bindings/static_export.zig"); -const c_char = StaticExport.c_char; const bun = @import("bun"); const string = bun.string; const Output = bun.Output; diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig index 85bc04f53..9ec142176 100644 --- a/src/bun.js/module_loader.zig +++ b/src/bun.js/module_loader.zig @@ -1,7 +1,6 @@ const std = @import("std"); const is_bindgen: bool = std.meta.globalOption("bindgen", bool) orelse false; const StaticExport = @import("./bindings/static_export.zig"); -const c_char = StaticExport.c_char; const bun = @import("bun"); const string = bun.string; const Output = bun.Output; diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 91215886d..e73c34b5e 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -2155,7 +2155,7 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { } defer { - if (comptime @hasField(SinkType, "done") and this.sink.done) { + if ((comptime @hasField(SinkType, "done")) and this.sink.done) { callframe.this().unprotect(); } } @@ -2216,8 +2216,10 @@ pub fn NewJSSink(comptime SinkType: type, comptime name_: []const u8) type { } defer { - if (comptime @hasField(SinkType, "done") and this.sink.done) { - callframe.this().unprotect(); + if (comptime @hasField(SinkType, "done")) { + if (this.sink.done) { + callframe.this().unprotect(); + } } } diff --git a/src/http_client_async.zig b/src/http_client_async.zig index c75883ad7..bf33e65fc 100644 --- a/src/http_client_async.zig +++ b/src/http_client_async.zig @@ -1083,7 +1083,8 @@ const os = std.os; pub fn hashHeaderName(name: string) u64 { var hasher = std.hash.Wyhash.init(0); var remain = name; - var buf: [hasher.buf.len]u8 = undefined; + + var buf: [@sizeOf(@TypeOf(hasher.buf))]u8 = undefined; while (remain.len > 0) { const end = @min(hasher.buf.len, remain.len); diff --git a/src/js_printer.zig b/src/js_printer.zig index 1b9ba9aa0..f809c6280 100644 --- a/src/js_printer.zig +++ b/src/js_printer.zig @@ -1510,7 +1510,7 @@ fn NewPrinter( // this only applies to template literal strings // but we print a template literal if there is a \n or a \r // which is often if the string is long and UTF-16 - if (comptime quote == '`') { + if (quote == '`') { const remain = text[i..]; if (remain.len > 1 and remain[0] < last_ascii and remain[0] > first_ascii and remain[0] != '$' and diff --git a/src/string_immutable.zig b/src/string_immutable.zig index 44d64dc49..887d819a1 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -24,7 +24,7 @@ pub inline fn contains(self: string, str: string) bool { } pub fn toUTF16Literal(comptime str: []const u8) []const u16 { - comptime { + return comptime brk: { comptime var output: [str.len]u16 = undefined; for (str, 0..) |c, i| { @@ -34,9 +34,8 @@ pub fn toUTF16Literal(comptime str: []const u8) []const u16 { const Static = struct { pub const literal: []const u16 = output[0..]; }; - - return Static.literal; - } + break :brk Static.literal; + }; } const OptionalUsize = std.meta.Int(.unsigned, @bitSizeOf(usize) - 1); |