Skip to content

Commit 104b0f5

Browse files
committed
more labels
1 parent 4e45b78 commit 104b0f5

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

compiler/lib/flow.ml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -404,18 +404,21 @@ let rec the_shape_of info x =
404404
if Var.ISet.mem info.info_possibly_mutable x
405405
then Shape.Bot "possibly_mutable"
406406
else
407-
match info.info_defs.(Var.idx x) with
408-
| Expr (Block (_, a, _, Immutable)) ->
409-
Shape.Block (List.map ~f:(the_shape_of info) (Array.to_list a))
410-
| Expr (Closure (l, _)) ->
411-
Shape.Function { arity = List.length l; pure = false; res = Bot "unk" }
412-
| Expr (Special (Alias_prim name)) -> (
413-
try
414-
let arity = Primitive.arity name in
415-
let pure = Primitive.is_pure name in
416-
Shape.Function { arity; pure; res = Bot "unk" }
417-
with _ -> Bot "other")
418-
| _ -> Shape.Bot "other")
407+
match Shape.get x with
408+
| Some shape -> shape
409+
| None -> (
410+
match info.info_defs.(Var.idx x) with
411+
| Expr (Block (_, a, _, Immutable)) ->
412+
Shape.Block (List.map ~f:(the_shape_of info) (Array.to_list a))
413+
| Expr (Closure (l, _)) ->
414+
Shape.Function { arity = List.length l; pure = false; res = Bot "unk" }
415+
| Expr (Special (Alias_prim name)) -> (
416+
try
417+
let arity = Primitive.arity name in
418+
let pure = Primitive.is_pure name in
419+
Shape.Function { arity; pure; res = Bot "unk" }
420+
with _ -> Bot "other")
421+
| _ -> Shape.Bot "other"))
419422
(Bot "init")
420423
(fun _u _v -> Shape.Bot "merge")
421424
x

compiler/tests-full/stdlib.cma.expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33108,7 +33108,7 @@
3310833108

3310933109
//# unitInfo: Provides: Stdlib__MoreLabels
3311033110
//# unitInfo: Requires: Stdlib__Hashtbl, Stdlib__Map, Stdlib__Set
33111-
//# shape: Stdlib__MoreLabels:[N,N,N]
33111+
//# shape: Stdlib__MoreLabels:[[N,N,N,N,F(3),F(2),F(2),F(2),F(2),F(2),F(3),N,N,N,N,F(1),F(1),F(2),N,N,N,N,F(2),F(2),F(1),F(1),F(1),F(1),F(2),F(3),F(4)],[F(1)],[F(1)]]
3311233112
(function
3311333113
(globalThis){
3311433114
"use strict";

0 commit comments

Comments
 (0)