Skip to content
Snippets Groups Projects
Commit 10f5747e authored by Cheng Shao's avatar Cheng Shao :beach:
Browse files

testsuite: test wasm backend JSFFI sync exports

This commit repurposes some existing JSFFI test cases to make them
cover JSFFI sync exports as well.

(cherry picked from commit b6ae908b)
(cherry picked from commit b7dce5cd)
parent 1ab92441
No related branches found
No related tags found
No related merge requests found
......@@ -10,17 +10,16 @@ import System.Mem
type BinOp a = a -> a -> a
foreign import javascript "wrapper"
foreign import javascript "wrapper sync"
js_from_hs :: BinOp Int -> IO JSVal
-- This must be safe since we intend to call back into Haskell again.
foreign import javascript safe "dynamic"
foreign import javascript unsafe "dynamic"
js_to_hs :: JSVal -> BinOp Int
foreign import javascript "wrapper"
js_mk_cont :: IO () -> IO JSVal
foreign export javascript "testDynExportFree"
foreign export javascript "testDynExportFree sync"
testDynExportFree :: Int -> Int -> Int -> IO ()
-- JSVal uses Weak# under the hood for garbage collection support,
......
......@@ -8,7 +8,7 @@ async function reallyGC() {
}
export default async (__exports) => {
await __exports.testDynExportFree(114, 514, 1919810);
__exports.testDynExportFree(114, 514, 1919810);
const cont = await __exports.testDynExportGC(114, 514, 1919810);
await reallyGC();
......
......@@ -45,7 +45,7 @@ textToJSString (Text (ByteArray ba#) (I# off#) (I# len#)) = unsafeDupablePerform
(# s1, mba# #) -> case copyByteArray# ba# off# mba# 0# len# s1 of
s2 -> keepAlive# mba# s2 $ unIO $ js_to_str (Ptr (mutableByteArrayContents# mba#)) $ I# len#
foreign export javascript "main"
foreign export javascript "main sync"
main :: IO ()
main :: IO ()
......
export default async (__exports) => {
await __exports.main();
export default (__exports) => {
__exports.main();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment