1. camlspotter
  2. ocamlspot

Commits

camlspotter  committed 3ae7263

added tests

  • Participants
  • Parent commits 821aa59
  • Branches 4.01.0.2.2.0

Comments (0)

Files changed (6)

File ocamlspot.ml

View file
  • Ignore whitespace
 
   let rannots unit = 
     eprintf "@[<2>rannots =@ [ @[<v>%a@]@] ]@."
-      (Format.list ";@ " (FileRegioned.format (Format.list ";@ " Annot.summary)))
+      (Format.list ";@ " (FileRegioned.format (Format.list ";@ " Annot.format)))
       !!(unit.Unit.rannots)
   ;;
   

File spot.ml

View file
  • Ignore whitespace
         record_use loc Kind.Class p;
         List.iter core_type core_types
     | Tcl_structure cs -> class_structure cs
-    | Tcl_fun (_label, pat, _pv, clexpr, _partial) ->
+    | Tcl_fun (_label, pat, classvals, clexpr, _partial) ->
         ignore & pattern pat;
+        class_values classvals;
         class_expr clexpr
     | Tcl_apply (clexpr, args) ->
         class_expr clexpr;
           match expropt with
           | None -> ()
           | Some expr -> expression expr) args
-    | Tcl_let (_rec_flag, pat_exp_list, _pv, clexpr) ->
+    | Tcl_let (_rec_flag, pat_exp_list, classvals, clexpr) ->
+        class_values classvals;
         List.iter (fun (pat, expr) ->
           ignore & pattern pat;
           expression expr) pat_exp_list;
         | Some cltyp -> class_type cltyp
         | None -> ()
 
+  and class_values xs =
+    (* I guess it is a info of class creation variables as class members *)
+    List.iter (fun (id, {loc}, expr) ->
+      record_def loc & AStr_value id;
+      expression expr) xs
+      
   and class_type cltyp = match cltyp.cltyp_desc with
     | Tcty_constr (p, {loc}, core_types) ->
         record_use loc Kind.Class_type p;

File tests/class_arg.ml

View file
  • Ignore whitespace
+class c (* x => *) x (* <= x *) = object
+  method get_x = x (* ? x *) + 0 
+end

File tests/inc1.ml

View file
  • Ignore whitespace
+let x = 1

File tests/inc2.ml

View file
  • Ignore whitespace
+let y = 1
+include Inc1

File tests/inherited_val.ml

View file
  • Ignore whitespace
+class c = object
+  val a = 1
+end
+
+class c' = object
+  inherit (* a => *) c (* <= a *) (* CR jfuruse: this should point to c's a *)
+  method get_a = a (* ? a *)
+end