diff options
author | 2021-07-26 16:39:40 -0700 | |
---|---|---|
committer | 2021-07-26 16:39:40 -0700 | |
commit | a7214ab61c42f1454a8e17c633085f12ed6bef5a (patch) | |
tree | 7da3047f2d6cbf2b1e19fd670d0d40edce5e7192 /src/global.zig | |
parent | 796a9854b4a698b309a6e7a4c040047558858da6 (diff) | |
download | bun-a7214ab61c42f1454a8e17c633085f12ed6bef5a.tar.gz bun-a7214ab61c42f1454a8e17c633085f12ed6bef5a.tar.zst bun-a7214ab61c42f1454a8e17c633085f12ed6bef5a.zip |
cool
Diffstat (limited to 'src/global.zig')
-rw-r--r-- | src/global.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/global.zig b/src/global.zig index 16a515086..14a919872 100644 --- a/src/global.zig +++ b/src/global.zig @@ -9,16 +9,16 @@ pub const FeatureFlags = @import("feature_flags.zig"); pub const Output = struct { threadlocal var source: Source = undefined; pub const Source = struct { - const StreamType = { + pub const StreamType: type = brk: { if (isWasm) { - return std.io.FixedBufferStream([]u8); + break :brk std.io.FixedBufferStream([]u8); } else { - return std.fs.File; + break :brk std.fs.File; // var stdout = std.io.getStdOut(); // return @TypeOf(std.io.bufferedWriter(stdout.writer())); } }; - const BufferedStream = std.io.BufferedWriter(4096, @typeInfo(@TypeOf(Source.StreamType.writer)).Fn.return_type.?); + pub const BufferedStream: type = std.io.BufferedWriter(4096, @typeInfo(std.meta.declarationInfo(StreamType, "writer").data.Fn.fn_type).Fn.return_type.?); buffered_stream: BufferedStream, buffered_error_stream: BufferedStream, @@ -56,11 +56,13 @@ pub const Output = struct { enable_buffering = false; } - pub fn errorWriter() @typeInfo(@TypeOf(Source.StreamType.writer)).Fn.return_type.? { + pub const WriterType: type = @typeInfo(std.meta.declarationInfo(Source.StreamType, "writer").data.Fn.fn_type).Fn.return_type.?; + + pub fn errorWriter() WriterType { return source.error_stream.writer(); } - pub fn writer() @typeInfo(@TypeOf(Source.StreamType.writer)).Fn.return_type.? { + pub fn writer() WriterType { return source.stream.writer(); } |