Commits

camlspotter committed ea0a8ca

sub-module search

  • Participants
  • Parent commits 65e7e94
  • Branches gcaml

Comments (0)

Files changed (1)

File typing/dispatch.ml

     unify_with_dispatch env exp.exp_type typ (unify_exp env exp)
 
   module Recursives : sig
+
     val enter : pattern option -> Ident.t list -> (unit -> 'a) -> 'a
     (** [enter (Some pat) ids f] enter the definition of [pat], 
         which is defined with [ids], then execute the funciton [f] *)
+
     val find : Ident.t -> pattern option
     (** [find id] returns [Some pat] if [id] is defined recursively with [pat]
         and [pat] is in the current group stack *)
+
     val add_call : at:pattern -> Ident.t -> expression -> unit
     (** [add_call ~at:pat id exp] registers a recursive occurrence of [id] in
-        the definition of [pat], which is compiled to a Texp_rec, [exp] *)
-    val fix_calls : at:pattern -> (label * Ident.t * type_expr) list -> (Ident.t * type_expr) list -> unit
-    (** [fix_calls ~pat id_types] fixes recursive calls inside the definition
-        of [pat]. It may raise an unification error. *)
+        the definition of [pat], which is compiled to a Texp_rec,
+	[exp] *)
+
+    val fix_calls : 
+      at:pattern 
+      -> (label * Ident.t * type_expr) list 
+      -> (Ident.t * type_expr) list 
+      -> unit
+      (** [fix_calls ~pat id_types] fixes recursive calls inside the
+	  definition of [pat]. It may raise an unification error. *)
+
   end = struct
     let groups = ref []
 
   end
 
   module Resolve = struct
+
+    (* [unresolved_closed d] raises an exception complaining the
+       resultion of [d] is failed *)
     let unresolved_closed d =
       raise_error_closed_dispatch d.parent.exp_loc
         ~exp_type: d.parent.exp_type
 	      Path.Pdot(p, Ident.name id, pos) :: acc, pos'
 	  | (Tsig_type _ | Tsig_modtype _ | Tsig_cltype _) ->
 	      acc_pos
-	  | (Tsig_module _ | Tsig_exception _ | Tsig_class _) ->
+	  | Tsig_module (id, mty, _rec_status) ->
+	      (* CR jfuruse: Check recursive case *)
+	      (* recursively searched *)
+	      let p = Path.Pdot(p, Ident.name id, pos) in
+	      value_paths env p mty @ acc, pos + 1
+	  | ((* Tsig_module _ | *) Tsig_exception _ | Tsig_class _) ->
 	      acc, pos+1)
 	  ([], pos) sg
       end