Skip to content

Commit f711ab0

Browse files
committed
manual renames
1 parent a6b01b6 commit f711ab0

21 files changed

+145
-145
lines changed

jscomp/core/bs_conditional_initial.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let setup_env () =
4949

5050
Rescript_cpp.replace_directive_bool "BS" true;
5151
Rescript_cpp.replace_directive_bool "JS" true;
52-
Printtyp.print_res_poly_identifier := Res_printer.poly_var_ident_to_string;
52+
Printtyp.print_res_poly_identifier := Res_printer.polyvar_ident_to_string;
5353
Rescript_cpp.replace_directive_string "BS_VERSION" Bs_version.version
5454
(*; Switch.cut := 100*) (* tweakable but not very useful *)
5555

jscomp/gentype/Annotation.ml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ let to_string annotation =
1717
| GenTypeOpaque -> "GenTypeOpaque"
1818
| NoGenType -> "NoGenType"
1919

20-
let tag_is_gen_type s = s = "genType" || s = "gentype"
21-
let tag_is_gen_type_as s = s = "genType.as" || s = "gentype.as"
20+
let tag_is_gentype s = s = "genType" || s = "gentype"
21+
let tag_is_gentype_as s = s = "genType.as" || s = "gentype.as"
2222
let tag_is_as s = s = "as"
2323
let tag_is_int s = s = "int"
2424
let tag_is_string s = s = "string"
2525

2626
let tag_is_tag s = s = "tag"
2727

2828
let tag_is_unboxed s = s = "unboxed" || s = "ocaml.unboxed"
29-
let tag_is_gen_type_import s = s = "genType.import" || s = "gentype.import"
30-
let tag_is_gen_type_opaque s = s = "genType.opaque" || s = "gentype.opaque"
29+
let tag_is_gentype_import s = s = "genType.import" || s = "gentype.import"
30+
let tag_is_gentype_opaque s = s = "genType.opaque" || s = "gentype.opaque"
3131

32-
let tag_is_one_of_the_gen_type_annotations s =
33-
tag_is_gen_type s || tag_is_gen_type_as s || tag_is_gen_type_import s
34-
|| tag_is_gen_type_opaque s
32+
let tag_is_one_of_the_gentype_annotations s =
33+
tag_is_gentype s || tag_is_gentype_as s || tag_is_gentype_import s
34+
|| tag_is_gentype_opaque s
3535

36-
let tag_is_gen_type_ignore_interface s =
36+
let tag_is_gentype_ignore_interface s =
3737
s = "genType.ignoreInterface" || s = "gentype.ignoreInterface"
3838

3939
let tag_is_doc s =
@@ -98,17 +98,17 @@ let rec get_attribute_payload check_text (attributes : Typedtree.attributes) =
9898
| Some payload -> Some (loc, payload))
9999
| _hd :: tl -> get_attribute_payload check_text tl
100100

101-
let get_gen_type_as_renaming attributes =
102-
match attributes |> get_attribute_payload tag_is_gen_type_as with
101+
let get_gentype_as_renaming attributes =
102+
match attributes |> get_attribute_payload tag_is_gentype_as with
103103
| Some (_, StringPayload s) -> Some s
104104
| None -> (
105-
match attributes |> get_attribute_payload tag_is_gen_type with
105+
match attributes |> get_attribute_payload tag_is_gentype with
106106
| Some (_, StringPayload s) -> Some s
107107
| _ -> None)
108108
| _ -> None
109109

