@@ -1545,10 +1545,18 @@ let rec project_ident_from_items
1545
1545
(cx :ctxt )
1546
1546
(lchk :loop_check )
1547
1547
(scopes :scope list )
1548
+ (scope_id :node_id )
1548
1549
((view :Ast.mod_view ),(items :Ast.mod_items ))
1549
1550
(ident :Ast.ident )
1550
1551
(inside :bool )
1551
1552
: resolved =
1553
+
1554
+ let lchk =
1555
+ if List. mem (scope_id, ident) lchk
1556
+ then err (Some scope_id) " cyclic import for ident %s" ident
1557
+ else (scope_id, ident)::lchk
1558
+ in
1559
+
1552
1560
if not (inside || (exports_permit view ident))
1553
1561
then None
1554
1562
else
@@ -1558,7 +1566,8 @@ let rec project_ident_from_items
1558
1566
| None ->
1559
1567
match htab_search view.Ast. view_imports ident with
1560
1568
None -> None
1561
- | Some name -> lookup_by_name cx lchk scopes name
1569
+ | Some name ->
1570
+ lookup_by_name cx lchk scopes name
1562
1571
1563
1572
and found cx scopes id =
1564
1573
Hashtbl. replace cx.ctxt_node_referenced id () ;
@@ -1578,7 +1587,7 @@ and project_name_comp_from_resolved
1578
1587
let ident = get_name_comp_ident ext in
1579
1588
let md = get_mod_item cx id in
1580
1589
Hashtbl. replace cx.ctxt_node_referenced id () ;
1581
- project_ident_from_items cx lchk scopes md ident false
1590
+ project_ident_from_items cx lchk scopes id md ident false
1582
1591
1583
1592
and lookup_by_name
1584
1593
(cx :ctxt )
@@ -1602,12 +1611,6 @@ and lookup_by_ident
1602
1611
(ident :Ast.ident )
1603
1612
: resolved =
1604
1613
1605
- let passing id =
1606
- if List. mem (id, ident) lchk
1607
- then err (Some id) " cyclic import for ident %s" ident
1608
- else (id, ident)::lchk
1609
- in
1610
-
1611
1614
let check_slots scopes islots =
1612
1615
arr_search islots
1613
1616
(fun _ (sloti ,ident' ) ->
@@ -1651,7 +1654,7 @@ and lookup_by_ident
1651
1654
1652
1655
| SCOPE_crate crate ->
1653
1656
project_ident_from_items
1654
- cx (passing crate.id) scopes crate.node.Ast. crate_items ident true
1657
+ cx lchk scopes crate.id crate.node.Ast. crate_items ident true
1655
1658
1656
1659
| SCOPE_obj_fn fn ->
1657
1660
would_capture (check_slots scopes fn.node.Ast. fn_input_slots)
@@ -1671,8 +1674,8 @@ and lookup_by_ident
1671
1674
end
1672
1675
1673
1676
| Ast. MOD_ITEM_mod md ->
1674
- project_ident_from_items cx (passing item.id)
1675
- scopes md ident true
1677
+ project_ident_from_items cx lchk
1678
+ scopes item.id md ident true
1676
1679
1677
1680
| _ -> None
1678
1681
in
0 commit comments