aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-15 10:53:09 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-15 10:53:09 -0400
commit156d75278e86764f3754c68121f4ed347e167a8b (patch)
tree1ad889bef189974d684339e80dc181597a6b4b9a /src/server
parentb5a7a087a5c91ef320eaabf5685604bda83eff68 (diff)
Move proc symbol procs to symbol file
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin39
-rw-r--r--src/server/completion.odin2
-rw-r--r--src/server/symbol.odin37
3 files changed, 39 insertions, 39 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 2219b98..182aed2 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -649,43 +649,6 @@ get_unnamed_arg_count :: proc(args: []^ast.Expr) -> int {
return total
}
-get_procedure_arg_count :: proc(v: SymbolProcedureValue) -> int {
- total := 0
- for proc_arg in v.arg_types {
- for name in proc_arg.names {
- total += 1
- }
- }
- return total
-}
-
-// Gets the call argument type at the specified index
-get_proc_call_argument_type :: proc(value: SymbolProcedureValue, parameter_index: int) -> (^ast.Field, bool) {
- index := 0
- for arg in value.arg_types {
- for name in arg.names {
- if index == parameter_index {
- return arg, true
- }
- index += 1
- }
- }
- return nil, false
-}
-
-get_proc_arg_type_from_name :: proc(v: SymbolProcedureValue, name: string) -> (^ast.Field, bool) {
- for arg in v.arg_types {
- for arg_name in arg.names {
- if ident, ok := arg_name.derived.(^ast.Ident); ok {
- if name == ident.name {
- return arg, true
- }
- }
- }
- }
- return nil, false
-}
-
/*
Figure out which function the call expression is using out of the list from proc group
*/
@@ -724,7 +687,7 @@ resolve_function_overload :: proc(ast_context: ^AstContext, group: ast.Proc_Grou
named := false
if !resolve_all_possibilities {
- arg_count := get_procedure_arg_count(procedure)
+ arg_count := get_proc_arg_count(procedure)
if call_expr != nil && arg_count < call_unnamed_arg_count {
break next_fn
}
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 1381967..59f6a6c 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -1171,7 +1171,7 @@ get_implicit_completion :: proc(
}
if proc_value, ok := symbol.value.(SymbolProcedureValue); ok {
- arg_type, arg_type_ok := get_proc_call_argument_type(proc_value, parameter_index)
+ arg_type, arg_type_ok := get_proc_arg_type_from_index(proc_value, parameter_index)
if !arg_type_ok {
return
}
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index 08a6788..58b7e77 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -525,6 +525,43 @@ expand_objc :: proc(ast_context: ^AstContext, b: ^SymbolStructValueBuilder) {
}
}
+get_proc_arg_count :: proc(v: SymbolProcedureValue) -> int {
+ total := 0
+ for proc_arg in v.arg_types {
+ for name in proc_arg.names {
+ total += 1
+ }
+ }
+ return total
+}
+
+// Gets the call argument type at the specified index
+get_proc_arg_type_from_index :: proc(value: SymbolProcedureValue, parameter_index: int) -> (^ast.Field, bool) {
+ index := 0
+ for arg in value.arg_types {
+ for name in arg.names {
+ if index == parameter_index {
+ return arg, true
+ }
+ index += 1
+ }
+ }
+ return nil, false
+}
+
+get_proc_arg_type_from_name :: proc(v: SymbolProcedureValue, name: string) -> (^ast.Field, bool) {
+ for arg in v.arg_types {
+ for arg_name in arg.names {
+ if ident, ok := arg_name.derived.(^ast.Ident); ok {
+ if name == ident.name {
+ return arg, true
+ }
+ }
+ }
+ }
+ return nil, false
+}
+
new_clone_symbol :: proc(data: Symbol, allocator := context.allocator) -> ^Symbol {
new_symbol := new(Symbol, allocator)
new_symbol^ = data