File tree Expand file tree Collapse file tree 6 files changed +25
-14
lines changed Expand file tree Collapse file tree 6 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ let encode_single (db : Bsb_db.map) (buf : Ext_buffer.t) =
8282 let len_encoding = make_encoding length buf in
8383 Map_string. iter db (fun _ module_info ->
8484 len_encoding buf
85- (Hash_string. find_exn mapping module_info.dir lsl 1 + Obj. magic module_info.case ));
85+ (Hash_string. find_exn mapping module_info.dir lsl 1 + ( Obj. magic ( module_info.case : bool ) : int ) ));
8686 nl buf
8787 end
8888let encode (dbs : Bsb_db.t ) buf =
Original file line number Diff line number Diff line change @@ -60,13 +60,13 @@ let sanity_check (map : t) =
6060let check (x : module_info )
6161 name_sans_extension
6262 case
63- is_re
63+ syntax_kind
6464 (module_info : Bsb_db.info )
6565 =
6666 let x_ml_info = x.info in
6767 (if x.name_sans_extension <> name_sans_extension
6868 || x.case <> case
69- || x.is_re <> is_re
69+ || x.syntax_kind <> syntax_kind
7070 || x_ml_info = module_info
7171 || x_ml_info = Impl_intf
7272 then
@@ -87,24 +87,24 @@ let add_basename
8787 ?(error_on_invalid_suffix )
8888 basename : t =
8989 let info = ref Bsb_db. Impl in
90- let is_re = ref false in
90+ let syntax_kind = ref Bsb_db. Ml in
9191 let invalid_suffix = ref false in
9292 (match Ext_filename. get_extension_maybe basename with
9393 | ".ml" ->
9494 ()
9595 | ".re" ->
96- is_re := true
96+ syntax_kind := Reason
9797 | ".mli" ->
9898 info := Intf
9999 | ".rei" ->
100100 info := Intf ;
101- is_re := true
101+ syntax_kind := Reason
102102 | _ ->
103103 invalid_suffix := true
104104
105105 );
106106 let info= ! info in
107- let is_re = ! is_re in
107+ let syntax_kind = ! syntax_kind in
108108 let invalid_suffix = ! invalid_suffix in
109109 if invalid_suffix then
110110 match error_on_invalid_suffix with
@@ -127,7 +127,7 @@ let add_basename
127127 (fun opt_module_info ->
128128 match opt_module_info with
129129 | None ->
130- {dir ; name_sans_extension ; info ; is_re ; case }
130+ {dir ; name_sans_extension ; info ; syntax_kind ; case }
131131 | Some x ->
132- check x name_sans_extension case is_re info
132+ check x name_sans_extension case syntax_kind info
133133 )
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ let emit_module_build
7373 (module_info : Bsb_db.module_info )
7474 =
7575 let has_intf_file = module_info.info = Impl_intf in
76- let is_re = module_info.is_re in
76+ let is_re = module_info.syntax_kind = Reason in
7777 let filename_sans_extension = module_info.name_sans_extension in
7878 let input_impl =
7979 Bsb_config. proj_rel
Original file line number Diff line number Diff line change @@ -31,12 +31,16 @@ type info =
3131 | Intf (* intemediate state *)
3232 | Impl
3333 | Impl_intf
34+
35+ type syntax_kind =
36+ | Ml
37+ | Reason
3438
3539type module_info =
3640 {
3741 mutable info : info ;
3842 dir : string ;
39- is_re : bool ;
43+ syntax_kind : syntax_kind ;
4044 case : bool ;
4145 name_sans_extension : string ;
4246 }
Original file line number Diff line number Diff line change @@ -37,13 +37,20 @@ type info =
3737 | Impl
3838 | Impl_intf
3939
40+ type syntax_kind =
41+ | Ml
42+ | Reason
4043
4144
4245type module_info =
4346 {
4447 mutable info : info ;
4548 dir : string ;
46- is_re : bool ;
49+ syntax_kind : syntax_kind ;
50+ (* This is actually not stored in bsbuild meta info
51+ since creating .d file only emit .cmj/.cmi dependencies, so it does not
52+ need know which syntax it is written
53+ *)
4754 case : bool ;
4855 name_sans_extension : string ;
4956 }
Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ let s_test1 s a =
3434
3535let group0 = Map_string. of_list [
3636 " Liba" ,
37- {Bsb_db. info = Impl_intf ; dir= " a" ;is_re = false ;case = false ;
37+ {Bsb_db. info = Impl_intf ; dir= " a" ;syntax_kind = Ml ;case = false ;
3838 name_sans_extension = " liba" }
3939]
4040let group1 = Map_string. of_list [
4141 " Ciba" ,
42- {Bsb_db. info = Impl_intf ; dir= " b" ;is_re = false ;case = false ;
42+ {Bsb_db. info = Impl_intf ; dir= " b" ;syntax_kind = Ml ;case = false ;
4343 name_sans_extension = " liba" }
4444]
4545
You can’t perform that action at this time.
0 commit comments