Skip to content

Commit dc88212

Browse files
committed
Clean up lazy from ASTs and back-end.
Now that lazy is handled user-side, there's a bunch of unused code. The type `lazy_t` is still predefined, and module `Primitive_lazy.res` still exists. Perhaps `lazy_t` can be moved user side too, and `Primitive_lazy` just moved into `Stdlib_lazy`, which seems just a wrapper for it at the moment.
1 parent 429f901 commit dc88212

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+75
-443
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#### :house: Internal
4444

4545
- AST: Add bar location to `case`. https://github.com/rescript-lang/rescript/pull/7407
46+
- Clean up lazy from ASTs and back-end. https://github.com/rescript-lang/rescript/pull/7474
4647

4748
#### :nail_care: Polish
4849

analysis/reanalyze/src/Arnold.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -988,9 +988,6 @@ module Compile = struct
988988
| Texp_letexception _ ->
989989
notImplemented "Texp_letexception";
990990
assert false
991-
| Texp_lazy _ ->
992-
notImplemented "Texp_lazy";
993-
assert false
994991
| Texp_pack _ ->
995992
notImplemented "Texp_pack";
996993
assert false

analysis/reanalyze/src/SideEffects.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ let rec exprNoSideEffects (expr : Typedtree.expression) =
4545
partial = Total && e |> exprNoSideEffects
4646
&& cases |> List.for_all caseNoSideEffects
4747
| Texp_letmodule _ -> false
48-
| Texp_lazy e -> e |> exprNoSideEffects
4948
| Texp_try (e, cases) ->
5049
e |> exprNoSideEffects && cases |> List.for_all caseNoSideEffects
5150
| Texp_tuple el -> el |> List.for_all exprNoSideEffects

analysis/src/CompletionFrontEnd.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
538538
?contextPath:(TypeUtils.contextPathFromCoreType coreType)
539539
p
540540
| Ppat_type _ -> ()
541-
| Ppat_lazy p -> scopePattern ~patternPath ?contextPath p
542541
| Ppat_unpack {txt; loc} ->
543542
scope :=
544543
!scope |> Scope.addValue ~name:txt ~loc ?contextPath:contextPathToSave

analysis/src/CompletionPatterns.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ and traversePattern (pat : Parsetree.pattern) ~patternPath ~locHasCursor
4646
in
4747
match pat.ppat_desc with
4848
| Ppat_constant _ | Ppat_interval _ -> None
49-
| Ppat_lazy p
5049
| Ppat_constraint (p, _)
5150
| Ppat_alias (p, _)
5251
| Ppat_exception p

analysis/src/Hint.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ let inlay ~path ~pos ~maxLength ~debug =
5959
pexp_desc =
6060
( Pexp_constant _ | Pexp_tuple _ | Pexp_record _ | Pexp_variant _
6161
| Pexp_apply _ | Pexp_match _ | Pexp_construct _ | Pexp_ifthenelse _
62-
| Pexp_array _ | Pexp_ident _ | Pexp_try _ | Pexp_lazy _
63-
| Pexp_send _ | Pexp_field _ | Pexp_open _
62+
| Pexp_array _ | Pexp_ident _ | Pexp_try _ | Pexp_send _
63+
| Pexp_field _ | Pexp_open _
6464
| Pexp_fun {arity = Some _} );
6565
};
6666
} ->

analysis/src/ProcessCmt.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ let rec forStructureItem ~env ~(exported : Exported.t) item =
460460
| Tpat_or (p, _, _) -> handlePattern [] p
461461
| Tpat_record (items, _) ->
462462
items |> List.iter (fun (_, _, p, _) -> handlePattern [] p)
463-
| Tpat_lazy p -> handlePattern [] p
464463
| Tpat_variant (_, Some p, _) -> handlePattern [] p
465464
| Tpat_variant (_, None, _) | Tpat_any | Tpat_constant _ -> ()
466465
in

analysis/src/Utils.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ let identifyPexp pexp =
106106
| Pexp_letmodule _ -> "Pexp_letmodule"
107107
| Pexp_letexception _ -> "Pexp_letexception"
108108
| Pexp_assert _ -> "Pexp_assert"
109-
| Pexp_lazy _ -> "Pexp_lazy"
110109
| Pexp_newtype _ -> "Pexp_newtype"
111110
| Pexp_pack _ -> "Pexp_pack"
112111
| Pexp_extension _ -> "Pexp_extension"
@@ -129,7 +128,6 @@ let identifyPpat pat =
129128
| Ppat_or _ -> "Ppat_or"
130129
| Ppat_constraint _ -> "Ppat_constraint"
131130
| Ppat_type _ -> "Ppat_type"
132-
| Ppat_lazy _ -> "Ppat_lazy"
133131
| Ppat_unpack _ -> "Ppat_unpack"
134132
| Ppat_exception _ -> "Ppat_exception"
135133
| Ppat_extension _ -> "Ppat_extension"

compiler/common/pattern_printer.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ let untype typed =
3838
in
3939
mkpat (Ppat_record (fields, closed_flag))
4040
| Tpat_array lst -> mkpat (Ppat_array (List.map loop lst))
41-
| Tpat_lazy p -> mkpat (Ppat_lazy (loop p))
4241
in
4342
loop typed
4443

compiler/core/js_dump.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,12 +969,8 @@ and expression_desc cxt ~(level : int) f x : cxt =
969969
| _ -> J.Object (None, objs)
970970
in
971971
expression_desc cxt ~level f exp
972-
| Caml_block
973-
( _,
974-
_,
975-
_,
976-
(Blk_module_export _ | Blk_some | Blk_some_not_nested | Blk_lazy_general)
977-
) ->
972+
| Caml_block (_, _, _, (Blk_module_export _ | Blk_some | Blk_some_not_nested))
973+
->
978974
assert false
979975
| Caml_block (el, mutable_flag, _tag, Blk_tuple) ->
980976
expression_desc cxt ~level f (Array (el, mutable_flag))

0 commit comments

Comments
 (0)