@@ -10,13 +10,17 @@ pred main-str i:string, i:string, i:int.
1010main-str S STgt Depth :- coq.locate S GR, main-gref GR STgt Depth.
1111
1212pred main-gref i:gref, i:string, i:int.
13+ main-gref GR STgt Depth :- class-def (class _ GR _), !,
14+ private.mixins-in-structures [GR] MLSrc,
15+ main-from MLSrc STgt Depth.
1316main-gref GR STgt Depth :-
14- private.mixins-on-gref GR MLSrc,
17+ private.structures-on-gref GR SL,
18+ private.mixins-in-structures SL MLSrc,
1519 main-from MLSrc STgt Depth.
1620
1721pred main-from i:list mixinname, i:string, i:int.
1822main-from MLSrc STgt Depth :-
19- private.mixins-in-string STgt MLTgt,
23+ private.mixins-in-structures [{coq.locate STgt}] MLTgt,
2024 private.list-diff MLTgt MLSrc ML,
2125 if (ML = []) (coq.say "HB: nothing to do.")
2226 (private.paths-from-for-step MLSrc ML Depth R,
@@ -59,20 +63,19 @@ lexi-order [] [].
5963lexi-order [X1|_] [X2|_] :- lt-gref X1 X2.
6064lexi-order [X|T1] [X|T2] :- lexi-order T1 T2.
6165
62- % [mixins -on-gref GR ML] list mixins in structures [GR] is equipped with
63- pred mixins -on-gref i:gref, o:list mixinname .
64- mixins -on-gref GR ML :-
66+ % [structures -on-gref GR ML] list structures [GR] is equipped with
67+ pred structures -on-gref i:gref, o:list structure .
68+ structures -on-gref GR SL :-
6569 std.filter {coq.CS.db-for _ (cs-gref GR)} (about.not1 about.unif-hint?) LV,
66- std.fold LV [] mixins-on-gref.aux ML.
67- mixins-on-gref.aux (cs-instance _ _ GR) L L' :-
68- coq.prod-tgt->gref {coq.env.typeof GR} F,
69- class-def (class _ F MLWP),
70- union L {list-w-params_list MLWP} L'.
71-
72- % [mixins-in-string S ML] list mixins contained in structure [S]
73- pred mixins-in-string i:string, o:list mixinname.
74- mixins-in-string S ML :-
75- coq.locate S GR, class-def (class _ GR MLwP), list-w-params_list MLwP ML.
70+ std.map LV structures-on-gref.aux SL.
71+ structures-on-gref.aux (cs-instance _ _ GR) F :-
72+ coq.prod-tgt->gref {coq.env.typeof GR} F, class-def (class _ F _).
73+
74+ % [mixins-in-structures SL ML] list mixins in structures [SL]
75+ pred mixins-in-structures i:list structure, o:list mixinname.
76+ mixins-in-structures SL ML :- std.fold SL [] mixins-in-structures.aux ML.
77+ mixins-in-structures.aux F L L' :-
78+ class-def (class _ F MLWP), union L {list-w-params_list MLWP} L'.
7679
7780% a type to store a factory along with the mixins it depends on
7881% and the mixins it provides
0 commit comments