Commit 6c669a23 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-05-10 15:17:29 by jdemouth] Ce n'est pas parfait mais j'y travaille ;)

Original author: jdemouth
Date: 2004-05-10 15:17:29+00:00
parent fbc9d22a
......@@ -18,7 +18,7 @@ let cd_type_nil =
let nil = Atoms.atom ( Atoms.V.mk_ascii "nil" ) in Types.atom nil
let rec from_ocaml_rec left array = function
| { n_path = id; n_kind = ML_type; n_decl = decl } ->
| { n_path = id; n_kind = ML_type _; n_decl = decl } ->
Types.descr ( from_ocaml_type left array id decl )
| { n_kind = ML_value; n_decl = decl } ->
from_decl left array decl
......
module CD = Ml_cduce
module ML = Ml_ocaml
module Ty = Ml_types
type error =
| Undefined_value of string * string
| Type_mismatch of string * Ml_ocaml.Type.t * Ml_cduce.Type.t * Ml_cduce.Type.t
| Type_mismatch of string * string * ML.Type.t * CD.Type.t * CD.Type.t
exception Error of error
......@@ -10,29 +14,35 @@ let report_error = function
| Undefined_value ( file, func ) ->
Format.eprintf "cduce2ocaml : error in file %s.cmi:@." file;
Format.eprintf "Value %s has no counterpart in file %s.cdo@." func file
| Type_mismatch ( file, ml_t, ml_cd_t, cd_t ) ->
| Type_mismatch ( file, modname, ml_t, ml_cd_t, cd_t ) ->
Format.eprintf "cduce2ocaml : error in file %s.cmi:@." file;
Ml_cduce.Type.print Format.err_formatter cd_t;
CD.Type.print Format.err_formatter cd_t;
Format.eprintf "\nis not a subtype of@.";
Ml_cduce.Type.print Format.err_formatter ml_cd_t;
CD.Type.print Format.err_formatter ml_cd_t;
Format.eprintf "\nwhich is the canonical translation of@.";
Ml_ocaml.Type.print Format.err_formatter ml_t
ML.Type.print Format.err_formatter modname ml_t
(***********************************************************************************)
let run ml_cu cd_cu =
let file = Ml_cduce.CompUnit.module_name cd_cu in
String.set file 0 ( Char.lowercase ( String.get file 0 ) );
try Ml_ocaml.CompUnit.iter (
fun hnode -> match hnode.Ml_types.h_nodes with
| [ { Ml_types.n_kind = Ml_types.ML_value } as ml_t ] -> (
try
let cd_type = Ml_cduce.Type.from_ocaml ml_t
and cd_base = Ml_cduce.CompUnit.find_value cd_cu ( Ml_ocaml.ptos false ml_t.Ml_types.n_name ) in
if not ( Ml_cduce.Type.is_subtype cd_base cd_type )
then error ( Type_mismatch ( file, hnode, cd_type, cd_base ) );
with Not_found ->
error ( Undefined_value ( file, ( Ml_ocaml.ptos false ml_t.Ml_types.n_name ) ) ) )
| _ -> ()
) ml_cu
with Error e -> report_error e; exit 1
let hnode_checker file modname cduce_cu hnode = match hnode.Ty.h_nodes with
| [ { Ty.n_kind = Ty.ML_value } as caml_type ] ->
begin
let value_name = ML.ptos ( ML.Function modname ) caml_type.Ty.n_name in
try
let cduce_type = CD.Type.from_ocaml caml_type in
let cduce_base = CD.CompUnit.find_value cduce_cu value_name in
if not ( CD.Type.is_subtype cduce_base cduce_type )
then error ( Type_mismatch ( file, modname, hnode, cduce_type, cduce_base ) );
with Not_found ->
error ( Undefined_value ( file, value_name ) )
end
| _ -> ()
let run caml_cu cduce_cu =
let modname = CD.CompUnit.module_name cduce_cu in
let file = String.copy modname in
String.set file 0 ( Char.lowercase ( String.get modname 0 ) );
try
ML.CompUnit.iter ( hnode_checker file modname cduce_cu ) caml_cu
with Error e ->
report_error e; exit 1
open Ml_types
module CD = Ml_cduce
module OCaml = Ml_ocaml
(***********************************************************************************)
(* Context used to decide how to print a type. *)
module Ctx = struct
type t = {
ctx_cu: Ml_cduce.CompUnit.t;
ctx_cu: CD.CompUnit.t;
(* Parameter counter. *)
ctx_counter: int }
(* Create top position. *)
......@@ -46,7 +49,7 @@ type code_t =
| To_CDuce_reference of code_t * code_t
| To_CDuce_string
| To_CDuce_tuple of code_t list
| To_CDuce_type of ML.Path.t
| To_CDuce_type of OCaml_all.Path.t
| To_CDuce_unit
| To_CDuce_variant of ( string * code_t list ) list
| To_OCaml_bool
......@@ -58,7 +61,7 @@ type code_t =
| To_OCaml_record of ( string * code_t ) list
| To_OCaml_string
| To_OCaml_tuple of code_t list
| To_OCaml_type of ML.Path.t
| To_OCaml_type of OCaml_all.Path.t
| To_OCaml_unit
| To_OCaml_variant of ( string * code_t list ) list
......@@ -178,7 +181,7 @@ and dump_code fmt name = function
Format.fprintf fmt ") = %s in@." name;
print_list 0 list
| To_CDuce_type path ->
Format.fprintf fmt "ocaml2cduce__%s %s@." ( ML.Path.name path ) name
Format.fprintf fmt "ocaml2cduce__%s %s@." ( OCaml.ptos OCaml.Translation path ) name
| To_CDuce_variant list ->
let rec print_proj n m =
if n < m then begin
......@@ -318,8 +321,8 @@ and dump_code fmt name = function
print_list 0 list;
Format.fprintf fmt ")@.";
Format.fprintf fmt " | _ -> assert false@."
| To_OCaml_type id ->
Format.fprintf fmt "cduce2ocaml__%s %s@." ( Ml_ocaml.ptos false id ) name
| To_OCaml_type path ->
Format.fprintf fmt "cduce2ocaml__%s %s@." ( OCaml.ptos OCaml.Translation path ) name
| To_OCaml_unit ->
Format.fprintf fmt "()@."
| To_OCaml_variant list ->
......@@ -410,8 +413,8 @@ and generate_desc_to_ml_rec ctx (* name *) = function
let code1 = generate_desc_to_cd ctx lbl d1 in
let code2 = generate_desc_to_ml ctx lbl d2 in
To_OCaml_fun ( lbl, code1, code2 )
| ML_ident ( _, _, { Ml_types.n_path = path } ) ->
To_OCaml_type path
| ML_ident ( name, _, _ ) ->
To_OCaml_type name
| ML_list d ->
To_OCaml_list ( generate_desc_to_ml_rec ctx d )
| ML_no_manifest -> assert false
......@@ -463,8 +466,8 @@ and generate_desc_to_cd_rec ctx name = function
let code1 = generate_desc_to_ml ctx lbl d1 in
let code2 = generate_desc_to_cd ctx name d2 in
To_CDuce_fun ( name, lbl, code1, code2 )
| ML_ident ( _, _, { Ml_types.n_path = path } ) ->
To_CDuce_type path
| ML_ident ( name, _, _ ) ->
To_CDuce_type name
| ML_list d ->
To_CDuce_list ( generate_desc_to_cd_rec ctx name d )
| ML_no_manifest -> assert false
......@@ -483,15 +486,15 @@ and generate_ml_arg ctx = function
| Some lbl -> ctx, lbl
| None -> Ctx.generate_name ctx
and ml_value_slot ctx = Ml_cduce.CompUnit.find_value_slot ( Ctx.comp_unit ctx )
and ml_value_slot ctx = CD.CompUnit.find_value_slot ( Ctx.comp_unit ctx )
let generate_type_to_ml ctx is_rec list =
let rec internal first tail = function
| [] -> tail
| { Ml_types.n_path = id; (*Ml_types.rec = r;*) Ml_types.n_decl = decl } :: tl ->
| { n_path = id; (*rec = r;*) n_decl = decl } :: tl ->
let is_rec = is_rec (*|| r*) in
let code = generate_to_ml ctx "cdo2cmo__val" decl in
internal false ( tail @ [ Type_to_ml ( ( Ml_ocaml.ptos false id ),
internal false ( tail @ [ Type_to_ml ( ( OCaml.ptos OCaml.Translation id ),
first, is_rec, code ) ] ) tl
in
internal true [] list
......@@ -499,18 +502,18 @@ let generate_type_to_ml ctx is_rec list =
let generate_type_to_cd ctx is_rec list =
let rec internal first tail = function
| [] -> tail
| { Ml_types.n_path = id; (*Ml_types.rec = r;*) Ml_types.n_decl = decl } :: tl ->
| { n_path = id; (*rec = r;*) n_decl = decl } :: tl ->
let is_rec = (*r ||*) is_rec in
let code = generate_to_cd ctx "cdo2cmo__val" decl in
internal false ( tail @ [ Type_to_cd ( ( Ml_ocaml.ptos false id ),
internal false ( tail @ [ Type_to_cd ( ( OCaml.ptos OCaml.Translation id ),
first, is_rec, code ) ] ) tl
in
internal true [] list
(***********************************************************************************)
let ml_print fmt cu t =
let name = Ml_ocaml.ptos false t.n_name
let ml_print fmt modname cu t =
let name = OCaml.ptos ( OCaml.Function modname ) t.n_name
and decl = t.n_decl
and kind = t.n_kind in
let code = generate_ml ( Ctx.create cu ) name decl in dump fmt code
......@@ -518,28 +521,28 @@ let ml_print fmt cu t =
(***********************************************************************************)
module ML : sig
val generate : Format.formatter -> Ml_ocaml.CompUnit.t -> Ml_cduce.CompUnit.t -> unit
val generate : Format.formatter -> OCaml.CompUnit.t -> CD.CompUnit.t -> unit
end = struct
let generate fmt ml_cu cd_cu =
let mod_name = Ml_cduce.CompUnit.module_name cd_cu in
let mod_name = CD.CompUnit.module_name cd_cu in
Format.fprintf fmt "exception Error of string@.";
Format.fprintf fmt "let cdo2cmo__cu = Cdml.initialize \"%s\"@." mod_name;
Ml_ocaml.CompUnit.iter (
fun hnode -> match hnode.Ml_types.h_nodes with
| [ { Ml_types.n_kind = Ml_types.ML_type } as ml_type ] ->
Ml_ocaml.Type.print fmt hnode;
OCaml.CompUnit.iter (
fun hnode -> match hnode.h_nodes with
| [ { n_kind = ML_type _ } as ml_type ] ->
OCaml.Type.print fmt mod_name hnode;
let code = generate_type_to_ml ( Ctx.create cd_cu ) false [ ml_type ] in
dump_list fmt code;
let code = generate_type_to_cd ( Ctx.create cd_cu ) false [ ml_type ] in
dump_list fmt code
| ( { Ml_types.n_kind = Ml_types.ML_type } :: tl ) ->
Ml_ocaml.Type.print fmt hnode;
let code = generate_type_to_ml ( Ctx.create cd_cu ) true hnode.Ml_types.h_nodes in
| ( { n_kind = ML_type _ } :: tl ) ->
OCaml.Type.print fmt mod_name hnode;
let code = generate_type_to_ml ( Ctx.create cd_cu ) true hnode.h_nodes in
dump_list fmt code;
let code = generate_type_to_cd ( Ctx.create cd_cu ) true hnode.Ml_types.h_nodes in
let code = generate_type_to_cd ( Ctx.create cd_cu ) true hnode.h_nodes in
dump_list fmt code
| [ { Ml_types.n_kind = Ml_types.ML_value } as ml_type ] ->
ml_print fmt cd_cu ml_type
| [ { n_kind = ML_value } as ml_type ] ->
ml_print fmt mod_name cd_cu ml_type
| _ -> ()
) ml_cu
end
......@@ -25,135 +25,209 @@ module ML = OCaml_all
(***********************************************************************************)
let local_file = ref ""
type flag = Path of string | Function of string | Translation
(***********************************************************************************)
let rec print_list fmt separator f = function
| [] -> assert false
| hd :: [] -> f fmt hd
| hd :: tl ->
f fmt hd;
Format.fprintf fmt "%s" separator;
print_list fmt separator f tl
let matches info = function
| Path _ -> info = `Path
| Function _ -> info = `Function
| Translation -> info = `Translation
let rec ptos_aux flag = function
| ML.Path.Pident ident ->
let ident = ML.Ident.name ident in
ident ^ ( if flag then "." else "_" )
| ML.Path.Pdot ( p, s, _ ) ->
Format.sprintf "%s%s" ( ptos_aux flag p ) s
| ML.Path.Papply ( p1, p2 ) ->
let p1 = ptos_aux flag p1 and p2 = ptos_aux flag p2 in
if flag then Format.sprintf "%s(%s)" p1 p2 else Format.sprintf "%s_%s" p1 p2
if matches `Path flag then p1 ^ "(" ^ p2 ^ ")" else p1 ^ "_" ^ p2
| ML.Path.Pdot ( p, s, _ ) ->
let p = ptos_aux flag p in p ^ s
| ML.Path.Pident ident ->
let ident = ML.Ident.name ident in
let local = match flag with Path s -> s | Function s -> s | _ -> "" in
if not ( matches `Translation flag ) && ident = local then ""
else if matches `Path flag then ident ^ "." else ident ^ "_"
let rec ptos flag = function
| ML.Path.Papply ( p1, p2 ) as path ->
if flag then Format.sprintf "%s(%s)" ( ptos flag p1 ) ( ptos flag p2 )
else ptos_aux flag path
| ML.Path.Pdot _ as path ->
let head = ML.Ident.name ( ML.Path.head path ) in
if head = !local_file && flag then
match path with
| ML.Path.Pdot ( _, s, _ ) -> s
| _ -> assert false
else ptos_aux flag path
| ML.Path.Papply ( p1, p2 ) ->
let p1 = ptos flag p1 and p2 = ptos flag p2 in
if matches `Path flag then p1 ^ "(" ^ p2 ^ ")" else p1 ^ "_" ^ p2
| ML.Path.Pdot ( p, s, _ ) ->
let p = ptos_aux flag p in p ^ s
| ML.Path.Pident ident ->
Format.sprintf "%s" ( ML.Ident.name ident )
ML.Ident.name ident
(***********************************************************************************)
module Code = struct
type mli =
| Mli_arrow of string * mli * mli
| Mli_ident of string * mli list
| Mli_record of ( bool * string * mli ) list
| Mli_tuple of mli list
| Mli_type of string * bool * int * mli option
| Mli_value of string * mli
| Mli_var of int
| Mli_variant of ( string * mli list ) list
end
(***********************************************************************************)
let rec print_list fmt felt fsep = function
| [] -> ()
| hd :: [] -> felt hd
| hd :: tl -> felt hd; fsep (); print_list fmt felt fsep tl
let rec print_mli fmt = function
| Code.Mli_arrow ( label, left, right ) ->
if label <> "" then Format.fprintf fmt "(%s:@" label
else Format.fprintf fmt "(";
print_mli fmt left;
Format.fprintf fmt ")@ ->@";
print_mli fmt right
| Code.Mli_ident ( ident, args ) ->
if args <> [] then
begin
Format.fprintf fmt "(";
let felt = print_mli fmt in
let fsep = fun _ -> Format.fprintf fmt "," in
print_list fmt felt fsep args;
Format.fprintf fmt ")@"
end;
Format.fprintf fmt "%s" ident
| Code.Mli_record list ->
Format.fprintf fmt "{ ";
let felt ( mut, label, code ) =
if mut then Format.fprintf fmt "mutable@";
Format.fprintf fmt "%s: " label;
print_mli fmt code
in
let fsep = fun _ -> Format.fprintf fmt "; " in
print_list fmt felt fsep list;
Format.fprintf fmt " }"
| Code.Mli_tuple list ->
let felt = print_mli fmt in
let fsep = fun _ -> Format.fprintf fmt " * " in
print_list fmt felt fsep list
| Code.Mli_type ( name, top, args, code ) ->
if top then Format.fprintf fmt "@[type " else Format.fprintf fmt "@[and ";
if args <> 0 then
begin
Format.fprintf fmt "(";
print_mli fmt ( Code.Mli_var 0 );
for i = 1 to args - 1 do
Format.fprintf fmt ",";
print_mli fmt ( Code.Mli_var i )
done;
Format.fprintf fmt ")"
end;
begin
match code with
| None -> Format.fprintf fmt "%s" name
| Some code ->
Format.fprintf fmt "%s = " name;
print_mli fmt code
end;
Format.fprintf fmt "@]@."
| Code.Mli_value ( name, code ) ->
Format.fprintf fmt "@[val %s = " name;
print_mli fmt code;
Format.fprintf fmt "@]@."
| Code.Mli_var i ->
Format.fprintf fmt "'%c" ( Char.chr ( i + 49 ) )
| Code.Mli_variant list ->
let felt = function
| name, [] -> Format.fprintf fmt "%s" name
| name, list ->
Format.fprintf fmt "%s of " name;
let felt = print_mli fmt in
let fsep = fun _ -> Format.fprintf fmt " * " in
print_list fmt felt fsep list
in
let fsep = fun _ -> Format.fprintf fmt " | " in
print_list fmt felt fsep list
let print_type_preambule fmt top path =
if top then Format.fprintf fmt "type %s = " ( ptos true path )
else Format.fprintf fmt "and %s = " ( ptos true path )
(***********************************************************************************)
module PPrint : sig
val dump_mli : Format.formatter -> Code.mli -> unit
end = struct
let dump_mli = print_mli
end
(***********************************************************************************)
let rec print_hnode fmt { h_nodes = nodes } = match nodes with
let rec generate_hnode flag { h_nodes = nodes } = match nodes with
| [] -> assert false
| hd :: tl ->
print_node fmt true hd;
List.iter ( print_node fmt false ) tl
and print_node fmt top node = match node.n_kind, node.n_decl with
| ML_module, ML_modsign list ->
Format.fprintf fmt "module %s : sig @." ( ptos true node.n_name );
List.iter ( print_hnode fmt ) list;
Format.fprintf fmt "end@."
| ML_type, ML_abstract ML_no_manifest ->
Format.fprintf fmt "type %s@." ( ptos true node.n_name )
| ML_type, ML_abstract desc ->
print_type_preambule fmt top node.n_name;
print_desc fmt desc;
Format.fprintf fmt " @."
| ML_type, ML_record list ->
(* PATTERN: { name: desc; name: desc; ...; name: desc } *)
print_type_preambule fmt top node.n_name;
Format.fprintf fmt "{ ";
let f = fun fmt ( n, d ) -> Format.fprintf fmt "%s: " n; print_desc fmt d in
print_list fmt "; " f list;
Format.fprintf fmt "}@."
| ML_type, ML_variant list ->
(* PATTERN: Name of list | Name of list | ... | Name of list *)
print_type_preambule fmt top node.n_name;
let f = fun fmt ( n, l ) -> match l with
| [] -> Format.fprintf fmt "%s" n;
| hd :: [] -> Format.fprintf fmt "%s of " n; print_desc fmt hd
| _ -> Format.fprintf fmt "%s of " n; print_list fmt " * " print_desc l
in
print_list fmt " | " f list
let hd = generate_node flag true hd
and tl = List.map ( generate_node flag false ) tl in
hd :: tl
and generate_node flag top node = match node.n_kind, node.n_decl with
| ML_module, ML_modsign list -> assert false
(*
Format.fprintf fmt "module %s : sig@." ( ptos Path node.n_name );
List.iter ( generate_hnode fmt ) list;
Format.fprintf fmt "end@."
*)
| ML_type arity, ML_abstract ML_no_manifest ->
Code.Mli_type ( ptos flag node.n_name, true, arity, None )
| ML_type arity, ML_abstract desc ->
let code = generate_desc flag desc in
Code.Mli_type ( ptos flag node.n_name, top, arity, Some code )
| ML_type arity, ML_record list ->
let f = fun ( f, d ) -> false, f, generate_desc flag d in
let list = List.map f list in
let code = Some ( Code.Mli_record list ) in
Code.Mli_type ( ptos flag node.n_name, top, arity, code )
| ML_type arity, ML_variant list ->
let f = fun ( f, l ) -> f, List.map ( generate_desc flag ) l in
let list = List.map f list in
let code = Some ( Code.Mli_variant list ) in
Code.Mli_type ( ptos flag node.n_name, top, arity, code )
| ML_value, ML_abstract desc ->
Format.fprintf fmt "val %s : " ( ptos true node.n_name );
print_desc fmt desc;
Format.fprintf fmt "@."
Code.Mli_value ( ptos flag node.n_name, generate_desc flag desc )
| _ -> assert false
and print_desc fmt = function
| ML_any -> ()
and generate_desc flag = function
| ML_any -> assert false
| ML_arrow ( None, d1, d2 ) ->
Format.fprintf fmt "( ";
print_desc fmt d1;
Format.fprintf fmt " ) -> ";
print_desc fmt d2
Code.Mli_arrow ( "", generate_desc flag d1, generate_desc flag d2 )
| ML_arrow ( Some lbl, d1, d2 ) ->
Format.fprintf fmt "%s:( " lbl;
print_desc fmt d1;
Format.fprintf fmt " ) -> ";
print_desc fmt d2
| ML_bool -> Format.fprintf fmt "bool"
| ML_char -> Format.fprintf fmt "char"
Code.Mli_arrow ( lbl, generate_desc flag d1, generate_desc flag d2 )
| ML_bool ->
Code.Mli_ident ( "bool", [] )
| ML_char ->
Code.Mli_ident ( "char", [] )
| ML_ident ( name, [||], _ ) ->
Format.fprintf fmt "%s" ( ptos true name )
| ML_ident ( name, array, { n_path = path } ) ->
Format.fprintf fmt "( ";
let le = ( Array.length array ) - 1 in
for i = 0 to le do
print_desc fmt array.( i );
if i < le then Format.fprintf fmt ","
done;
Format.fprintf fmt " ) %s " ( ptos true name )
| ML_int -> Format.fprintf fmt "int"
Code.Mli_ident ( ptos flag name, [] )
| ML_ident ( name, array, _ ) ->
let list = ref [] in
let f = fun d -> list := !list @ [ generate_desc flag d ] in
Array.iter f array;
Code.Mli_ident ( ptos flag name, !list )
| ML_int ->
Code.Mli_ident ( "int", [] )
| ML_list desc ->
print_desc fmt desc;
Format.fprintf fmt " list"
| ML_no_manifest -> ()
Code.Mli_ident ( "list", [ generate_desc flag desc ] )
| ML_no_manifest -> assert false
| ML_option desc ->
print_desc fmt desc;
Format.fprintf fmt " option"
Code.Mli_ident ( "option", [ generate_desc flag desc ] )
| ML_reference desc ->
print_desc fmt desc;
Format.fprintf fmt " ref"
| ML_string -> Format.fprintf fmt "string"
Code.Mli_ident ( "Pervasives.ref", [ generate_desc flag desc ] )
| ML_string ->
Code.Mli_ident ( "string", [] )
| ML_tuple list ->
Format.fprintf fmt "(";
print_list fmt " * " print_desc list;
Format.fprintf fmt ")"
| ML_unit -> Format.fprintf fmt "unit"
| ML_var id -> Format.fprintf fmt "(%d)" id
Code.Mli_tuple ( List.map ( generate_desc flag ) list )
| ML_unit ->
Code.Mli_ident ( "unit", [] )
| ML_var id ->
Code.Mli_var id
(***********************************************************************************)
module Type = struct
type t = ocaml_hypernode;;
let print = print_hnode
let print fmt modname hnode =
let code = generate_hnode ( Path modname ) hnode in
List.iter ( PPrint.dump_mli fmt ) code
end
(***********************************************************************************)
......@@ -175,8 +249,8 @@ let create_map list =
let node_table = NodeTbl.create 41
let create_node name =
let node = mk_node name in NodeTbl.add node_table name node; node
let create_node name arity =
let node = mk_node name arity in NodeTbl.add node_table name node; node
let find_node path =
NodeTbl.find node_table path
......@@ -260,14 +334,14 @@ and translate_type_constr lident map name list =
if is_cduce_any path then ML_any
else
begin
let node = create_node name in
let node = create_node name decl.ML.Types.type_arity in
node.n_path <- path;
let desc = translate_type_declaration lident decl in
node.n_decl <- desc;
ML_ident ( name, translate_parameters lident map list, node )
end
with Not_found ->
let node = create_node name in
let node = create_node name 0 in
ML_ident ( name, translate_parameters lident map list, node )
end
......@@ -405,7 +479,7 @@ and translate_signature_item lident hctx = function
node, add_node_to_curr hctx node
with Not_found ->
begin
let node = create_node name in
let node = create_node name decl.ML.Types.type_arity in
let decl = translate_type_declaration lident decl in
node.n_decl <- decl;
node, flush_curr_hnode hctx node
......@@ -414,10 +488,11 @@ and translate_signature_item lident hctx = function
node.n_path <- path;
hctx
end