diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-15 14:00:14 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-15 14:00:14 -0400 |
| commit | 964fc14656d3698a9a4e69afaf31da538184a213 (patch) | |
| tree | 1b9d2a115ac6be773c0ffa72074aac28d68e9006 /src/server/analysis.odin | |
| parent | 9608768c31b81c0fc8681df6c6b1872396b529a0 (diff) | |
Add go to type definition for named proc params
Diffstat (limited to 'src/server/analysis.odin')
| -rw-r--r-- | src/server/analysis.odin | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 170b477..295c4b6 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2257,6 +2257,28 @@ resolve_type_location_proc_param_name :: proc( return call_symbol, false } +// resolves the underlying location of type of the named param +resolve_location_proc_param_name_type :: proc( + ast_context: ^AstContext, + position_context: ^DocumentPositionContext, +) -> ( + call_symbol: Symbol, + ok: bool, +) { + ident := position_context.field_value.field.derived.(^ast.Ident) or_return + call := position_context.call.derived.(^ast.Call_Expr) or_return + call_symbol = resolve_type_expression(ast_context, call) or_return + + if value, ok := call_symbol.value.(SymbolProcedureValue); ok { + if arg_type, ok := get_proc_arg_type_from_name(value, ident.name); ok { + if symbol, ok := resolve_location_type_expression(ast_context, arg_type.type); ok { + return symbol, true + } + } + } + return call_symbol, false +} + resolve_location_comp_lit_field :: proc( ast_context: ^AstContext, position_context: ^DocumentPositionContext, |