Skip to content
Snippets Groups Projects
Commit ba2c170b authored by Thomas Wood's avatar Thomas Wood
Browse files

Change ' replacement string to _2

parent aae29bf3
No related branches found
No related tags found
No related merge requests found
...@@ -236,12 +236,12 @@ let ppf_pat_array id_list array_expr = ...@@ -236,12 +236,12 @@ let ppf_pat_array id_list array_expr =
let ppf_field_access expr field = let ppf_field_access expr field =
Printf.sprintf "%s.%s" expr field Printf.sprintf "%s.%s" expr field
(* ' is not permitted in JS identifier names, and $ is not permitted in OCaml ones *) (* ' is not permitted in JS identifier names, we assume _2 is not used in OCaml names *)
let ppf_ident_name x = let ppf_ident_name x =
if List.mem x ["arguments"] if List.mem x ["arguments"; "eval"; "caller"]
then unsupported ("use of reserved keyword: " ^ x); then unsupported ("use of reserved keyword: " ^ x);
(* TODO: complete the list *) (* TODO: complete the list *)
String.map (function '\'' -> '$' | c -> c) x Str.global_replace (Str.regexp "'") "_2" x
let ppf_ident i = let ppf_ident i =
i |> Ident.name |> ppf_ident_name i |> Ident.name |> ppf_ident_name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment