camlspotter avatar 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
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.