Skip to content

Commit 9e51031

Browse files
fix(jco): require utf8 decoder for flat string lifts
This commit fixes a bug by which strings loaded from memory during async returns did not have the shared decoder (created via intrinsic) present. This commit stops short of reworking the dependency resolution code to be closer to the site of usage (i.e. in the various `*Intrinsic` enum members), but that can/should be done in the future.
1 parent e0a6308 commit 9e51031

File tree

1 file changed

+16
-0
lines changed
  • crates/js-component-bindgen/src/intrinsics

1 file changed

+16
-0
lines changed

crates/js-component-bindgen/src/intrinsics/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,22 @@ pub fn render_intrinsics(args: RenderIntrinsicsArgs) -> Source {
371371
]);
372372
}
373373

374+
if args
375+
.intrinsics
376+
.contains(&Intrinsic::Lift(LiftIntrinsic::LiftFlatStringUtf8))
377+
{
378+
args.intrinsics
379+
.insert(Intrinsic::String(StringIntrinsic::Utf8Decoder));
380+
}
381+
382+
if args
383+
.intrinsics
384+
.contains(&Intrinsic::Lift(LiftIntrinsic::LiftFlatStringUtf16))
385+
{
386+
args.intrinsics
387+
.insert(Intrinsic::String(StringIntrinsic::Utf16Decoder));
388+
}
389+
374390
if args
375391
.intrinsics
376392
.contains(&Intrinsic::AsyncTask(AsyncTaskIntrinsic::StartCurrentTask))

0 commit comments

Comments
 (0)