From 156cd062679c3062138a0e822dc10231dada9825 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:57:59 -0400 Subject: [PATCH] Update to moonc v0.1.20240809+5c355ddde Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> --- README.md | 4 ++-- examples/arrays/all-three.mbt | 8 ++++---- moon.mod.json | 2 +- pdk/host/memory.mbt | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index da5d072..d77a980 100644 --- a/README.md +++ b/README.md @@ -542,8 +542,8 @@ The code has been updated to support compiler: ```bash $ moon version --all -moon 0.1.20240807 (235e4bc 2024-08-07) ~/.moon/bin/moon -moonc v0.1.20240807+41236f720 ~/.moon/bin/moonc +moon 0.1.20240809 (e6f8c24 2024-08-09) ~/.moon/bin/moon +moonc v0.1.20240809+5c355ddde ~/.moon/bin/moonc moonrun 0.1.20240716 (08bce9c 2024-07-16) ~/.moon/bin/moonrun ``` diff --git a/examples/arrays/all-three.mbt b/examples/arrays/all-three.mbt index b11e217..ee9185f 100644 --- a/examples/arrays/all-three.mbt +++ b/examples/arrays/all-three.mbt @@ -15,10 +15,10 @@ pub impl @jsonutil.ToJson for AllThree with to_json(self) { } /// `process_all_three` processes all three array types. -pub fn process_all_three(in : AllThree) -> AllThree { +pub fn process_all_three(all3 : AllThree) -> AllThree { { - ints: process_ints(in.ints), - floats: process_floats(in.floats), - strings: process_strings(in.strings), + ints: process_ints(all3.ints), + floats: process_floats(all3.floats), + strings: process_strings(all3.strings), } } diff --git a/moon.mod.json b/moon.mod.json index de84fdc..96eb531 100644 --- a/moon.mod.json +++ b/moon.mod.json @@ -1,6 +1,6 @@ { "name": "extism/moonbit-pdk", - "version": "0.32.0", + "version": "0.33.0", "deps": { "gmlewis/jsonutil": "0.22.0" }, diff --git a/pdk/host/memory.mbt b/pdk/host/memory.mbt index f8a0589..6392931 100644 --- a/pdk/host/memory.mbt +++ b/pdk/host/memory.mbt @@ -60,9 +60,10 @@ pub fn to_string(self : Memory) -> String { /// to a MoonBit Int. pub fn to_int(self : Memory) -> Int { let bytes = self.to_bytes() - bytes[0].to_int() + bytes[1].to_int().lsl(8) + bytes[2].to_int().lsl(16) + bytes[3] - .to_int() - .lsl(24) + bytes[0].to_int() + + bytes[1].to_int().lsl(8) + + bytes[2].to_int().lsl(16) + + bytes[3].to_int().lsl(24) } /// `to_bytes` reads the (unprocessed) bytes residing in the host memory