aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/analysis.odin1
-rw-r--r--src/server/collector.odin8
-rw-r--r--src/server/documentation.odin35
-rw-r--r--src/server/symbol.odin1
4 files changed, 45 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 8b4e3f9..53f42c2 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2802,6 +2802,7 @@ make_symbol_procedure_from_ast :: proc(
diverging = v.diverging,
calling_convention = v.calling_convention,
tags = v.tags,
+ attributes = attributes,
}
if _, ok := get_attribute_objc_name(attributes); ok {
diff --git a/src/server/collector.odin b/src/server/collector.odin
index fc4f603..ffff688 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -87,6 +87,7 @@ collect_procedure_fields :: proc(
) -> SymbolProcedureValue {
returns := make([dynamic]^ast.Field, 0, collection.allocator)
args := make([dynamic]^ast.Field, 0, collection.allocator)
+ attrs := make([dynamic]^ast.Attribute, 0, collection.allocator)
if return_list != nil {
for ret in return_list.list {
@@ -104,6 +105,12 @@ collect_procedure_fields :: proc(
}
}
+ for attr in attributes {
+ cloned := cast(^ast.Attribute)clone_type(attr, collection.allocator, &collection.unique_strings)
+ append(&attrs, cloned)
+ }
+
+
value := SymbolProcedureValue {
return_types = returns[:],
orig_return_types = returns[:],
@@ -113,6 +120,7 @@ collect_procedure_fields :: proc(
diverging = proc_type.diverging,
calling_convention = clone_calling_convention(proc_type.calling_convention, collection.allocator, &collection.unique_strings),
tags = proc_type.tags,
+ attributes = attrs[:],
}
return value
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 1698d61..301d7e1 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -643,6 +643,41 @@ concatenate_symbol_information :: proc {
}
concatenate_raw_symbol_information :: proc(ast_context: ^AstContext, symbol: Symbol) -> string {
+ if v, ok := symbol.value.(SymbolProcedureValue); ok {
+ pkg := path.base(symbol.pkg, false, context.temp_allocator)
+ sb := strings.builder_make(context.temp_allocator)
+ if symbol.comment != "" {
+ fmt.sbprintf(&sb, "%s\n", symbol.comment)
+ }
+ for attribute in v.attributes {
+ if len(attribute.elems) == 0 {
+ strings.write_string(&sb, "@()\n")
+ continue
+ }
+ strings.write_string(&sb, "@(")
+ for elem, i in attribute.elems {
+ if directive, ok := elem.derived.(^ast.Field_Value); ok {
+ build_string_node(directive.field, &sb, false)
+ strings.write_string(&sb, "=")
+ build_string_node(directive.value, &sb, false)
+ } else {
+ build_string_node(elem, &sb, false)
+ }
+ if i != len(attribute.elems) - 1 {
+ strings.write_string(&sb, ", ")
+ }
+
+ }
+ strings.write_string(&sb, ")\n")
+ }
+
+ fmt.sbprintf(&sb, "%v.%v", pkg, symbol.name)
+ if symbol.signature != "" {
+ fmt.sbprintf(&sb, ": %v", symbol.signature)
+ }
+ return strings.to_string(sb)
+ }
+
return concatenate_raw_string_information(
ast_context,
symbol.pkg,
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index 3cff104..141d4d4 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -59,6 +59,7 @@ SymbolProcedureValue :: struct {
diverging: bool,
calling_convention: ast.Proc_Calling_Convention,
tags: ast.Proc_Tags,
+ attributes: []^ast.Attribute,
}
SymbolProcedureGroupValue :: struct {