diff --git a/jscomp/core/js_dump.ml b/jscomp/core/js_dump.ml index bee935b73e..7e95279b02 100644 --- a/jscomp/core/js_dump.ml +++ b/jscomp/core/js_dump.ml @@ -171,6 +171,7 @@ let exp_need_paren (e : J.expression) = | Raw_js_code (_, Exp) | Fun _ | Raw_js_function _ + | Caml_block (_,_,_, (Blk_record _ | Blk_module _)) | Object _ -> true | Raw_js_code (_,Stmt) | Length _ diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index 40eef0588e..507c92eab4 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -312,6 +312,7 @@ build test/gpr_3877_test.cmi test/gpr_3877_test.cmj : cc test/gpr_3877_test.ml | build test/gpr_3895_test.cmi test/gpr_3895_test.cmj : cc test/gpr_3895_test.ml | $stdlib build test/gpr_3897_test.cmi test/gpr_3897_test.cmj : cc test/gpr_3897_test.ml | $stdlib build test/gpr_3931_test.cmi test/gpr_3931_test.cmj : cc test/gpr_3931_test.ml | $stdlib +build test/gpr_3980_test.cmi test/gpr_3980_test.cmj : cc test/gpr_3980_test.ml | $stdlib build test/gpr_405_test.cmj : cc_cmi test/gpr_405_test.ml | test/gpr_405_test.cmi $stdlib build test/gpr_405_test.cmi : cc test/gpr_405_test.mli | $stdlib build test/gpr_441.cmi test/gpr_441.cmj : cc test/gpr_441.ml | $stdlib diff --git a/jscomp/test/gpr_3980_test.js b/jscomp/test/gpr_3980_test.js new file mode 100644 index 0000000000..dcd6cda023 --- /dev/null +++ b/jscomp/test/gpr_3980_test.js @@ -0,0 +1,48 @@ +'use strict'; + +var Js_math = require("../../lib/js/js_math.js"); +var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js"); + +var match = 1; + +if (match !== undefined) { + if (match !== 1) { + throw [ + Caml_builtin_exceptions.assert_failure, + /* tuple */[ + "gpr_3980_test.ml", + 16, + 10 + ] + ]; + } + var match$1 = (1); + if (match$1 !== 1) { + if (match$1 !== 2) { + throw [ + Caml_builtin_exceptions.assert_failure, + /* tuple */[ + "gpr_3980_test.ml", + 14, + 12 + ] + ]; + } + ({ + name: "bye", + age: Js_math.floor(1) + }); + } + +} else { + throw [ + Caml_builtin_exceptions.assert_failure, + /* tuple */[ + "gpr_3980_test.ml", + 16, + 10 + ] + ]; +} + +/* Not a pure module */ diff --git a/jscomp/test/gpr_3980_test.ml b/jscomp/test/gpr_3980_test.ml new file mode 100644 index 0000000000..f7683bd706 --- /dev/null +++ b/jscomp/test/gpr_3980_test.ml @@ -0,0 +1,16 @@ +type student = { + name: string; + age: int; +} +let _ = + match (Some 1) with + | Some 1 -> + (match [%raw "1"] with + | 1 -> {name = "hi"; age = 1} + | 2 -> { + name = "bye"; + age = Js.Math.floor 1. + } + | _ -> assert false + ) + | _ -> assert false \ No newline at end of file diff --git a/lib/4.06.1/bsb.ml b/lib/4.06.1/bsb.ml index 7ed67b8359..5f3f71d69a 100644 --- a/lib/4.06.1/bsb.ml +++ b/lib/4.06.1/bsb.ml @@ -14162,14 +14162,14 @@ end = struct #1 "bsb_templates.ml" (* This file has been generated by ocp-ocamlres *) let root = OCamlRes.Res.([ - Dir ("basic", [ - Dir ("src", [ - File ("demo.ml", + Dir ("basic", [ + Dir ("src", [ + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - Dir (".vscode", [ - File ("tasks.json", + Dir (".vscode", [ + File ("tasks.json", "{\n\ \ \"version\": \"${bsb:proj-version}\",\n\ \ \"command\": \"npm\",\n\ @@ -14208,7 +14208,7 @@ let root = OCamlRes.Res.([ \ ]\n\ \ }\n\ }")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14229,7 +14229,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14247,7 +14247,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14274,7 +14274,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14291,13 +14291,13 @@ let root = OCamlRes.Res.([ \n\ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically")]) ; - Dir ("basic-reason", [ - Dir ("src", [ - File ("Demo.re", + Dir ("basic-reason", [ + Dir ("src", [ + File ("Demo.re", "Js.log(\"Hello, BuckleScript and Reason!\");\n\ ")]) ; - Dir (".vscode", [ - File ("tasks.json", + Dir (".vscode", [ + File ("tasks.json", "{\n\ \ \"version\": \"${bsb:proj-version}\",\n\ \ \"command\": \"npm\",\n\ @@ -14344,7 +14344,7 @@ let root = OCamlRes.Res.([ \ }\n\ \ }\n\ ")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14367,7 +14367,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14386,7 +14386,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ @@ -14394,7 +14394,7 @@ let root = OCamlRes.Res.([ /lib/bs/\n\ /node_modules/\n\ ") ; - File ("README.md", + File ("README.md", "# Basic Reason Template\n\ \n\ Hello! This project allows you to quickly get started with Reason and BuckleScript. If you wanted a more sophisticated version, try the `react` template (`bsb -theme react -init .`).\n\ @@ -14414,9 +14414,9 @@ let root = OCamlRes.Res.([ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically\n\ ")]) ; - Dir ("generator", [ - Dir ("src", [ - File ("test.cpp.ml", + Dir ("generator", [ + Dir ("src", [ + File ("test.cpp.ml", "\n\ (* \n\ #define FS_VAL(name,ty) external name : ty = \"\" [@@bs.module \"fs\"]\n\ @@ -14427,11 +14427,11 @@ let root = OCamlRes.Res.([ \n\ \n\ \ let ocaml = OCAML") ; - File ("demo.ml", + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14450,7 +14450,7 @@ let root = OCamlRes.Res.([ \ \"bs-dependencies\" : [\n\ \ ]\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14468,7 +14468,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14495,7 +14495,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14512,9 +14512,9 @@ let root = OCamlRes.Res.([ \n\ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically")]) ; - Dir ("minimal", [ - Dir ("src", [ File ("main.ml", "")]) ; - File ("bsconfig.json", + Dir ("minimal", [ + Dir ("src", [ File ("main.ml", "")]) ; + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"sources\": {\n\ @@ -14522,7 +14522,7 @@ let root = OCamlRes.Res.([ \ \"subdirs\": true\n\ \ }\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14540,23 +14540,23 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ npm-debug.log\n\ /lib/bs/\n\ /node_modules/") ; - File ("README.md", + File ("README.md", "\n\ \ # ${bsb:name}")]) ; - Dir ("node", [ - Dir ("src", [ - File ("demo.ml", + Dir ("node", [ + Dir ("src", [ + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14572,7 +14572,7 @@ let root = OCamlRes.Res.([ \ \"bs-dependencies\": [\n\ \ ]\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14590,7 +14590,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14617,7 +14617,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14635,9 +14635,9 @@ let root = OCamlRes.Res.([ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically\n\ ")]) ; - Dir ("react-hooks", [ - Dir ("src", [ - File ("Index.re", + Dir ("react-hooks", [ + Dir ("src", [ + File ("Index.re", "// Entry point\n\ \n\ [@bs.val] external document: Js.t({..}) = \"document\";\n\ @@ -14690,7 +14690,7 @@ let root = OCamlRes.Res.([ \ makeContainer(\"Reason Using JS Using Reason\"),\n\ );\n\ ") ; - File ("ExampleStyles.re", + File ("ExampleStyles.re", "let reasonReactBlue = \"#48a9dc\";\n\ \n\ // The {j|...|j} feature is just string interpolation, from\n\ @@ -14736,8 +14736,8 @@ let root = OCamlRes.Res.([ \ }\n\ |j};\n\ ") ; - Dir ("FetchedDogPictures", [ - File ("FetchedDogPictures.re", + Dir ("FetchedDogPictures", [ + File ("FetchedDogPictures.re", "[@bs.val] external fetch: string => Js.Promise.t('a) = \"fetch\";\n\ \n\ type state =\n\ @@ -14809,8 +14809,8 @@ let root = OCamlRes.Res.([ \ ;\n\ };\n\ ")]) ; - Dir ("BlinkingGreeting", [ - File ("BlinkingGreeting.re", + Dir ("BlinkingGreeting", [ + File ("BlinkingGreeting.re", "[@react.component]\n\ let make = (~children) => {\n\ \ let (show, setShow) = React.useState(() => true);\n\ @@ -14837,8 +14837,8 @@ let root = OCamlRes.Res.([ \
children
;\n\ };\n\ ")]) ; - Dir ("ReasonUsingJSUsingReason", [ - File ("ReasonUsingJSUsingReason.re", + Dir ("ReasonUsingJSUsingReason", [ + File ("ReasonUsingJSUsingReason.re", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re\n\ // - Used by a ReactJS component, ReactJSCard.js\n\ @@ -14850,7 +14850,7 @@ let root = OCamlRes.Res.([ [@react.component] [@bs.module]\n\ external make: unit => React.element = \"./ReactJSCard\";\n\ ") ; - File ("ReasonReactCard.re", + File ("ReasonReactCard.re", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re (this file)\n\ // - Used by a ReactJS component, ReactJSCard.js\n\ @@ -14862,7 +14862,7 @@ let root = OCamlRes.Res.([ \
{React.string(\"This is a ReasonReact card\")}
;\n\ };\n\ ") ; - File ("ReactJSCard.js", + File ("ReactJSCard.js", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re\n\ // - Used by a ReactJS component, ReactJSCard.js (this file)\n\ @@ -14895,8 +14895,8 @@ let root = OCamlRes.Res.([ \n\ module.exports = ReactJSComponent;\n\ ")]) ; - Dir ("ReducerFromReactJSDocs", [ - File ("ReducerFromReactJSDocs.re", + Dir ("ReducerFromReactJSDocs", [ + File ("ReducerFromReactJSDocs.re", "// This is the ReactJS documentation's useReducer example, directly ported over\n\ // https://reactjs.org/docs/hooks-reference.html#usereducer\n\ \n\ @@ -14942,7 +14942,7 @@ let root = OCamlRes.Res.([ \ ;\n\ };\n\ ")])]) ; - File ("UNUSED_webpack.config.js", + File ("UNUSED_webpack.config.js", "const path = require('path');\n\ \n\ module.exports = {\n\ @@ -14957,11 +14957,11 @@ let root = OCamlRes.Res.([ \ filename: 'index.js',\n\ \ },\n\ };") ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"reason-react-examples\",\n\ \ \"reason\": {\n\ - \ \"react-jsx\": 3,\n\ + \ \"react-jsx\": 3\n\ \ },\n\ \ \"sources\": {\n\ \ \"dir\" : \"src\",\n\ @@ -14980,7 +14980,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("watcher.js", + File ("watcher.js", "// This is our simple, robust watcher. It hooks into the BuckleScript build\n\ // system to listen for build events.\n\ // See package.json's `start` script and `./node_modules/.bin/bsb --help`\n\ @@ -14989,7 +14989,7 @@ let root = OCamlRes.Res.([ // _might_ not pick up the new version. If you're in Chrome, do Force Reload.\n\ \n\ var websocketReloader;\n\ - var LAST_SUCCESS_BUILD_STAMP = localStorage.getItem('LAST_SUCCESS_BUILD_STAMP' || 0);\n\ + var LAST_SUCCESS_BUILD_STAMP = localStorage.getItem('LAST_SUCCESS_BUILD_STAMP') || 0;\n\ // package.json's `start` script's `bsb -ws _` means it'll pipe build events\n\ // through a websocket connection to a default port of 9999. This is\n\ // configurable, e.g. `-ws 5000`\n\ @@ -15021,7 +15021,7 @@ let root = OCamlRes.Res.([ setUpWebSocket();\n\ setInterval(setUpWebSocket, 2000);\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -15046,11 +15046,11 @@ let root = OCamlRes.Res.([ \ },\n\ \ \"devDependencies\": {\n\ \ \"bs-platform\": \"^${bsb:bs-version}\",\n\ - \ \"moduleserve\": \"^0.8.4\"\n\ + \ \"moduleserve\": \"^0.9.0\"\n\ \ }\n\ }\n\ ") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ @@ -15058,7 +15058,7 @@ let root = OCamlRes.Res.([ /lib/bs/\n\ /node_modules/\n\ /bundleOutput/") ; - File ("README.md", + File ("README.md", "# ReasonReact Template & Examples\n\ \n\ This is:\n\ @@ -15086,19 +15086,19 @@ let root = OCamlRes.Res.([ # Features Used\n\ \n\ | | Blinking Greeting | Reducer from ReactJS Docs | Fetch Dog Pictures | Reason Using JS Using Reason |\n\ - |---------------------------|------------------|----------------------------|--------------------|------------------------------|\n\ - | No props | | \xE2\x9C\x93 | | |\n\ - | Has props | | | | \xE2\x9C\x93 |\n\ - | Children props | \xE2\x9C\x93 | | | |\n\ - | No state | | | | \xE2\x9C\x93 |\n\ - | Has state | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ - | Has state with useReducer | | \xE2\x9C\x93 | | |\n\ - | ReasonReact using ReactJS | | | | \xE2\x9C\x93 |\n\ - | ReactJS using ReasonReact | | | | \xE2\x9C\x93 |\n\ - | useEffect | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ - | Dom attribute | \xE2\x9C\x93 | \xE2\x9C\x93 | | \xE2\x9C\x93 |\n\ - | Styling | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 |\n\ - | React.array | | | \xE2\x9C\x93 | |\n\ + |---------------------------|-------------------|---------------------------|--------------------|------------------------------|\n\ + | No props | | \xE2\x9C\x93 | | |\n\ + | Has props | | | | \xE2\x9C\x93 |\n\ + | Children props | \xE2\x9C\x93 | | | |\n\ + | No state | | | | \xE2\x9C\x93 |\n\ + | Has state | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ + | Has state with useReducer | | \xE2\x9C\x93 | | |\n\ + | ReasonReact using ReactJS | | | | \xE2\x9C\x93 |\n\ + | ReactJS using ReasonReact | | | | \xE2\x9C\x93 |\n\ + | useEffect | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ + | Dom attribute | \xE2\x9C\x93 | \xE2\x9C\x93 | | \xE2\x9C\x93 |\n\ + | Styling | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 |\n\ + | React.array | | | \xE2\x9C\x93 | |\n\ \n\ # Bundle for Production\n\ \n\ @@ -15121,7 +15121,7 @@ let root = OCamlRes.Res.([ \n\ By the way, ReasonReact comes with a small [router](https://reasonml.github.io/reason-react/docs/en/router) you might be interested in.\n\ ") ; - File ("indexProduction.html", + File ("indexProduction.html", "\n\ \n\ \n\ @@ -15133,7 +15133,7 @@ let root = OCamlRes.Res.([ \n\ \n\ ") ; - File ("index.html", + File ("index.html", "\n\ \n\ \n\ @@ -15151,15 +15151,15 @@ let root = OCamlRes.Res.([ \ \n\ \n\ \ \n\ - \ \n\ + \ \n\ \ \n\ \ \n\ \n\ \n\ ")]) ; - Dir ("tea", [ - Dir ("src", [ - File ("main.ml", + Dir ("tea", [ + Dir ("src", [ + File ("main.ml", "\n\ \n\ \n\ @@ -15169,7 +15169,7 @@ let root = OCamlRes.Res.([ \ |. ignore\n\ \ ) \n\ 0") ; - File ("demo.ml", + File ("demo.ml", "(* This line opens the Tea.App modules into the current scope for Program access functions and types *)\n\ open Tea.App\n\ \n\ @@ -15232,7 +15232,7 @@ let root = OCamlRes.Res.([ \ update;\n\ \ view;\n\ \ }")]) ; - File ("loader.js", + File ("loader.js", "/* Copyright (C) 2018 Authors of BuckleScript\n\ \ * \n\ \ * This program is free software: you can redistribute it and/or modify\n\ @@ -15734,7 +15734,7 @@ let root = OCamlRes.Res.([ \ BSload(main.dataset.main)\n\ }\n\ ") ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"tea\",\n\ \ \"version\": \"0.1.0\",\n\ @@ -15755,7 +15755,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File ("watcher.js", + File ("watcher.js", "\n\ \n\ var wsReloader;\n\ @@ -15783,7 +15783,7 @@ let root = OCamlRes.Res.([ \n\ setUpWebScoket();\n\ setInterval(setUpWebScoket, 2000);") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -15805,7 +15805,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -15827,7 +15827,7 @@ let root = OCamlRes.Res.([ \n\ Edit the file and see the changes automatically reloaded in the browser\n\ ") ; - File ("index.html", + File ("index.html", "\n\ \n\ \ \n\ diff --git a/lib/4.06.1/unstable/bsb_native.ml b/lib/4.06.1/unstable/bsb_native.ml index 4112ce94ed..2c82a4ff56 100644 --- a/lib/4.06.1/unstable/bsb_native.ml +++ b/lib/4.06.1/unstable/bsb_native.ml @@ -14261,14 +14261,14 @@ end = struct #1 "bsb_templates.ml" (* This file has been generated by ocp-ocamlres *) let root = OCamlRes.Res.([ - Dir ("basic", [ - Dir ("src", [ - File ("demo.ml", + Dir ("basic", [ + Dir ("src", [ + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - Dir (".vscode", [ - File ("tasks.json", + Dir (".vscode", [ + File ("tasks.json", "{\n\ \ \"version\": \"${bsb:proj-version}\",\n\ \ \"command\": \"npm\",\n\ @@ -14307,7 +14307,7 @@ let root = OCamlRes.Res.([ \ ]\n\ \ }\n\ }")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14328,7 +14328,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14346,7 +14346,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14373,7 +14373,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14390,13 +14390,13 @@ let root = OCamlRes.Res.([ \n\ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically")]) ; - Dir ("basic-reason", [ - Dir ("src", [ - File ("Demo.re", + Dir ("basic-reason", [ + Dir ("src", [ + File ("Demo.re", "Js.log(\"Hello, BuckleScript and Reason!\");\n\ ")]) ; - Dir (".vscode", [ - File ("tasks.json", + Dir (".vscode", [ + File ("tasks.json", "{\n\ \ \"version\": \"${bsb:proj-version}\",\n\ \ \"command\": \"npm\",\n\ @@ -14443,7 +14443,7 @@ let root = OCamlRes.Res.([ \ }\n\ \ }\n\ ")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14466,7 +14466,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14485,7 +14485,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ @@ -14493,7 +14493,7 @@ let root = OCamlRes.Res.([ /lib/bs/\n\ /node_modules/\n\ ") ; - File ("README.md", + File ("README.md", "# Basic Reason Template\n\ \n\ Hello! This project allows you to quickly get started with Reason and BuckleScript. If you wanted a more sophisticated version, try the `react` template (`bsb -theme react -init .`).\n\ @@ -14513,9 +14513,9 @@ let root = OCamlRes.Res.([ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically\n\ ")]) ; - Dir ("generator", [ - Dir ("src", [ - File ("test.cpp.ml", + Dir ("generator", [ + Dir ("src", [ + File ("test.cpp.ml", "\n\ (* \n\ #define FS_VAL(name,ty) external name : ty = \"\" [@@bs.module \"fs\"]\n\ @@ -14526,11 +14526,11 @@ let root = OCamlRes.Res.([ \n\ \n\ \ let ocaml = OCAML") ; - File ("demo.ml", + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14549,7 +14549,7 @@ let root = OCamlRes.Res.([ \ \"bs-dependencies\" : [\n\ \ ]\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14567,7 +14567,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14594,7 +14594,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14611,9 +14611,9 @@ let root = OCamlRes.Res.([ \n\ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically")]) ; - Dir ("minimal", [ - Dir ("src", [ File ("main.ml", "")]) ; - File ("bsconfig.json", + Dir ("minimal", [ + Dir ("src", [ File ("main.ml", "")]) ; + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"sources\": {\n\ @@ -14621,7 +14621,7 @@ let root = OCamlRes.Res.([ \ \"subdirs\": true\n\ \ }\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14639,23 +14639,23 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ npm-debug.log\n\ /lib/bs/\n\ /node_modules/") ; - File ("README.md", + File ("README.md", "\n\ \ # ${bsb:name}")]) ; - Dir ("node", [ - Dir ("src", [ - File ("demo.ml", + Dir ("node", [ + Dir ("src", [ + File ("demo.ml", "\n\ \n\ let () = Js.log \"Hello, BuckleScript\"")]) ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14671,7 +14671,7 @@ let root = OCamlRes.Res.([ \ \"bs-dependencies\": [\n\ \ ]\n\ }") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -14689,7 +14689,7 @@ let root = OCamlRes.Res.([ \ \"bs-platform\": \"^${bsb:bs-version}\"\n\ \ }\n\ }") ; - File (".gitignore", + File (".gitignore", "*.exe\n\ *.obj\n\ *.out\n\ @@ -14716,7 +14716,7 @@ let root = OCamlRes.Res.([ .vscode\n\ .merlin\n\ .bsb.lock") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -14734,9 +14734,9 @@ let root = OCamlRes.Res.([ # Editor\n\ If you use `vscode`, Press `Windows + Shift + B` it will build automatically\n\ ")]) ; - Dir ("react-hooks", [ - Dir ("src", [ - File ("Index.re", + Dir ("react-hooks", [ + Dir ("src", [ + File ("Index.re", "// Entry point\n\ \n\ [@bs.val] external document: Js.t({..}) = \"document\";\n\ @@ -14789,7 +14789,7 @@ let root = OCamlRes.Res.([ \ makeContainer(\"Reason Using JS Using Reason\"),\n\ );\n\ ") ; - File ("ExampleStyles.re", + File ("ExampleStyles.re", "let reasonReactBlue = \"#48a9dc\";\n\ \n\ // The {j|...|j} feature is just string interpolation, from\n\ @@ -14835,8 +14835,8 @@ let root = OCamlRes.Res.([ \ }\n\ |j};\n\ ") ; - Dir ("FetchedDogPictures", [ - File ("FetchedDogPictures.re", + Dir ("FetchedDogPictures", [ + File ("FetchedDogPictures.re", "[@bs.val] external fetch: string => Js.Promise.t('a) = \"fetch\";\n\ \n\ type state =\n\ @@ -14908,8 +14908,8 @@ let root = OCamlRes.Res.([ \ ;\n\ };\n\ ")]) ; - Dir ("BlinkingGreeting", [ - File ("BlinkingGreeting.re", + Dir ("BlinkingGreeting", [ + File ("BlinkingGreeting.re", "[@react.component]\n\ let make = (~children) => {\n\ \ let (show, setShow) = React.useState(() => true);\n\ @@ -14936,8 +14936,8 @@ let root = OCamlRes.Res.([ \
children
;\n\ };\n\ ")]) ; - Dir ("ReasonUsingJSUsingReason", [ - File ("ReasonUsingJSUsingReason.re", + Dir ("ReasonUsingJSUsingReason", [ + File ("ReasonUsingJSUsingReason.re", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re\n\ // - Used by a ReactJS component, ReactJSCard.js\n\ @@ -14949,7 +14949,7 @@ let root = OCamlRes.Res.([ [@react.component] [@bs.module]\n\ external make: unit => React.element = \"./ReactJSCard\";\n\ ") ; - File ("ReasonReactCard.re", + File ("ReasonReactCard.re", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re (this file)\n\ // - Used by a ReactJS component, ReactJSCard.js\n\ @@ -14961,7 +14961,7 @@ let root = OCamlRes.Res.([ \
{React.string(\"This is a ReasonReact card\")}
;\n\ };\n\ ") ; - File ("ReactJSCard.js", + File ("ReactJSCard.js", "// In this Interop example folder, we have:\n\ // - A ReasonReact component, ReasonReactCard.re\n\ // - Used by a ReactJS component, ReactJSCard.js (this file)\n\ @@ -14994,8 +14994,8 @@ let root = OCamlRes.Res.([ \n\ module.exports = ReactJSComponent;\n\ ")]) ; - Dir ("ReducerFromReactJSDocs", [ - File ("ReducerFromReactJSDocs.re", + Dir ("ReducerFromReactJSDocs", [ + File ("ReducerFromReactJSDocs.re", "// This is the ReactJS documentation's useReducer example, directly ported over\n\ // https://reactjs.org/docs/hooks-reference.html#usereducer\n\ \n\ @@ -15041,7 +15041,7 @@ let root = OCamlRes.Res.([ \ ;\n\ };\n\ ")])]) ; - File ("UNUSED_webpack.config.js", + File ("UNUSED_webpack.config.js", "const path = require('path');\n\ \n\ module.exports = {\n\ @@ -15056,11 +15056,11 @@ let root = OCamlRes.Res.([ \ filename: 'index.js',\n\ \ },\n\ };") ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"reason-react-examples\",\n\ \ \"reason\": {\n\ - \ \"react-jsx\": 3,\n\ + \ \"react-jsx\": 3\n\ \ },\n\ \ \"sources\": {\n\ \ \"dir\" : \"src\",\n\ @@ -15079,7 +15079,7 @@ let root = OCamlRes.Res.([ \ \"refmt\": 3\n\ }\n\ ") ; - File ("watcher.js", + File ("watcher.js", "// This is our simple, robust watcher. It hooks into the BuckleScript build\n\ // system to listen for build events.\n\ // See package.json's `start` script and `./node_modules/.bin/bsb --help`\n\ @@ -15088,7 +15088,7 @@ let root = OCamlRes.Res.([ // _might_ not pick up the new version. If you're in Chrome, do Force Reload.\n\ \n\ var websocketReloader;\n\ - var LAST_SUCCESS_BUILD_STAMP = localStorage.getItem('LAST_SUCCESS_BUILD_STAMP' || 0);\n\ + var LAST_SUCCESS_BUILD_STAMP = localStorage.getItem('LAST_SUCCESS_BUILD_STAMP') || 0;\n\ // package.json's `start` script's `bsb -ws _` means it'll pipe build events\n\ // through a websocket connection to a default port of 9999. This is\n\ // configurable, e.g. `-ws 5000`\n\ @@ -15120,7 +15120,7 @@ let root = OCamlRes.Res.([ setUpWebSocket();\n\ setInterval(setUpWebSocket, 2000);\n\ ") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -15145,11 +15145,11 @@ let root = OCamlRes.Res.([ \ },\n\ \ \"devDependencies\": {\n\ \ \"bs-platform\": \"^${bsb:bs-version}\",\n\ - \ \"moduleserve\": \"^0.8.4\"\n\ + \ \"moduleserve\": \"^0.9.0\"\n\ \ }\n\ }\n\ ") ; - File (".gitignore", + File (".gitignore", ".DS_Store\n\ .merlin\n\ .bsb.lock\n\ @@ -15157,7 +15157,7 @@ let root = OCamlRes.Res.([ /lib/bs/\n\ /node_modules/\n\ /bundleOutput/") ; - File ("README.md", + File ("README.md", "# ReasonReact Template & Examples\n\ \n\ This is:\n\ @@ -15185,19 +15185,19 @@ let root = OCamlRes.Res.([ # Features Used\n\ \n\ | | Blinking Greeting | Reducer from ReactJS Docs | Fetch Dog Pictures | Reason Using JS Using Reason |\n\ - |---------------------------|------------------|----------------------------|--------------------|------------------------------|\n\ - | No props | | \xE2\x9C\x93 | | |\n\ - | Has props | | | | \xE2\x9C\x93 |\n\ - | Children props | \xE2\x9C\x93 | | | |\n\ - | No state | | | | \xE2\x9C\x93 |\n\ - | Has state | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ - | Has state with useReducer | | \xE2\x9C\x93 | | |\n\ - | ReasonReact using ReactJS | | | | \xE2\x9C\x93 |\n\ - | ReactJS using ReasonReact | | | | \xE2\x9C\x93 |\n\ - | useEffect | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ - | Dom attribute | \xE2\x9C\x93 | \xE2\x9C\x93 | | \xE2\x9C\x93 |\n\ - | Styling | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 |\n\ - | React.array | | | \xE2\x9C\x93 | |\n\ + |---------------------------|-------------------|---------------------------|--------------------|------------------------------|\n\ + | No props | | \xE2\x9C\x93 | | |\n\ + | Has props | | | | \xE2\x9C\x93 |\n\ + | Children props | \xE2\x9C\x93 | | | |\n\ + | No state | | | | \xE2\x9C\x93 |\n\ + | Has state | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ + | Has state with useReducer | | \xE2\x9C\x93 | | |\n\ + | ReasonReact using ReactJS | | | | \xE2\x9C\x93 |\n\ + | ReactJS using ReasonReact | | | | \xE2\x9C\x93 |\n\ + | useEffect | \xE2\x9C\x93 | | \xE2\x9C\x93 | |\n\ + | Dom attribute | \xE2\x9C\x93 | \xE2\x9C\x93 | | \xE2\x9C\x93 |\n\ + | Styling | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 | \xE2\x9C\x93 |\n\ + | React.array | | | \xE2\x9C\x93 | |\n\ \n\ # Bundle for Production\n\ \n\ @@ -15220,7 +15220,7 @@ let root = OCamlRes.Res.([ \n\ By the way, ReasonReact comes with a small [router](https://reasonml.github.io/reason-react/docs/en/router) you might be interested in.\n\ ") ; - File ("indexProduction.html", + File ("indexProduction.html", "\n\ \n\ \n\ @@ -15232,7 +15232,7 @@ let root = OCamlRes.Res.([ \n\ \n\ ") ; - File ("index.html", + File ("index.html", "\n\ \n\ \n\ @@ -15250,15 +15250,15 @@ let root = OCamlRes.Res.([ \ \n\ \n\ \ \n\ - \ \n\ + \ \n\ \ \n\ \ \n\ \n\ \n\ ")]) ; - Dir ("tea", [ - Dir ("src", [ - File ("main.ml", + Dir ("tea", [ + Dir ("src", [ + File ("main.ml", "\n\ \n\ \n\ @@ -15268,7 +15268,7 @@ let root = OCamlRes.Res.([ \ |. ignore\n\ \ ) \n\ 0") ; - File ("demo.ml", + File ("demo.ml", "(* This line opens the Tea.App modules into the current scope for Program access functions and types *)\n\ open Tea.App\n\ \n\ @@ -15331,7 +15331,7 @@ let root = OCamlRes.Res.([ \ update;\n\ \ view;\n\ \ }")]) ; - File ("loader.js", + File ("loader.js", "/* Copyright (C) 2018 Authors of BuckleScript\n\ \ * \n\ \ * This program is free software: you can redistribute it and/or modify\n\ @@ -15833,7 +15833,7 @@ let root = OCamlRes.Res.([ \ BSload(main.dataset.main)\n\ }\n\ ") ; - File ("bsconfig.json", + File ("bsconfig.json", "{\n\ \ \"name\": \"tea\",\n\ \ \"version\": \"0.1.0\",\n\ @@ -15854,7 +15854,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File ("watcher.js", + File ("watcher.js", "\n\ \n\ var wsReloader;\n\ @@ -15882,7 +15882,7 @@ let root = OCamlRes.Res.([ \n\ setUpWebScoket();\n\ setInterval(setUpWebScoket, 2000);") ; - File ("package.json", + File ("package.json", "{\n\ \ \"name\": \"${bsb:name}\",\n\ \ \"version\": \"${bsb:proj-version}\",\n\ @@ -15904,7 +15904,7 @@ let root = OCamlRes.Res.([ \ }\n\ }\n\ ") ; - File ("README.md", + File ("README.md", "\n\ \n\ # Build\n\ @@ -15926,7 +15926,7 @@ let root = OCamlRes.Res.([ \n\ Edit the file and see the changes automatically reloaded in the browser\n\ ") ; - File ("index.html", + File ("index.html", "\n\ \n\ \ \n\ diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 5cf13835af..3604c0173f 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -97265,6 +97265,7 @@ let exp_need_paren (e : J.expression) = | Raw_js_code (_, Exp) | Fun _ | Raw_js_function _ + | Caml_block (_,_,_, (Blk_record _ | Blk_module _)) | Object _ -> true | Raw_js_code (_,Stmt) | Length _ diff --git a/lib/4.06.1/unstable/js_refmt_compiler.ml b/lib/4.06.1/unstable/js_refmt_compiler.ml index 2dee4200b1..cee35137b5 100644 --- a/lib/4.06.1/unstable/js_refmt_compiler.ml +++ b/lib/4.06.1/unstable/js_refmt_compiler.ml @@ -35632,7 +35632,9 @@ type field_dbg_info = | Fld_record_inline of string | Fld_record_extension of string | Fld_tuple - + | Fld_poly_var_tag + | Fld_poly_var_content + val fld_record : (Types.label_description -> field_dbg_info) ref @@ -35952,6 +35954,7 @@ val make_key: lambda -> lambda option val const_unit: structured_constant val lambda_assert_false: lambda val lambda_unit: lambda +val lambda_module_alias : lambda val name_lambda: let_kind -> lambda -> (Ident.t -> lambda) -> lambda val name_lambda_list: lambda list -> (lambda list -> lambda) -> lambda @@ -36091,7 +36094,9 @@ type field_dbg_info = | Fld_record_inline of string | Fld_record_extension of string | Fld_tuple - + | Fld_poly_var_tag + | Fld_poly_var_content + let fld_record = ref (fun (lbl : Types.label_description) -> Fld_record {name = lbl.lbl_name; mutable_flag = Mutable}) @@ -36379,6 +36384,7 @@ let const_unit = Const_pointer(0, Pt_na) let lambda_assert_false = Lconst (Const_pointer(0, Pt_constructor {name = "assert false"; cstrs = (1,0)})) +let lambda_module_alias = Lconst (Const_pointer(0, Pt_module_alias)) let lambda_unit = Lconst const_unit @@ -85943,6 +85949,9 @@ type field_dbg_info = Lambda.field_dbg_info = | Fld_record_extension of string | Fld_tuple + | Fld_poly_var_tag + | Fld_poly_var_content + val str_of_field_info : field_dbg_info -> @@ -86155,10 +86164,16 @@ type field_dbg_info = Lambda.field_dbg_info = | Fld_record_extension of string | Fld_tuple + | Fld_poly_var_tag + | Fld_poly_var_content + + let str_of_field_info (x : field_dbg_info) : string option = match x with | Fld_na - | Fld_tuple -> None + | Fld_poly_var_tag + | Fld_poly_var_content + | Fld_tuple -> None | Fld_record {name = s} | Fld_module s | Fld_record_inline s @@ -94533,11 +94548,13 @@ let comment_of_tag_info (x : Lam_tag_info.t) = | Blk_extension (* TODO: enhance it later *) | Blk_extension_slot -> None | Blk_na s -> if s = "" then None else Some s + +let module_alias = Some "alias" let comment_of_pointer_info (x : Lam_pointer_info.t)= match x with | Pt_constructor {name} | Pt_variant {name} -> Some name - | Pt_module_alias -> None (* FIXME *) + | Pt_module_alias -> module_alias | Pt_na -> None end @@ -97248,6 +97265,7 @@ let exp_need_paren (e : J.expression) = | Raw_js_code (_, Exp) | Fun _ | Raw_js_function _ + | Caml_block (_,_,_, (Blk_record _ | Blk_module _)) | Object _ -> true | Raw_js_code (_,Stmt) | Length _ @@ -103687,7 +103705,7 @@ let make_variant_matching_nonconst p lab def ctx = function let def = make_default (matcher_variant_nonconst lab) def and ctx = filter_ctx p ctx in {pm= - {cases = []; args = (Lprim(Pfield (1, Fld_na), [arg], p.pat_loc), Alias) :: argl; + {cases = []; args = (Lprim(Pfield (1, Fld_poly_var_content), [arg], p.pat_loc), Alias) :: argl; default=def} ; ctx=ctx ; pat = normalize_pat p} @@ -103891,7 +103909,7 @@ let make_tuple_matching loc arity def = function let rec make_args pos = if pos >= arity then argl - else (Lprim(Pfield (pos, Fld_na (* TODO: tuple *)), [arg], loc), Alias) :: make_args (pos + 1) in + else (Lprim(Pfield (pos, Fld_tuple), [arg], loc), Alias) :: make_args (pos + 1) in {cases = []; args = make_args 0 ; default=make_default (matcher_tuple arity) def} @@ -104727,7 +104745,7 @@ let call_switcher_variant_constant loc fail arg int_lambda_list names = let call_switcher_variant_constr loc fail arg int_lambda_list names = let v = Ident.create "variant" in - Llet(Alias, Pgenval, v, Lprim(Pfield (0, Fld_na), [arg], loc), + Llet(Alias, Pgenval, v, Lprim(Pfield (0, Fld_poly_var_tag), [arg], loc), call_switcher loc fail (Lvar v) min_int max_int int_lambda_list names) @@ -106992,7 +107010,7 @@ and transl_exp0 e = | Texp_new (cl, {Location.loc=loc}, _) -> Lapply{ap_should_be_tailcall=false; ap_loc=loc; - ap_func=Lprim(Pfield (0, Fld_na), [transl_class_path ~loc e.exp_env cl], loc); + ap_func=Lprim(Pfield (0, Fld_tuple), [transl_class_path ~loc e.exp_env cl], loc); ap_args=[lambda_unit]; ap_inlined=Default_inline; ap_specialised=Default_specialise} @@ -107544,7 +107562,7 @@ let lfield v i = Lprim(Pfield (i, Fld_na), [Lvar v], Location.none) let transl_label l = share (Const_immstring l) let transl_meth_list lst = - if lst = [] then Lconst (Const_pointer (0, Lambda.Pt_na)) else + if lst = [] then Lconst (Const_pointer (0, Pt_na)) else share (Const_block (0, Lambda.Blk_array, List.map (fun lab -> Const_immstring lab) lst)) @@ -107755,8 +107773,8 @@ let rec build_class_init cla cstr super inh_init cl_init msubst top cl = let lpath = transl_class_path ~loc:cl.cl_loc cl.cl_env path in (inh_init, Llet (Strict, Pgenval, obj_init, - mkappl(Lprim(Pfield (1, Fld_na), [lpath], Location.none), Lvar cla :: - if top then [Lprim(Pfield (3, Fld_na), [lpath], Location.none)] + mkappl(Lprim(Pfield (1, Fld_tuple), [lpath], Location.none), Lvar cla :: + if top then [Lprim(Pfield (3, Fld_tuple), [lpath], Location.none)] else []), bind_super cla super cl_init)) | _ -> @@ -108012,7 +108030,7 @@ let rec builtin_meths self env env2 body = | Lprim(Parrayrefu _, [Lvar s; Lvar n], _) when List.mem s self -> "var", [Lvar n] | Lprim(Pfield (n,_), [Lvar e], _) when Ident.same e env -> - "env", [Lvar env2; Lconst(Const_pointer (n, Lambda.Pt_na))] + "env", [Lvar env2; Lconst(Const_pointer (n, Pt_na))] | Lsend(Self, met, Lvar s, [], _) when List.mem s self -> "meth", [met] | _ -> raise Not_found @@ -108083,7 +108101,7 @@ module M = struct | "send_env" -> SendEnv | "send_meth" -> SendMeth | _ -> assert false - in Lconst(Const_pointer(Obj.magic tag, Lambda.Pt_na)) :: args + in Lconst(Const_pointer(Obj.magic tag, Pt_na)) :: args end open M @@ -108917,7 +108935,7 @@ and transl_module cc rootpath mexp = mexp.mod_attributes; let loc = mexp.mod_loc in match mexp.mod_type with - Mty_alias (Mta_absent, _) -> apply_coercion loc Alias cc lambda_unit + Mty_alias (Mta_absent, _) -> apply_coercion loc Alias cc lambda_module_alias | _ -> match mexp.mod_desc with Tmod_ident (path,_) -> @@ -116510,15 +116528,14 @@ let make_block mutable_flag (tag_info : Lam_tag_info.t) tag args = let field (field_info : Lam_compat.field_dbg_info) e i = match field_info with | Fld_na - | Fld_tuple -> - (* let comment = "NA" in *) - E.array_index_by_int (* ~comment *) e i - - | Fld_record_inline comment - | Fld_record_extension comment + | Fld_tuple + | Fld_poly_var_tag + | Fld_poly_var_content + | Fld_record_inline _ + | Fld_record_extension _ -> - E.array_index_by_int ~comment e i - + E.array_index_by_int + ?comment:(Lam_compat.str_of_field_info field_info) e i | Fld_record {name} -> E.record_access e name i | Fld_module name diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index c4416ebb64..40db28de1c 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -99980,6 +99980,7 @@ let exp_need_paren (e : J.expression) = | Raw_js_code (_, Exp) | Fun _ | Raw_js_function _ + | Caml_block (_,_,_, (Blk_record _ | Blk_module _)) | Object _ -> true | Raw_js_code (_,Stmt) | Length _ diff --git a/scripts/dbg b/scripts/dbg index d9e3602d91..8c73d110ec 100755 --- a/scripts/dbg +++ b/scripts/dbg @@ -2,12 +2,13 @@ var cp = require("child_process"); var path = require("path"); -var file = process.argv[2] -console.log(file) +var file = process.argv[2]; +console.log(file); var fmt = path.parse(file); process.env.BS_DEBUG_FILE = file; - -cp.execSync(`touch ${file} && ninja ${fmt.dir}/${fmt.name}.cmj`, { +var ninja = path.join(__dirname, "..", "vendor", "ninja", "snapshot", + `ninja${require('./config.js').sys_extension}`); +cp.execSync(`touch ${file} && ${ninja} ${fmt.dir}/${fmt.name}.cmj`, { stdio: [0, 1, 2] });