Commits

camlspotter committed aae4395

fix of unwind_top

  • Participants
  • Parent commits df4cce3

Comments (0)

Files changed (2)

 
       | _ -> false
 
-let rec unwind_top = function (* unwind the top *)
+let rec unwind_top bases = match bases with (* unwind the top *)
   | { k = KLet (`Top, _) } :: bs -> bs
-  | ({ k = KModule _ } :: _ as bs) -> bs
+  | { k = (KStruct _ | KSig _) } :: _ -> bases
   | _ :: bs -> unwind_top bs
   | [] -> []
 

File tests/sig_struct.ml

+module LexReader : sig
+  type t
+  val create_from_channel : in_channel -> t
+end = struct
+  open Lexbuf
+
+  type t = Lexbuf.t * Lexing.lexbuf
+
+  let create_from_channel ic = 
+    let buf = Lexbuf.create () in
+    let f s n = 
+      let read_bytes = input ic s 0 n in
+      Lexbuf.add_substring buf s 0 read_bytes;
+      read_bytes
+    in
+    buf, Lexing.from_function f
+end