aboutsummaryrefslogtreecommitdiff
path: root/src/logger.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/logger.zig')
-rw-r--r--src/logger.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/logger.zig b/src/logger.zig
index 5e4e92406..bd2c81c31 100644
--- a/src/logger.zig
+++ b/src/logger.zig
@@ -1144,6 +1144,13 @@ pub const Source = struct {
contents: string,
contents_is_recycled: bool = false,
+ pub fn isWebAssembly(this: *const Source) bool {
+ if (this.contents.len < 4) return false;
+
+ const bytes = @bitCast(u32, this.contents[0..4].*);
+ return bytes == 0x6d736100; // "\0asm"
+ }
+
pub const ErrorPosition = struct {
line_start: usize,
line_end: usize,