Kotlin: fix for generating KDocs for Function Pointers
This change updates the template to:
- Include all arguments in the documentation by removing the list
slicing.
- Move the KDoc generation inside the interface to correctly document
the callback function.
Change-Id: Ia9892b93186ef5f6b4366cc228303d57e107157d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/275014
Reviewed-by: Jim Blackler <jimblackler@google.com>
Commit-Queue: Mridul Goyal <mridulgoyal@google.com>
diff --git a/generator/templates/art/api_kotlin_function_pointer.kt b/generator/templates/art/api_kotlin_function_pointer.kt
index 2d516d8..c87d322 100644
--- a/generator/templates/art/api_kotlin_function_pointer.kt
+++ b/generator/templates/art/api_kotlin_function_pointer.kt
@@ -36,12 +36,11 @@
{% set main_doc = funtion_pointer_info.doc if funtion_pointer_info else "" %}
{% set arg_docs_map = funtion_pointer_info.args if funtion_pointer_info else {} %}
-{% set function_pointer_args = function_pointer.arguments[:-1] | list %}
-{% if check_if_doc_present(main_doc, "", arg_docs_map, function_pointer_args) == 'True' %}
- {{ generate_kdoc(main_doc, return_str, arg_docs_map, function_pointer_args , line_wrap_prefix = "\n * ") }}
-
-{%- endif %}
+{% set function_pointer_args = function_pointer.arguments | list %}
public fun interface {{ function_pointer.name.CamelCase() }} {
+ {% if check_if_doc_present(main_doc, "", arg_docs_map, function_pointer_args) == 'True' %}
+ {{ generate_kdoc(main_doc, return_str, arg_docs_map, function_pointer_args , indent_prefix = " ",line_wrap_prefix = "\n * ") }}
+ {%- endif %}
@Suppress("INAPPLICABLE_JVM_NAME") //* Required for @JvmName on global function.
@JvmName("{{ callbackName }}") //* Required to access Inline Value Class parameters via JNI.
public fun {{ callbackName }}(