Merge pull request #701 from Techatrix/semantic-token-fix

Correctly handle var decl without equal sign
This commit is contained in:
Techatrix 2022-10-09 03:37:33 +02:00 committed by GitHub
commit f204f3467e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -354,7 +354,9 @@ fn writeNodeTokens(builder: *Builder, maybe_node: ?Ast.Node.Index) WriteTokensEr
} else {
try writeTokenMod(builder, var_decl.ast.mut_token + 1, .variable, .{ .declaration = true });
}
try writeToken(builder, var_decl.ast.mut_token + 2, .operator);
if (token_tags[var_decl.ast.mut_token + 2] == .equal) {
try writeToken(builder, var_decl.ast.mut_token + 2, .operator);
}
try callWriteNodeTokens(allocator, .{ builder, var_decl.ast.type_node });
try callWriteNodeTokens(allocator, .{ builder, var_decl.ast.align_node });