Commits

camlspotter committed 3ae7263

added tests

Comments (0)

Files changed (6)

 
   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)
   ;;
   
         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;

tests/class_arg.ml

+class c (* x => *) x (* <= x *) = object
+  method get_x = x (* ? x *) + 0 
+end
+let x = 1
+let y = 1
+include Inc1

tests/inherited_val.ml

+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