Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix js str decode #727

Merged
merged 1 commit into from
Nov 9, 2024
Merged

Conversation

jcrist1
Copy link
Contributor

@jcrist1 jcrist1 commented Nov 8, 2024

I uncovered another bug in the js backend, while I was working on a library using diplomat.
The bug is that methods returning string slices return DiplomatStrSlice class instead of a js string. It's the same issue that affected #722 , and the fix is the same.

@jcrist1 jcrist1 marked this pull request as ready for review November 8, 2024 22:21
@@ -1,18 +1,23 @@
import test from 'ava';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my editor reformatted some stuff. I hope this is okay.

@@ -257,7 +257,7 @@ impl<'jsctx, 'tcx> TyGenContext<'jsctx, 'tcx> {
// We basically iterate through and read each string into the array.
// TODO: Need a test for this.
format!(
r#"new diplomatRuntime.DiplomatSliceStrings(wasm, {variable_name}, "string{}", {edges})"#,
r#"new diplomatRuntime.DiplomatSliceStrings(wasm, {variable_name}, "string{}", {edges}).getValue()"#,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as i could see there isn't actually a DiplomatSliceStrings in the runtime, but I thought consistency would be a good guide

@Manishearth Manishearth merged commit 6ccac64 into rust-diplomat:main Nov 9, 2024
20 checks passed
@jcrist1 jcrist1 deleted the fix-js-string-decode branch November 9, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants