Anonymous avatar Anonymous committed f1ec838

for functor parameter (not finished)

Comments (0)

Files changed (4)

     utils/misc.cmx typing/ident.cmx typing/btype.cmx typing/subst.cmi 
 typing/typeclass.cmo: utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \
     typing/typedtree.cmi typing/typedecl.cmi typing/typecore.cmi \
-    typing/subst.cmi typing/stypes.cmi typing/printtyp.cmi typing/predef.cmi \
-    typing/path.cmi parsing/parsetree.cmi typing/parmatch.cmi utils/misc.cmi \
-    parsing/longident.cmi parsing/location.cmi typing/includeclass.cmi \
-    typing/ident.cmi typing/env.cmi typing/ctype.cmi utils/clflags.cmi \
-    typing/btype.cmi parsing/asttypes.cmi typing/typeclass.cmi 
+    typing/subst.cmi typing/stypes.cmi typing/spot.cmi typing/printtyp.cmi \
+    typing/predef.cmi typing/path.cmi parsing/parsetree.cmi \
+    typing/parmatch.cmi utils/misc.cmi parsing/longident.cmi \
+    parsing/location.cmi typing/includeclass.cmi typing/ident.cmi \
+    typing/env.cmi typing/ctype.cmi utils/clflags.cmi typing/btype.cmi \
+    parsing/asttypes.cmi typing/typeclass.cmi 
 typing/typeclass.cmx: utils/warnings.cmx typing/typetexp.cmx typing/types.cmx \
     typing/typedtree.cmx typing/typedecl.cmx typing/typecore.cmx \
-    typing/subst.cmx typing/stypes.cmx typing/printtyp.cmx typing/predef.cmx \
-    typing/path.cmx parsing/parsetree.cmi typing/parmatch.cmx utils/misc.cmx \
-    parsing/longident.cmx parsing/location.cmx typing/includeclass.cmx \
-    typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/clflags.cmx \
-    typing/btype.cmx parsing/asttypes.cmi typing/typeclass.cmi 
+    typing/subst.cmx typing/stypes.cmx typing/spot.cmx typing/printtyp.cmx \
+    typing/predef.cmx typing/path.cmx parsing/parsetree.cmi \
+    typing/parmatch.cmx utils/misc.cmx parsing/longident.cmx \
+    parsing/location.cmx typing/includeclass.cmx typing/ident.cmx \
+    typing/env.cmx typing/ctype.cmx utils/clflags.cmx typing/btype.cmx \
+    parsing/asttypes.cmi typing/typeclass.cmi 
 typing/typecore.cmo: utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \
     typing/typedtree.cmi typing/stypes.cmi typing/spot.cmi \
     typing/printtyp.cmi typing/primitive.cmi typing/predef.cmi \

Binary file modified.

ocamlspot/ocamlspot.ml

       | Ident of PIdent.t (* ? PIdent.t *)
       | Structure of PIdent.t * structure
       | Closure of PIdent.t * env * Ident.t * Types.module_type * Abstraction.module_expr
+      | Parameter of PIdent.t
       | Error of exn 
     (* <= Value.t *)
 
 	    in
             str' @ str) [] sitems
 
+
+    (* create functor parameter values *)
+    let structure_flat env flat = 
+      let str = structure env flat in
+      List.fold_left (fun str -> function
+	| Str_module (id, Mod_functor (id, _mty, _mexp)) ->
+	    id, (Kind.Module, Parameter { PIdent.path = env.Env.path;
+					  ident = id }) :: str
+	| _ -> str) str flat
   end
 
   module File = struct
         let flat = 
 	  List.fold_left (fun st (_, annot) -> 
 	    match annot with
-	    | Annot.Str sitem -> 
-                begin match sitem with
-                | Abstraction.Str_module 
-                    (_, Abstraction.Mod_functor (id, mty, _mexp)) -> 
-                    (* fake a sitem for the functor parameter *)
-                    begin match mty with
-                    | Types.Tmty_ident _ -> assert false (* it is already scraped *)
-                    | Types.Tmty_signature sgitems ->
-                        let sitems = List.map Spot.Abstraction.signature_item sgitems in
-                        Value.Structure ({ PIdent.path = source_path;
-                                           ident = Some id }, sitems) :: sitems  
-                    | Types.Tmty_functor _ (* Ident.t * module_type * module_type *) ->
-                        [] (* not yet done *)
-                    end
-                | _ -> []
-                end @ sitem :: st
+	    | Annot.Str sitem -> sitem :: st
 	    | Annot.Type _ 
             | Annot.Use _
 	    | Annot.Module _ 
     let find_path_in_flat file path : PIdent.t * Location.t =
       let env = 
 	let env = invalid_env file in
-	let str = Eval.structure env file.flat in
+	let str = Eval.structure_flat env file.flat in
 	env.Env.binding := Some str; (* dirty hack *)
         env
       in
   val structure_item : Typedtree.structure_item -> structure_item list
   val module_type : Types.module_type -> module_expr
   val signature_item : Types.signature_item -> structure_item
-  val functor_parameter : Ident.t -> Types.module_type -> module_expr
 end
 
 module Annot : sig
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.