update handling of some node tags in makeScopeInternal

This commit is contained in:
Techatrix 2023-03-20 19:31:23 +01:00 committed by Lee Cannon
parent 775c38f5f5
commit 419527a40d

View File

@ -1714,7 +1714,7 @@ pub fn getPositionContext(
// Early exits. // Early exits.
if (tok.loc.start > new_index) break; if (tok.loc.start > new_index) break;
if (tok.loc.start == new_index) { if (tok.loc.start == new_index) {
// Tie-breaking, the curosr is exactly between two tokens, and // Tie-breaking, the cursor is exactly between two tokens, and
// `tok` is the latter of the two. // `tok` is the latter of the two.
if (tok.tag != .identifier) break; if (tok.tag != .identifier) break;
} }
@ -2664,9 +2664,6 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
// Visit the function body // Visit the function body
try makeScopeInternal(context, data[node_idx].rhs); try makeScopeInternal(context, data[node_idx].rhs);
}, },
.test_decl => {
return try makeScopeInternal(context, data[node_idx].rhs);
},
.block, .block,
.block_semicolon, .block_semicolon,
.block_two, .block_two,
@ -2956,14 +2953,6 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
try makeScopeInternal(context, switch_case.ast.target_expr); try makeScopeInternal(context, switch_case.ast.target_expr);
} }
}, },
.switch_case,
.switch_case_inline,
.switch_case_one,
.switch_case_inline_one,
.switch_range,
=> {
return;
},
.global_var_decl, .global_var_decl,
.local_var_decl, .local_var_decl,
.aligned_var_decl, .aligned_var_decl,
@ -3102,6 +3091,10 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
try makeScopeInternal(context, expr); try makeScopeInternal(context, expr);
}, },
.switch_case,
.switch_case_inline,
.switch_case_one,
.switch_case_inline_one,
.@"asm", .@"asm",
.asm_simple, .asm_simple,
.asm_output, .asm_output,
@ -3111,14 +3104,18 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
.string_literal, .string_literal,
.enum_literal, .enum_literal,
.identifier, .identifier,
.anyframe_type,
.anyframe_literal, .anyframe_literal,
.char_literal, .char_literal,
.number_literal, .number_literal,
.unreachable_literal, .unreachable_literal,
.@"continue", .@"continue",
=> {}, => {},
.@"break", .@"defer" => {
.test_decl,
.@"break",
.@"defer",
.anyframe_type,
=> {
try makeScopeInternal(context, data[node_idx].rhs); try makeScopeInternal(context, data[node_idx].rhs);
}, },
@ -3195,6 +3192,7 @@ fn makeScopeInternal(context: ScopeContext, node_idx: Ast.Node.Index) error{OutO
.array_access, .array_access,
.error_union, .error_union,
.for_range, .for_range,
.switch_range,
=> { => {
try makeScopeInternal(context, data[node_idx].lhs); try makeScopeInternal(context, data[node_idx].lhs);
try makeScopeInternal(context, data[node_idx].rhs); try makeScopeInternal(context, data[node_idx].rhs);