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.
This commit is contained in:
Tadeo Kondrak 2020-09-25 15:23:03 -06:00
parent 3b1d425174
commit 2559f5c6fd
No known key found for this signature in database
GPG Key ID: D41E092CA43F1D8B

View File

@ -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 {