|
@@ -375,25 +375,28 @@ let init_module_type ctx context_init do_init (decl,p) =
|
|
|
chk_private t p_type;
|
|
|
t
|
|
|
in
|
|
|
- let rebind t name =
|
|
|
+ let rebind t name p =
|
|
|
if not (name.[0] >= 'A' && name.[0] <= 'Z') then
|
|
|
error "Type aliases must start with an uppercase letter" p;
|
|
|
let _, _, f = ctx.g.do_build_instance ctx t p_type in
|
|
|
(* create a temp private typedef, does not register it in module *)
|
|
|
- TTypeDecl {
|
|
|
+ let mt = TTypeDecl {
|
|
|
t_path = (fst md.m_path @ ["_" ^ snd md.m_path],name);
|
|
|
t_module = md;
|
|
|
t_pos = p;
|
|
|
- t_name_pos = null_pos;
|
|
|
+ t_name_pos = p;
|
|
|
t_private = true;
|
|
|
t_doc = None;
|
|
|
t_meta = [];
|
|
|
t_params = (t_infos t).mt_params;
|
|
|
t_type = f (List.map snd (t_infos t).mt_params);
|
|
|
- }
|
|
|
+ } in
|
|
|
+ if ctx.is_display_file && Display.is_display_position p then
|
|
|
+ Display.DisplayEmitter.display_module_type ctx.com.display mt p;
|
|
|
+ mt
|
|
|
in
|
|
|
let add_static_init t name s =
|
|
|
- let name = (match name with None -> s | Some n -> n) in
|
|
|
+ let name = (match name with None -> s | Some (n,_) -> n) in
|
|
|
match resolve_typedef t with
|
|
|
| TClassDecl c ->
|
|
|
ignore(c.cl_build());
|
|
@@ -413,14 +416,14 @@ let init_module_type ctx context_init do_init (decl,p) =
|
|
|
(match name with
|
|
|
| None ->
|
|
|
ctx.m.module_types <- List.filter no_private (List.map (fun t -> t,p) types) @ ctx.m.module_types
|
|
|
- | Some newname ->
|
|
|
- ctx.m.module_types <- (rebind (get_type tname) newname,p) :: ctx.m.module_types);
|
|
|
+ | Some(newname,pname) ->
|
|
|
+ ctx.m.module_types <- (rebind (get_type tname) newname pname,p) :: ctx.m.module_types);
|
|
|
| [tsub,p2] ->
|
|
|
let pu = punion p1 p2 in
|
|
|
(try
|
|
|
let tsub = List.find (has_name tsub) types in
|
|
|
chk_private tsub pu;
|
|
|
- ctx.m.module_types <- ((match name with None -> tsub | Some n -> rebind tsub n),p) :: ctx.m.module_types
|
|
|
+ ctx.m.module_types <- ((match name with None -> tsub | Some(n,pname) -> rebind tsub n pname),p) :: ctx.m.module_types
|
|
|
with Not_found ->
|
|
|
(* this might be a static property, wait later to check *)
|
|
|
let tmain = get_type tname in
|