Fixed infinite loop when analyzing variable declarations like const A = A; for semantic token highlighting

This commit is contained in:
Alexandros Naskos 2020-11-15 20:37:00 +02:00
parent 7ac3740c64
commit 0bf9602d7b
No known key found for this signature in database
GPG Key ID: 02BF2E72B0EA32D2

View File

@ -569,7 +569,13 @@ pub fn resolveTypeOfNodeInternal(
if (try lookupSymbolGlobal(store, arena, handle, handle.tree.getNodeSource(node), handle.tree.token_locs[node.firstToken()].start)) |child| {
switch (child.decl.*) {
.ast_node => |n| if (n == node) return null,
.ast_node => |n| {
if (n == node) return null;
if (n.castTag(.VarDecl)) |var_decl| {
if (var_decl.getInitNode()) |init_node|
if (init_node == node) return null;
}
},
else => {},
}
return try child.resolveType(store, arena, bound_type_params);