Skip to content

Commit 1412792

Browse files
committed
Move local allocations support behind '-extension local'
1 parent 6d8e42a commit 1412792

File tree

19 files changed

+42
-20
lines changed

19 files changed

+42
-20
lines changed

parsing/lexer.mll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ let keyword_table =
101101
"asr", INFIXOP4("asr")
102102
]
103103

104+
let lookup_keyword name =
105+
match Hashtbl.find keyword_table name with
106+
| LOCAL | NONLOCAL | GLOBAL
107+
when not (Clflags.Extension.is_enabled Local) ->
108+
LIDENT name
109+
| kw -> kw
110+
| exception Not_found ->
111+
LIDENT name
112+
104113
(* To buffer string literals *)
105114

106115
let string_buffer = Buffer.create 256
@@ -403,8 +412,7 @@ rule token = parse
403412
{ warn_latin1 lexbuf;
404413
OPTLABEL name }
405414
| lowercase identchar * as name
406-
{ try Hashtbl.find keyword_table name
407-
with Not_found -> LIDENT name }
415+
{ lookup_keyword name }
408416
| lowercase_latin1 identchar_latin1 * as name
409417
{ warn_latin1 lexbuf; LIDENT name }
410418
| uppercase identchar * as name

testsuite/tests/translprim/array_spec.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* TEST
22
* setup-ocamlc.byte-build-env
33
** ocamlc.byte
4-
flags = "-dlambda -dno-unique-ids"
4+
flags = "-dlambda -dno-unique-ids -extension local"
55
*** flat-float-array
66
**** check-ocamlc.byte-output
77
compiler_reference =

testsuite/tests/translprim/comparison_table.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* TEST
22
* setup-ocamlc.byte-build-env
33
** ocamlc.byte
4-
flags = "-dlambda -dno-unique-ids"
4+
flags = "-dlambda -dno-unique-ids -extension local"
55
*** check-ocamlc.byte-output
66
*)
77

testsuite/tests/translprim/ref_spec.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* TEST
22
* setup-ocamlc.byte-build-env
33
** ocamlc.byte
4-
flags = "-dlambda -dno-unique-ids"
4+
flags = "-dlambda -dno-unique-ids -extension local"
55
*** check-ocamlc.byte-output
66
*)
77

testsuite/tests/typing-local/alloc.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(* TEST *)
1+
(* TEST
2+
flags += "-extension local" *)
23

34
type t = int
45

testsuite/tests/typing-local/aritybug.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(* TEST *)
1+
(* TEST
2+
flags += "-extension local" *)
23

34
let[@inline never] wat x =
45
let f ~a:_ ~b:_ ~c:_ () () = x in

testsuite/tests/typing-local/comballoc.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(* TEST *)
1+
(* TEST
2+
flags += "-extension local" *)
23
let glob = ref []
34

45
let[@inline never] f g n =

testsuite/tests/typing-local/curry.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
(* TEST
2+
flags += "-extension local"
23
* bytecode
34
reference = "${test_source_directory}/curry.byte.reference"
45
* native

testsuite/tests/typing-local/exceptions.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
(* TEST
2+
flags += "-extension local"
23
* native *)
34

45
external local_stack_offset : unit -> int = "caml_local_stack_offset"

testsuite/tests/typing-local/lifetime.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
(* TEST *)
1+
(* TEST
2+
flags += "-extension local" *)
23

34
let final = ref false
45
let rtrue = ref true

0 commit comments

Comments
 (0)