Skip to content

Commit

Permalink
Add signature for diverging function returns
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielGavin committed Nov 16, 2024
1 parent 1e68788 commit 1791c96
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/server/analysis.odin
Original file line number Diff line number Diff line change
Expand Up @@ -2329,6 +2329,7 @@ make_symbol_procedure_from_ast :: proc(
arg_types = arg_types[:],
orig_arg_types = arg_types[:],
generic = v.generic,
diverging = v.diverging,
}

if _, ok := common.get_attribute_objc_name(attributes); ok {
Expand Down
1 change: 1 addition & 0 deletions src/server/collector.odin
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ collect_procedure_fields :: proc(
arg_types = args[:],
orig_arg_types = args[:],
generic = is_procedure_generic(proc_type),
diverging = proc_type.diverging,
}

return value
Expand Down
2 changes: 2 additions & 0 deletions src/server/signature.odin
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ build_procedure_symbol_signature :: proc(symbol: ^Symbol) {
if len(value.orig_return_types) > 1 {
strings.write_string(&builder, ")")
}
} else if value.diverging {
strings.write_string(&builder, " -> !")
}
symbol.signature = strings.to_string(builder)
} else if value, ok := symbol.value.(SymbolAggregateValue); ok {
Expand Down
1 change: 1 addition & 0 deletions src/server/symbol.odin
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SymbolProcedureValue :: struct {
orig_return_types: []^ast.Field, //When generics have overloaded the types, we store the original version here.
orig_arg_types: []^ast.Field, //When generics have overloaded the types, we store the original version here.
generic: bool,
diverging: bool,
}

SymbolProcedureGroupValue :: struct {
Expand Down

0 comments on commit 1791c96

Please sign in to comment.