From 2559f5c6fd52d33808d9bd2670127ad33d35296e Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Fri, 25 Sep 2020 15:23:03 -0600 Subject: [PATCH] semantic_tokens: Don't @bitCast a flags structure to an integer No idea why this isn't working, but it was sending the wrong thing. --- src/semantic_tokens.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/semantic_tokens.zig b/src/semantic_tokens.zig index 59b4ecf..6a74907 100644 --- a/src/semantic_tokens.zig +++ b/src/semantic_tokens.zig @@ -32,7 +32,16 @@ const TokenModifiers = packed struct { generic: bool = false, fn toInt(self: TokenModifiers) u32 { - return @as(u32, @bitCast(u4, self)); + var res: u32 = 0; + if (self.definition) + res |= 1 << 0; + if (self.@"async") + res |= 1 << 1; + if (self.documentation) + res |= 1 << 2; + if (self.generic) + res |= 1 << 3; + return res; } inline fn set(self: *TokenModifiers, comptime field: []const u8) void {