110110
(* This is not supported anymore: only use to give a warning *)
111-
let check_unsupported_gen_type_as_renaming attributes =
111+
let check_unsupported_gentype_as_renaming attributes =
112112
let error ~loc =
113113
Log_.Color.setup ();
114114
Log_.info ~loc ~name:"Warning genType" (fun ppf () ->
@@ -117,10 +117,10 @@ let check_unsupported_gen_type_as_renaming attributes =
117117
@genType.as is not supported anymore in type definitions. Use @as \
118118
from the language.")
119119
in
120-
match attributes |> get_attribute_payload tag_is_gen_type_as with
120+
match attributes |> get_attribute_payload tag_is_gentype_as with
121121
| Some (loc, _) -> error ~loc
122122
| None -> (
123-
match attributes |> get_attribute_payload tag_is_gen_type with
123+
match attributes |> get_attribute_payload tag_is_gentype with
124124
| Some (loc, _) -> error ~loc
125125
| None -> ())
126126

@@ -136,18 +136,18 @@ let get_as_int attributes =
136136
| _ -> None
137137

138138
let get_attribute_import_renaming attributes =
139-
let attribute_import = attributes |> get_attribute_payload tag_is_gen_type_import in
140-
let gen_type_as_renaming = attributes |> get_gen_type_as_renaming in
141-
match (attribute_import, gen_type_as_renaming) with
139+
let attribute_import = attributes |> get_attribute_payload tag_is_gentype_import in
140+
let gentype_as_renaming = attributes |> get_gentype_as_renaming in
141+
match (attribute_import, gentype_as_renaming) with
142142
| Some (_, StringPayload import_string), _ ->
143-
(Some import_string, gen_type_as_renaming)
143+
(Some import_string, gentype_as_renaming)
144144
| ( Some
145145
( _,
146146
TuplePayload [StringPayload import_string; StringPayload rename_string]
147147
),
148148
_ ) ->
149149
(Some import_string, Some rename_string)
150-
| _ -> (None, gen_type_as_renaming)
150+
| _ -> (None, gentype_as_renaming)
151151

152152
let get_tag attributes =
153153
match attributes |> get_attribute_payload tag_is_tag with
@@ -168,10 +168,10 @@ let has_attribute check_text (attributes : Typedtree.attributes) =
168168
let from_attributes ~(config : GenTypeConfig.t) ~loc
169169
(attributes : Typedtree.attributes) =
170170
let default = if config.everything then GenType else NoGenType in
171-
if has_attribute tag_is_gen_type_opaque attributes then GenTypeOpaque
172-
else if has_attribute (fun s -> tag_is_gen_type s || tag_is_gen_type_as s) attributes
171+
if has_attribute tag_is_gentype_opaque attributes then GenTypeOpaque
172+
else if has_attribute (fun s -> tag_is_gentype s || tag_is_gentype_as s) attributes
173173
then (
174-
(match attributes |> get_attribute_payload tag_is_gen_type with
174+
(match attributes |> get_attribute_payload tag_is_gentype with
175175
| Some (_, UnrecognizedPayload) -> ()
176176
| Some _ ->
177177
Log_.Color.setup ();
@@ -293,6 +293,6 @@ let import_from_string import_string : import =
293293
{import_path}
294294

295295
let update_config_for_module ~(config : GenTypeConfig.t) attributes =
296-
if attributes |> has_attribute tag_is_gen_type then
296+
if attributes |> has_attribute tag_is_gentype then
297297
{config with everything = true}
298298
else config

jscomp/gentype/EmitJs.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ let emit_export_type ~emitters ~config ~type_name_is_interface
7272
{CodeItem.loc; name_as; opaque; type_; type_vars; resolved_type_name; doc_string}
7373
=
7474
let free_type_vars = TypeVars.free type_ in
75-
let is_g_a_d_t =
75+
let is_gadt =
7676
free_type_vars |> List.exists (fun s -> not (List.mem s type_vars))
7777
in
7878
let opaque =
7979
match opaque with
8080
| Some true -> opaque
81-
| _ when is_g_a_d_t ->
81+
| _ when is_gadt ->
8282
Log_.Color.setup ();
8383
Log_.info ~loc ~name:"Warning genType" (fun ppf () ->
8484
Format.fprintf ppf
@@ -163,7 +163,7 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name
163163
fields
164164
|> List.map (fun (field : field) ->
165165
match
166-
field.name_j_s = "children"
166+
field.name_js = "children"
167167
&& field.type_ |> EmitType.is_type_react_element
168168
with
169169
| true -> {field with type_ = EmitType.type_react_child}
@@ -186,7 +186,7 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name
186186
(* JSX V3 *)
187187
let fields =
188188
Ext_list.filter_map fields (fun (field : field) ->
189-
match field.name_j_s with
189+
match field.name_js with
190190
| "children" when field.type_ |> EmitType.is_type_react_element ->
191191
Some {field with type_ = EmitType.type_react_child}
192192
| "key" ->
@@ -280,7 +280,7 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name
280280
fields
281281
|> List.map (fun (field : field) ->
282282
match
283-
field.name_j_s = "children"
283+
field.name_js = "children"
284284
&& field.type_ |> EmitType.is_type_react_element
285285
with
286286
| true -> {field with type_ = EmitType.type_react_child}
@@ -314,7 +314,7 @@ let emit_code_item ~config ~emitters ~module_items_emitter ~env ~file_name
314314
let props_type =
315315
let fields =
316316
Ext_list.filter_map fields (fun (field : field) ->
317-
match field.name_j_s with
317+
match field.name_js with
318318
| "children" when field.type_ |> EmitType.is_type_react_element
319319
->
320320
Some {field with type_ = EmitType.type_react_child}

jscomp/gentype/EmitType.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ let type_react_ref ~type_ =
4444
[
4545
{
4646
mutable_ = Mutable;
47-
name_j_s = react_ref_current;
47+
name_js = react_ref_current;
4848
optional = Mandatory;
4949
type_ = Null type_;
5050
doc_string = DocString.empty;
@@ -53,8 +53,8 @@ let type_react_ref ~type_ =
5353

5454
let is_type_react_ref ~fields =
5555
match fields with
56-
| [{mutable_ = Mutable; name_j_s; optional = Mandatory}] ->
57-
name_j_s == react_ref_current
56+
| [{mutable_ = Mutable; name_js; optional = Mandatory}] ->
57+
name_js == react_ref_current
5858
| _ -> false
5959

6060
let is_type_function_component ~fields type_ =
@@ -162,11 +162,11 @@ let rec render_type ~(config : Config.t) ?(indent = None) ~type_name_is_interfac
162162
|> List.map (fun type_ ->
163163
type_ |> render_type ~config ~indent ~type_name_is_interface ~in_fun_type)
164164
in
165-
let no_payloads_rendered = no_payloads |> List.map label_j_s_to_string in
165+
let no_payloads_rendered = no_payloads |> List.map label_js_to_string in
166166
let field ~name value =
167167
{
168168
mutable_ = Mutable;
169-
name_j_s = name;
169+
name_js = name;
170170
optional = Mandatory;
171171
type_ = TypeVar value;
172172
doc_string = DocString.empty;
@@ -182,7 +182,7 @@ let rec render_type ~(config : Config.t) ?(indent = None) ~type_name_is_interfac
182182
t |> render_type ~config ~indent ~type_name_is_interface ~in_fun_type
183183
in
184184
let tag_field =
185-
case |> label_j_s_to_string
185+
case |> label_js_to_string
186186
|> field ~name:(Runtime.js_variant_tag ~polymorphic:false ~tag)
187187
in
188188
match (unboxed, type_) with
@@ -197,7 +197,7 @@ let rec render_type ~(config : Config.t) ?(indent = None) ~type_name_is_interfac
197197
| false, type_ when polymorphic ->
198198
(* poly variant *)
199199
[
200-
case |> label_j_s_to_string
200+
case |> label_js_to_string
201201
|> field ~name:(Runtime.js_variant_tag ~polymorphic ~tag);
202202
type_ |> render
203203
|> field ~name:(Runtime.js_variant_value ~polymorphic);
@@ -234,7 +234,7 @@ let rec render_type ~(config : Config.t) ?(indent = None) ~type_name_is_interfac
234234
^ "| "))
235235

236236
and render_field ~config ~indent ~type_name_is_interface ~in_fun_type
237-
{mutable_; name_j_s = lbl; optional; type_; doc_string} =
237+
{mutable_; name_js = lbl; optional; type_; doc_string} =
238238
let opt_marker =
239239
match optional == Optional with
240240
| true -> "?"
@@ -246,7 +246,7 @@ and render_field ~config ~indent ~type_name_is_interface ~in_fun_type
246246
| false -> ""
247247
in
248248
let lbl =
249-
match is_j_s_safe_property_name lbl with
249+
match is_js_safe_property_name lbl with
250250
| true -> lbl
251251
| false -> EmitText.quotes lbl
252252
in

jscomp/gentype/ExportModule.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ and export_module_item_to_fields =
4040
let field_for_type =
4141
{
4242
mutable_ = Mutable;
43-
name_j_s = field_name;
43+
name_js = field_name;
4444
optional = Mandatory;
4545
type_ = type_for_type;
4646
doc_string;

jscomp/gentype/GenIdent.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type type_vars_gen = {
1212

1313
let create_type_vars_gen () = {type_name_map = IntMap.empty; type_name_counter = 0}
1414

15-
let js_type_name_for_anonymous_type_i_d ~type_vars_gen id =
15+
let js_type_name_for_anonymous_type_id ~type_vars_gen id =
1616
try type_vars_gen.type_name_map |> IntMap.find id
1717
with Not_found ->
1818
type_vars_gen.type_name_counter <- type_vars_gen.type_name_counter + 1;

jscomp/gentype/GenTypeCommon.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ let log_not_implemented x =
1818
type optional = Mandatory | Optional
1919
type mutable_ = Immutable | Mutable
2020

21-
type label_j_s =
21+
type label_js =
2222
| NullLabel
2323
| UndefinedLabel
2424
| BoolLabel of bool
2525
| FloatLabel of string
2626
| IntLabel of string
2727
| StringLabel of string
2828

29-
type case = {label_j_s: label_j_s}
29+
type case = {label_js: label_js}
3030

31-
let is_j_s_safe_property_name name =
31+
let is_js_safe_property_name name =
3232
name = ""
3333
|| (match name.[0] [@doesNotRaise] with
3434
| 'A' .. 'z' -> true
@@ -53,8 +53,8 @@ let is_number s =
5353
done;
5454
res.contents
5555

56-
let label_j_s_to_string case =
57-
match case.label_j_s with
56+
let label_js_to_string case =
57+
match case.label_js with
5858
| NullLabel -> "null"
5959
| UndefinedLabel -> "undefined"
6060
| BoolLabel b -> b |> string_of_bool
@@ -83,7 +83,7 @@ and arg_type = {a_name: string; a_type: type_}
8383

8484
and field = {
8585
mutable_: mutable_;
86-
name_j_s: string;
86+
name_js: string;
8787
optional: optional;
8888
type_: type_;
8989
doc_string: DocString.t;

0 commit comments

Comments
 (0)