bugfix: incorrect symbol name for documented methods
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 23 Oct 2023 15:24:37 +0000 (10:24 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 23 Oct 2023 15:24:37 +0000 (10:24 -0500)
CHANGELOG
compiler/src/doc.c

index 84a8ca41ecd0572a6d477eca90f6e579d01652ee..329b0f9f5baedf767416a766f027e7f12870f1f3 100644 (file)
--- 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.
 
 
 
index eff9e379ae90f2a61afad51a65f0a043bec660a2..8d838c11094c0075446f86de7d3f7f42240436ea 100644 (file)
@@ -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;