File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -545,13 +545,28 @@ let init_module_type ctx context_init (decl,p) =
545
545
ctx.m.module_types < - ((match name with None -> tsub | Some (n ,pname ) -> rebind tsub n pname),p) :: ctx.m.module_types
546
546
with Not_found ->
547
547
(* this might be a static property, wait later to check *)
548
- let tmain = get_type tname in
549
- context_init#add (fun () ->
548
+ let find_main_type_static () =
549
+ let tmain = get_type tname in
550
550
try
551
551
add_static_init tmain name tsub
552
552
with Not_found ->
553
+ (* TODO: mention module-level declarations in the error message? *)
553
554
display_error ctx (s_type_path (t_infos tmain).mt_path ^ " has no field or subtype " ^ tsub) p
554
- ))
555
+ in
556
+ context_init#add (fun() ->
557
+ match md.m_statics with
558
+ | Some c ->
559
+ (try
560
+ ignore(c.cl_build() );
561
+ let _ = List. find (fun cf -> cf.cf_name = tsub) c.cl_ordered_statics in
562
+ let imported_name = match name with None -> tsub | Some (n ,pname ) -> n in
563
+ ctx.m.module_globals < - PMap. add imported_name (TClassDecl c,tsub,p) ctx.m.module_globals;
564
+ with Not_found ->
565
+ find_main_type_static () )
566
+ | None ->
567
+ find_main_type_static ()
568
+ )
569
+ )
555
570
| (tsub ,p2 ) :: (fname ,p3 ) :: rest ->
556
571
(match rest with
557
572
| [] -> ()
You can’t perform that action at this time.
0 commit comments