camlspotter avatar camlspotter committed 13049ef

self tweak (need ocamlc patch)

Comments (0)

Files changed (7)

         end;
         super#expression e
 
-(*
-and exp_extra =
-  | Texp_constraint of core_type option * core_type option
-  | Texp_open of Path.t * Longident.t loc * Env.t
-*)
+      method! exp_extra ee =
+        begin match ee with 
+        | Texp_constraint _ -> ()
+        | Texp_open (path, {loc}, _) -> record loc (Use (Kind.Module, path))
+        end;
+        super#exp_extra ee
 
       method !expression_desc ed =
         begin match ed with
         begin match ced with
         | Tcl_ident (path, {loc}, _) -> record loc (Use (Kind.Value, path)) 
         | Tcl_structure _ -> ()
-        | Tcl_fun (_, _, _lst (* CR jfuruse: ? *), _, _) -> ()
+        | Tcl_fun (_, _, lst , _, _) 
+        | Tcl_let (_, _, lst, _) -> 
+            List.iter (fun (id, {loc}, _) -> record loc (Str (AStr_value id))) lst
         | Tcl_apply _ -> ()
-        | Tcl_let (_, _, _lst (* CR jfuruse: ? *), _) -> ()
         | Tcl_constraint _ -> ()
         end;
         super#class_expr_desc ced
 (*
 
 and class_structure =
-  { cstr_pat : pattern;
+  { cstr_pat : pattern; (* this is self *)
     cstr_fields: class_field list;
     cstr_type : Types.class_signature;
-    cstr_meths: Ident.t Meths.t }
+    cstr_meths: Ident.t Meths.t (* CR jfuruse: to be done? *) }
+*)
 
+(*
 and class_field =
    {
     cf_desc : class_field_desc;
     cf_loc : Location.t;
   }
+*)
 
+(*
 and class_field_kind =
   Tcfk_virtual of core_type
 | Tcfk_concrete of expression
 
       method! class_field_desc cfd = 
         begin match cfd with
-        | Tcf_inher (_, _, _, _, _) -> ()
+        | Tcf_inher (_, ce, _, ivars, cmethods) -> 
+          let loc = ce.cl_loc in
+            List.iter (fun (_, id) -> record loc (Str (AStr_value id))) ivars;
+            List.iter (fun (_, id) -> record loc (Str (AStr_value id))) cmethods
         | Tcf_val (_name, {loc}, _, id, _, _) -> record loc (Str (AStr_value id))
         | Tcf_meth (_name, {loc=_loc}, _, _, _) -> ()
         | Tcf_constr _ -> ()
 
     and structure ppf =
       fprintf ppf "{ @[<v>%a@] }"
-        (Format.list "; " (fun ppf (id, (kind, t)) ->
+        (Format.list ";@ " (fun ppf (id, (kind, t)) ->
             fprintf ppf "@[<2>%s %s =@ %a@]" 
               (String.capitalize (Kind.to_string kind))
             (Ident.name id) z t))

tests/Makefile.targets

 class.cmo \
 class.cmi \
 class2.cmi \
+class_tmp_let.cmo \
 exception.cmo \
 exception_alias.cmo \
 exception_module.cmo \
 inherit2.cmo \
 interface.cmo \
 intermodule.cmo \
+let_open.cmo \
 localvar.cmo \
 module.cmo \
 module_alias.cmo \

tests/class_tmp_let.ml

+class c = 
+  let (* x => *) x (* <= x *) = 1 in
+  object
+    val v = x (* ? x *)
+    method get_x = x (* ? x *)
+  end

tests/let_open.ml

+module (* M => *) M (* <= M *) = struct
+  let (* x => *) x (* <= x *) = 1
+end
+
+let _ = 
+  let open M (* ? M *) (* damn, no position for M *) in
+  x (* ? x *)
+;;

tests/ocaml312.ml

-(* M => *)
-module M = struct
-  type (* M.t => *) t = { foo : int } (* <= M.t *)
+module (* M => *) M (* <= M *) = struct
+  type (* M.t => *) t (* <= M.t *) = { (* t.foo => *) foo (* <= t.foo *) : int } 
   let _ = fun (* foo1 => *) foo (* <= foo1 *) -> { foo (* ? foo1 *) (* ? M.t *) }
   let _ = fun { (* foo2 => *) foo (* <= foo2 *) (* ? M.t *) } -> foo (* ? foo2 *)
   let (* x => *) x (* <= x *) = 1
 end
-(* <= M *)
 
 let _ = fun (* foo3 => *) foo (* <= foo3 *) -> { M.foo (* ? foo3 *) (* ? M.t *) }
 let _ = fun { (* M.foo => *) M.foo (* <= M.foo *) (* ? M.t *) } -> foo (* ? M.foo *)
 ;;
 
 let _ = 
-  M. (* ? M *) (* damn, no position for M *) (x (* ? x *))
+  M(* ? M *) . (* damn, no position for M *) (x (* ? x *))
 ;;
 
 (* untested 

tests/set_field.ml

-type (* record => *) record = { mutable x : int } (* <= record *)
+type (* record => *) record (* <= record *)= { mutable (* x => *) x (* <= x *) : int } 
 
 let (* r => *) r (* <= r *) = { x = 0; } (* ? record *)
 
-let _ = r(* ? r *).x <- (* ? record *) 1 
+let _ = r(* ? r *).x (* ? x *) <- 1 
 
  
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.