From 645c1872e6581074bc559fb72514eb8e96040fb9 Mon Sep 17 00:00:00 2001 From: Tyler K Date: Mon, 19 Aug 2024 15:26:00 -0700 Subject: [PATCH] JS: Fixing wrong primitive slice constructor (#646) --- feature_tests/js/api/Float64Vec.mjs | 4 ++-- tool/src/js/type_generation/converter.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/feature_tests/js/api/Float64Vec.mjs b/feature_tests/js/api/Float64Vec.mjs index 7c61ca00b..6f17fc4aa 100644 --- a/feature_tests/js/api/Float64Vec.mjs +++ b/feature_tests/js/api/Float64Vec.mjs @@ -138,7 +138,7 @@ export class Float64Vec { const result = wasm.Float64Vec_as_slice(diplomatReceive.buffer, this.ffiValue); try { - return new diplomatRuntime.DiplomatPrimitiveSlice.getSlice(wasm, diplomatReceive.buffer, "f64", aEdges); + return new diplomatRuntime.DiplomatSlicePrimitive.getSlice(wasm, diplomatReceive.buffer, "f64", aEdges); } finally { @@ -193,7 +193,7 @@ export class Float64Vec { const result = wasm.Float64Vec_borrow(diplomatReceive.buffer, this.ffiValue); try { - return new diplomatRuntime.DiplomatPrimitiveSlice.getSlice(wasm, diplomatReceive.buffer, "f64", aEdges); + return new diplomatRuntime.DiplomatSlicePrimitive.getSlice(wasm, diplomatReceive.buffer, "f64", aEdges); } finally { diff --git a/tool/src/js/type_generation/converter.rs b/tool/src/js/type_generation/converter.rs index 0692d23e9..32490482d 100644 --- a/tool/src/js/type_generation/converter.rs +++ b/tool/src/js/type_generation/converter.rs @@ -203,7 +203,7 @@ impl<'jsctx, 'tcx> TyGenContext<'jsctx, 'tcx> { // Slices are always returned to us by way of pointers, so we assume that we can just access DiplomatReceiveBuf's helper functions: match slice { hir::Slice::Primitive(_, primitive_type) => format!( - r#"new diplomatRuntime.DiplomatPrimitiveSlice.getSlice(wasm, {variable_name}, "{}", {edges})"#, + r#"new diplomatRuntime.DiplomatSlicePrimitive.getSlice(wasm, {variable_name}, "{}", {edges})"#, self.formatter.fmt_primitive_list_view(primitive_type) ) .into(),