Commits

camlspotter committed 096f812

bug fix for predefined exception (probably...)

Comments (0)

Files changed (2)

ocamlspot/ocamlspot.ml

     match p with
     | Path.Papply _ -> assert false
     | Path.Pident id -> 
+        (* predef check first (testing) *)
+	begin try snd (Env.find Env.predef id) with Not_found ->
+        
         if Ident.global id then
           lazy begin try
 	      let path, str = 
 	      (String.concat "; " 
 		  (List.map Ident.name (Env.domain env)));
             try !!(snd (Env.find env id)) with Not_found -> 
+(*
 	      (* it may be a predefed thing *)
 	      try !!(snd (Env.find Env.predef id)) with Not_found ->
+*)
                 Error (Failure (Printf.sprintf "%s not found in { %s }" 
 				   (Ident.name id)
 				   (String.concat "; " 
 				       (List.map Ident.name (Env.domain env)))))
           end
         end
+        end
     | Path.Pdot (p, name, pos) ->
         lazy begin
 	  match !!(find_path (* ? find_path *) env (Kind.Module, p)) with
 
   let find_path_in_flat file path : PIdent.t * result =
     let env = 
-	let env = invalid_env file in
-	let str = Eval.structure_flat env file.flat in
-	Binding.set env.Env.binding str; (* dirty hack *)
+      let env = invalid_env file in
+      let str = Eval.structure_flat env file.flat in
+      Binding.set env.Env.binding str; (* dirty hack *)
       env
     in
     let find_loc pid =
 		    (String.length substr - to_cursor)
 		in
 		former, latter
-	      else failwith (Printf.sprintf "Substring: too long length=%d@." bytes)
+	      else failwith (Printf.sprintf "Substring: too long length=%d" bytes)
 	    with
-	    | e -> failwith (Printf.sprintf "Substring: failed: %s@." (Printexc.to_string e))
+            | Failure e -> raise (Failure e)
+	    | e -> failwith (Printf.sprintf "Substring: failed: %s" (Printexc.to_string e))
 	  in
-          ignore (get_substring ());
+          (try ignore (get_substring ()) with Failure _ -> ());
 
   	  Format.printf "Tree: %s@." (Location.to_string l);
 	  let rec find_module_path = function

ocamlspot/tests/exception.ml

   | Target.E (* ? Target.E *) -> assert false
 
 exception X = E (* ? E *) (* bug 090818 *)
+
+module M = struct
+  (* EE => *) exception EE (* <= EE *)
+end
+
+let _ = raise M.EE (* ? EE *)
+let _ = raise (Failure "x") (* predefind *)