Skip to content

Commit 2d5bd00

Browse files
fix(moonbit): clean up async metadata and tests
1 parent 9a16638 commit 2d5bd00

15 files changed

Lines changed: 208 additions & 80 deletions

File tree

crates/moonbit/src/async_support.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ impl AsyncSupport {
8282
self.is_async = true;
8383
}
8484

85+
pub(crate) fn uses_runtime(&self) -> bool {
86+
self.is_async || !self.futures.is_empty()
87+
}
88+
8589
pub(crate) fn emit_utils(&self, files: &mut Files) {
86-
if !self.is_async && self.futures.is_empty() {
90+
if !self.uses_runtime() {
8791
return;
8892
}
8993

crates/moonbit/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ impl MoonBit {
155155
fn write_moon_pkg(&self, moon_pkg: &mut Source, imports: Option<&Imports>, link: bool) {
156156
// Disable warning for invalid inline wasm
157157
moon_pkg.push_str("{\n\"warn-list\": \"-44\"");
158+
if self.async_support.uses_runtime() {
159+
moon_pkg.push_str(",\n\"supported-targets\": \"+wasm\"");
160+
}
158161
// Dependencies
159162
if let Some(imports) = imports {
160163
moon_pkg.push_str(",\n\"import\": [\n");

tests/runtime-async/async/moonbit-stream-write/test.mbt

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/runtime-async/async/moonbit-stream-write/test.rs

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/runtime-async/async/moonbit-stream-write/test.wit

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/runtime-async/async/moonbit-future-write/runner.mbt renamed to tests/runtime-async/async/moonbit/future-write/runner.mbt

File renamed without changes.

tests/runtime-async/async/moonbit-future-write/runner.rs renamed to tests/runtime-async/async/moonbit/future-write/runner.rs

File renamed without changes.

tests/runtime-async/async/moonbit-future-write/test.mbt renamed to tests/runtime-async/async/moonbit/future-write/test.mbt

File renamed without changes.

tests/runtime-async/async/moonbit-future-write/test.rs renamed to tests/runtime-async/async/moonbit/future-write/test.rs

File renamed without changes.

tests/runtime-async/async/moonbit-future-write/test.wit renamed to tests/runtime-async/async/moonbit/future-write/test.wit

File renamed without changes.

0 commit comments

Comments
 (0)