Add missing .switch_case_inline, .switch_case_inline_one cases (#699)
* Add missing .switch_case_inline, .switch_case_inline_one cases * Include inline semantic token Co-authored-by: Auguste Rame <19855629+SuperAuguste@users.noreply.github.com>
This commit is contained in:
parent
ac6353add7
commit
3833566790
@ -2828,7 +2828,9 @@ fn makeScopeInternal(allocator: std.mem.Allocator, context: ScopeContext, node_i
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.switch_case,
|
.switch_case,
|
||||||
|
.switch_case_inline,
|
||||||
.switch_case_one,
|
.switch_case_one,
|
||||||
|
.switch_case_inline_one,
|
||||||
.switch_range,
|
.switch_range,
|
||||||
=> {
|
=> {
|
||||||
return;
|
return;
|
||||||
|
@ -437,6 +437,8 @@ pub fn lastToken(tree: Ast, node: Ast.Node.Index) Ast.TokenIndex {
|
|||||||
.array_type,
|
.array_type,
|
||||||
.switch_case_one,
|
.switch_case_one,
|
||||||
.switch_case,
|
.switch_case,
|
||||||
|
.switch_case_inline_one,
|
||||||
|
.switch_case_inline,
|
||||||
.switch_range,
|
.switch_range,
|
||||||
=> n = datas[n].rhs,
|
=> n = datas[n].rhs,
|
||||||
|
|
||||||
|
@ -548,8 +548,10 @@ fn writeNodeInlayHint(builder: *Builder, arena: *std.heap.ArenaAllocator, store:
|
|||||||
|
|
||||||
.switch_case_one,
|
.switch_case_one,
|
||||||
.switch_case,
|
.switch_case,
|
||||||
|
.switch_case_inline_one,
|
||||||
|
.switch_case_inline,
|
||||||
=> {
|
=> {
|
||||||
const switch_case = if (tag == .switch_case) tree.switchCase(node) else tree.switchCaseOne(node);
|
const switch_case = if (tag == .switch_case or tag == .switch_case_inline) tree.switchCase(node) else tree.switchCaseOne(node);
|
||||||
|
|
||||||
try callWriteNodeInlayHint(allocator, .{ builder, arena, store, switch_case.ast.target_expr, range });
|
try callWriteNodeInlayHint(allocator, .{ builder, arena, store, switch_case.ast.target_expr, range });
|
||||||
},
|
},
|
||||||
|
@ -176,13 +176,17 @@ fn symbolReferencesInternal(
|
|||||||
try symbolReferencesInternal(builder, case, handle);
|
try symbolReferencesInternal(builder, case, handle);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.switch_case_one => {
|
.switch_case_one,
|
||||||
|
.switch_case_inline_one,
|
||||||
|
=> {
|
||||||
const case_one = tree.switchCaseOne(node);
|
const case_one = tree.switchCaseOne(node);
|
||||||
try symbolReferencesInternal(builder, case_one.ast.target_expr, handle);
|
try symbolReferencesInternal(builder, case_one.ast.target_expr, handle);
|
||||||
for (case_one.ast.values) |val|
|
for (case_one.ast.values) |val|
|
||||||
try symbolReferencesInternal(builder, val, handle);
|
try symbolReferencesInternal(builder, val, handle);
|
||||||
},
|
},
|
||||||
.switch_case => {
|
.switch_case,
|
||||||
|
.switch_case_inline,
|
||||||
|
=> {
|
||||||
const case = tree.switchCase(node);
|
const case = tree.switchCase(node);
|
||||||
try symbolReferencesInternal(builder, case.ast.target_expr, handle);
|
try symbolReferencesInternal(builder, case.ast.target_expr, handle);
|
||||||
for (case.ast.values) |val|
|
for (case.ast.values) |val|
|
||||||
|
@ -518,8 +518,11 @@ fn writeNodeTokens(builder: *Builder, maybe_node: ?Ast.Node.Index) WriteTokensEr
|
|||||||
},
|
},
|
||||||
.switch_case_one,
|
.switch_case_one,
|
||||||
.switch_case,
|
.switch_case,
|
||||||
|
.switch_case_inline_one,
|
||||||
|
.switch_case_inline,
|
||||||
=> {
|
=> {
|
||||||
const switch_case = if (tag == .switch_case) tree.switchCase(node) else tree.switchCaseOne(node);
|
const switch_case = if (tag == .switch_case or tag == .switch_case_inline) tree.switchCase(node) else tree.switchCaseOne(node);
|
||||||
|
try writeToken(builder, switch_case.inline_token, .keyword);
|
||||||
for (switch_case.ast.values) |item_node| try callWriteNodeTokens(allocator, .{ builder, item_node });
|
for (switch_case.ast.values) |item_node| try callWriteNodeTokens(allocator, .{ builder, item_node });
|
||||||
// check it it's 'else'
|
// check it it's 'else'
|
||||||
if (switch_case.ast.values.len == 0) try writeToken(builder, switch_case.ast.arrow_token - 1, .keyword);
|
if (switch_case.ast.values.len == 0) try writeToken(builder, switch_case.ast.arrow_token - 1, .keyword);
|
||||||
|
Loading…
Reference in New Issue
Block a user