Skip to content

Commit

Permalink
Fix cookie creation for trait struct in Kotlin (#729)
Browse files Browse the repository at this point in the history
Co-authored-by: Ellen Arteca <[email protected]>
  • Loading branch information
emarteca and Ellen Arteca authored Nov 14, 2024
1 parent 0650c74 commit ccde69e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: tool/src/kotlin/mod.rs
assertion_line: 2424
assertion_line: 2422
expression: result
---
package dev.gigapixel.somelib
Expand Down Expand Up @@ -168,8 +168,9 @@ internal class DiplomatTrait_TesterTrait_Wrapper internal constructor (
vtable.run_testEnumReturn_callback = testEnumReturn;
val native_wrapper = DiplomatTrait_TesterTrait_Wrapper_Native();
native_wrapper.vtable = vtable;
native_wrapper.data_ = DiplomatJVMRuntime.buildRustCookie(native_wrapper as Object);
return DiplomatTrait_TesterTrait_Wrapper(native_wrapper);
val ret_val = DiplomatTrait_TesterTrait_Wrapper(native_wrapper);
ret_val.nativeStruct.data_ = DiplomatJVMRuntime.buildRustCookie(ret_val as Object);
return ret_val;
}
}
}
5 changes: 3 additions & 2 deletions tool/templates/kotlin/Trait.kt.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ internal class DiplomatTrait_{{trait_name}}_Wrapper internal constructor (
{% endif -%}
val native_wrapper = DiplomatTrait_{{trait_name}}_Wrapper_Native();
native_wrapper.vtable = vtable;
native_wrapper.data_ = DiplomatJVMRuntime.buildRustCookie(native_wrapper as Object);
return DiplomatTrait_{{trait_name}}_Wrapper(native_wrapper);
val ret_val = DiplomatTrait_{{trait_name}}_Wrapper(native_wrapper);
ret_val.nativeStruct.data_ = DiplomatJVMRuntime.buildRustCookie(ret_val as Object);
return ret_val;
}
}
}
Expand Down

0 comments on commit ccde69e

Please sign in to comment.