-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: treat dynamic imports as side-effectful (#1172)
* fix: treat dynamic imports as side-effectful * fix dyn import tests
- Loading branch information
1 parent
bfe7554
commit bc9e2f6
Showing
4 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Demonstrate dynamic `import()` semantics | ||
|
||
$ . ./setup.sh | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.9) | ||
> (using melange 0.1) | ||
> EOF | ||
$ cat > dune <<EOF | ||
> (melange.emit | ||
> (target out) | ||
> (preprocess (pps melange.ppx)) | ||
> (emit_stdlib false)) | ||
> EOF | ||
$ cat > x.ml <<EOF | ||
> module type int = module type of Int | ||
> let () = | ||
> let _x = Js.import ((module Stdlib.Int) : (module int)) in | ||
> () | ||
> EOF | ||
$ cat > y.ml <<EOF | ||
> let x = 1 | ||
> EOF | ||
$ dune build @melange | ||
$ cat _build/default/out/x.js | ||
// Generated by Melange | ||
'use strict'; | ||
import("melange/int.js"); | ||
/* Not a pure module */ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters