Skip to content

Commit 3ceae27

Browse files
committed
Remove obsolete string constant delimiter argument
Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 8a6b38d commit 3ceae27

7 files changed

Lines changed: 20 additions & 30 deletions

File tree

compiler/ml/lambda.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ and lambda_switch = t switch
440440
*)
441441
let const_int (i : int) = Const_int (Int32.of_int i)
442442

443-
let const_string s _delim = Const_string s
443+
let const_string s = Const_string s
444444

445445
let const_of_typed (c : Asttypes.constant) : structured_constant =
446446
match c with
@@ -1476,8 +1476,7 @@ let rec transl_normal_path = function
14761476
| Path.Pident id ->
14771477
(* A predefined exception is its own name at runtime, so the reference is
14781478
that string rather than a module. *)
1479-
if Ident.is_predef_exn id then
1480-
Lconst (Const_string id.name)
1479+
if Ident.is_predef_exn id then Lconst (Const_string id.name)
14811480
else if Ident.global id then Lglobal_module id
14821481
else Lvar id
14831482
| Pdot (p, s, pos) ->

compiler/ml/lambda.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ and lambda_switch = t switch
436436
val make_key : t -> t option
437437

438438
val const_int : int -> structured_constant
439-
val const_string : string -> string option -> structured_constant
439+
val const_string : string -> structured_constant
440440
val const_of_typed : constant -> structured_constant
441441
val const_unit : structured_constant
442442
val const_constructor : Variant_runtime.tag -> structured_constant

compiler/ml/matching.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,8 +2625,7 @@ let partial_function loc () =
26252625
const
26262626
(Const_block
26272627
( Blk_tuple,
2628-
[const_string fname None; const_int line; const_int char]
2629-
));
2628+
[const_string fname; const_int line; const_int char] ));
26302629
]
26312630
loc;
26322631
]

compiler/ml/transl_recmodule.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ let undefined_location loc =
1414
let fname = Filename.basename fname in
1515
const
1616
(Const_block
17-
( Lambda.Blk_tuple,
18-
[const_string fname None; const_int line; const_int char] ))
17+
(Lambda.Blk_tuple, [const_string fname; const_int line; const_int char]))
1918

2019
let init_shape modl =
2120
let add_name x id =
22-
Const_block (Blk_tuple, [x; const_string (Ident.name id) None])
21+
Const_block (Blk_tuple, [x; const_string (Ident.name id)])
2322
in
2423
let module_tag_info : Lambda.tag_info =
2524
Blk_constructor

compiler/ml/translcore.ml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -734,23 +734,19 @@ let lam_of_loc kind loc =
734734
const
735735
(Const_block
736736
( Blk_tuple,
737-
[
738-
const_string file None;
739-
const_int lnum;
740-
const_int cnum;
741-
const_int enum;
742-
] ))
743-
| Loc_FILE -> const (const_string file None)
737+
[const_string file; const_int lnum; const_int cnum; const_int enum]
738+
))
739+
| Loc_FILE -> const (const_string file)
744740
| Loc_MODULE ->
745741
let filename = Filename.basename file in
746742
let name = Env.get_unit_name () in
747743
let module_name = if name = "" then "//" ^ filename ^ "//" else name in
748-
const (const_string module_name None)
744+
const (const_string module_name)
749745
| Loc_LOC ->
750746
let loc =
751747
Printf.sprintf "File %S, line %d, characters %d-%d" file lnum cnum enum
752748
in
753-
const (const_string loc None)
749+
const (const_string loc)
754750
| Loc_LINE -> const (const_int lnum)
755751

756752
(* Eta-expand a primitive *)
@@ -895,8 +891,7 @@ let assert_failed exp =
895891
const
896892
(Const_block
897893
( Blk_tuple,
898-
[const_string fname None; const_int line; const_int char]
899-
));
894+
[const_string fname; const_int line; const_int char] ));
900895
]
901896
exp.exp_loc;
902897
]
@@ -1043,7 +1038,8 @@ and transl_exp0 (e : Typedtree.expression) : Lambda.t =
10431038
function_ ~loc ~attr ~params ~body:lbody
10441039
| Texp_tagged_template {tag; raw_sources; values} ->
10451040
prim ~primitive:(Ptagged_template raw_sources)
1046-
~args:(transl_exp tag :: transl_list values) e.exp_loc
1041+
~args:(transl_exp tag :: transl_list values)
1042+
e.exp_loc
10471043
| Texp_template {segments; values} ->
10481044
prim ~primitive:(Ptemplate segments) ~args:(transl_list values) e.exp_loc
10491045
| Texp_apply

tests/ounit_tests/ounit_lambda_constant_tests.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ let suites =
66
__FILE__
77
>::: [
88
( "typed string constants" >:: fun _ ->
9-
Lambda.const_string "value" None =~ Lambda.Const_string "value" );
9+
Lambda.const_string "value" =~ Lambda.Const_string "value" );
1010
]

tests/ounit_tests/ounit_string_literal_tests.ml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ let assert_lam_int expected = function
216216
| _ -> OUnit.assert_failure "expected a folded Lambda integer"
217217

218218
let assert_lam_char expected = function
219-
| Lambda.Lconst (Lambda.Const_char actual) ->
220-
assert_int_equal expected actual
219+
| Lambda.Lconst (Lambda.Const_char actual) -> assert_int_equal expected actual
221220
| _ -> OUnit.assert_failure "expected a folded Lambda character"
222221

223222
let typed_string s =
@@ -246,10 +245,8 @@ let assert_typed_template ~source_segments ~expected_semantics =
246245
end;
247246
match Translcore.transl_exp typed with
248247
| Lprim
249-
{
250-
primitive = Ptemplate segments;
251-
args = [Lconst (Const_string "value")];
252-
} ->
248+
{primitive = Ptemplate segments; args = [Lconst (Const_string "value")]}
249+
->
253250
OUnit.assert_equal ~printer:Ext_obj.dump source_segments
254251
(List.map (fun ({source} : Asttypes.template_segment) -> source) segments);
255252
OUnit.assert_equal ~printer:Ext_obj.dump expected_semantics
@@ -497,8 +494,8 @@ let suites =
497494
let semantic =
498495
convert_typed_constant (Asttypes.Const_string "a\n😀")
499496
in
500-
OUnit.assert_equal ~printer:Ext_obj.dump
501-
(Lambda.Const_string "a\n😀") semantic );
497+
OUnit.assert_equal ~printer:Ext_obj.dump (Lambda.Const_string "a\n😀")
498+
semantic );
502499
( "JavaScript IR distinguishes strings and template literals"
503500
>:: fun _ ->
504501
assert_js_string ~expected:"a\n😀" (Lambda.Const_string "a\n😀");

0 commit comments

Comments
 (0)