Skip to content

Regulate access to [Language_extension] from within Jane Syntax #1768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions ocaml/parsing/jane_syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ open Asttypes
open Parsetree
open Jane_syntax_parsing

(** We carefully regulate which bindings we import from [Language_extension]
to ensure that we can import this file into the Jane Street internal
repo with no changes.
*)
module Language_extension = struct
include Language_extension_kernel
include (
Language_extension
: Language_extension_kernel.Language_extension_for_jane_syntax)
end

(* Suppress the unused module warning so it's easy to keep around the
shadowing even if we delete use sites of the module. *)
module _ = Language_extension

(****************************************)
(* Helpers used just within this module *)

Expand Down Expand Up @@ -767,14 +782,15 @@ module N_ary_functions = struct
List.iter (fun mode_annotation ->
assert_extension_enabled ~loc
(match (mode_annotation.txt : mode_annotation) with
| Local -> Language_extension.Local
| Unique | Once -> Language_extension.Unique)
| Local -> Local
| Unique | Once -> Unique)
())
mode_annotations;
Mode_constraint mode_annotations)
| [ "layout_annotation" ] ->
Payload (fun payload ~loc ->
assert_extension_enabled ~loc Layouts Language_extension.Stable;
assert_extension_enabled ~loc Layouts
(Stable : Language_extension.maturity);
let layout_annotation =
Layout_annotation.Decode.from_payload payload ~loc
in
Expand Down