diff --git a/CHANGELOG.md b/CHANGELOG.md index bd6a319c51..22769c4fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ #### :bug: Bug fix - Fix code generation for emojis in polyvars and labels. https://github.com/rescript-lang/rescript/pull/7853 +- Add `reset` to `experimental_features` to correctly reset playground. https://github.com/rescript-lang/rescript/pull/7868 - Fix crash with `@get` on external of type `unit => 'a`. https://github.com/rescript-lang/rescript/pull/7866 #### :memo: Documentation @@ -31,6 +32,8 @@ #### :house: Internal +- Playground: Add config options for experimental features and jsx preserve mode. https://github.com/rescript-lang/rescript/pull/7865 + # 12.0.0-beta.10 #### :rocket: New Feature diff --git a/compiler/jsoo/jsoo_playground_main.ml b/compiler/jsoo/jsoo_playground_main.ml index ce2eb6af80..3100a3fc82 100644 --- a/compiler/jsoo/jsoo_playground_main.ml +++ b/compiler/jsoo/jsoo_playground_main.ml @@ -378,6 +378,7 @@ module Compile = struct (* Responsible for resetting all compiler state as if it were a new instance *) let reset_compiler () = warning_infos := [||]; + Experimental_features.reset (); flush_warning_buffer () |> ignore; Warnings.reset_fatal (); Env.reset_cache_toplevel () diff --git a/compiler/ml/experimental_features.ml b/compiler/ml/experimental_features.ml index 179f43735b..662157b1ef 100644 --- a/compiler/ml/experimental_features.ml +++ b/compiler/ml/experimental_features.ml @@ -20,4 +20,6 @@ let enable_from_string (s : string) = | Some f -> enabled_features := FeatureSet.add f !enabled_features | None -> () +let reset () = enabled_features := FeatureSet.empty + let is_enabled (f : feature) = FeatureSet.mem f !enabled_features diff --git a/compiler/ml/experimental_features.mli b/compiler/ml/experimental_features.mli index bc58c931c2..5c28eca2ba 100644 --- a/compiler/ml/experimental_features.mli +++ b/compiler/ml/experimental_features.mli @@ -3,3 +3,4 @@ type feature = LetUnwrap val enable_from_string : string -> unit val is_enabled : feature -> bool val to_string : feature -> string +val reset : unit -> unit