From 4a54aeebf54d3a9a422223e00a6f02dc62733b6b Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 23 Oct 2023 10:24:37 -0500 Subject: [PATCH] bugfix: incorrect symbol name for documented methods --- CHANGELOG | 6 ++++++ compiler/src/doc.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 84a8ca41..329b0f9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,12 +9,17 @@ Additions: - `switch` expressions. - `switch` can appear at the expression level, and uses `case X => value` to specify cases. +- `cbindgen` now supports passing functions as arguments. + - Internally uses dyncallback + - Only for OVM-wasm and Linux, for now. - Scoped values in interfaces. `X :: ...` is allowed in an interface now. - `#inject` works on interfaces. - Polling to the `io.Stream` functionality. - Used to query when data is read/write-able from a stream, for supported streams. - `io.stream_poll` - `misc.any_unwrap` to unwrap an `any` containing an optional. +- `json.decode_with_result` +- `json.decode_into` - When debugging, `/ 0` or `% 0` will trigger an exception to debug the error. Removals: @@ -29,6 +34,7 @@ Bugfixes: - `X.foo` would not work if `X` was a pointer to a union. - Captures by pointer would break if the value was a primitive whose address wasn't taken anywhere else. +- Symbol name reported by documentation generation was incorrect for some methods. diff --git a/compiler/src/doc.c b/compiler/src/doc.c index eff9e379..8d838c11 100644 --- a/compiler/src/doc.c +++ b/compiler/src/doc.c @@ -501,8 +501,18 @@ static void write_doc_methods(bh_buffer *buffer, Scope *method_scope) { case Ast_Kind_Overloaded_Function: binding = ((AstOverloadedFunction *) node)->original_binding_to_node; break; } + OnyxToken tmp_name_token; + tmp_name_token.pos = binding->token->pos; + tmp_name_token.text = method_scope->symbols[i].key; + tmp_name_token.length = strlen(tmp_name_token.text); + + OnyxToken *old_token = binding->token; + binding->token = &tmp_name_token; + method_count++; write_doc_procedure(buffer, binding, (AstNode *) node); + + binding->token = old_token; } *((u32 *) bh_pointer_add(buffer->data, count_patch)) = method_count; -- 2.25.1