@@ -23,7 +23,7 @@ exception Fatal_error
2323let fatal_error = msg => {
2424 print_string (">> Fatal error: " )
2525 prerr_endline (msg )
26- raise (Fatal_error )
26+ throw (Fatal_error )
2727}
2828
2929@raises (Fatal_error )
@@ -36,7 +36,7 @@ let try_finally = (work, cleanup) => {
3636 let result = try work () catch {
3737 | e =>
3838 cleanup ()
39- raise (e )
39+ throw (e )
4040 }
4141 cleanup ()
4242 result
@@ -56,7 +56,7 @@ let protect_refs = {
5656 x
5757 | exception e =>
5858 set_refs (backup )
59- raise (e )
59+ throw (e )
6060 }
6161 }
6262}
@@ -149,7 +149,7 @@ module Stdlib = {
149149 let rec aux = (acc , l1 , l2 ) =>
150150 switch (l1 , l2 ) {
151151 | (list {}, _ ) => (List .rev (acc ), l2 )
152- | (list {_ , ... _ }, list {}) => raise (Invalid_argument ("map2_prefix" ))
152+ | (list {_ , ... _ }, list {}) => throw (Invalid_argument ("map2_prefix" ))
153153 | (list {h1 , ... t1 }, list {h2 , ... t2 }) =>
154154 let h = f (h1 , h2 )
155155 aux (list {h , ... acc }, t1 , t2 )
@@ -179,7 +179,7 @@ module Stdlib = {
179179 (List .rev (acc ), l )
180180 } else {
181181 switch l {
182- | list {} => raise (Invalid_argument ("split_at" ))
182+ | list {} => throw (Invalid_argument ("split_at" ))
183183 | list {t , ... q } => aux (n - 1 , list {t , ... acc }, q )
184184 }
185185 }
@@ -254,13 +254,13 @@ let find_in_path = (path, name) =>
254254 if Sys .file_exists (name ) {
255255 name
256256 } else {
257- raise (Not_found )
257+ throw (Not_found )
258258 }
259259 } else {
260260 @raises (Not_found )
261261 let rec try_dir = x =>
262262 switch x {
263- | list {} => raise (Not_found )
263+ | list {} => throw (Not_found )
264264 | list {dir , ... rem } =>
265265 let fullname = Filename .concat (dir , name )
266266 if Sys .file_exists (fullname ) {
@@ -290,7 +290,7 @@ let find_in_path_rel = (path, name) => {
290290 @raises (Not_found )
291291 let rec try_dir = x =>
292292 switch x {
293- | list {} => raise (Not_found )
293+ | list {} => throw (Not_found )
294294 | list {dir , ... rem } =>
295295 let fullname = simplify (Filename .concat (dir , name ))
296296 if Sys .file_exists (fullname ) {
@@ -309,7 +309,7 @@ let find_in_path_uncap = (path, name) => {
309309 @raises (Not_found )
310310 let rec try_dir = x =>
311311 switch x {
312- | list {} => raise (Not_found )
312+ | list {} => throw (Not_found )
313313 | list {dir , ... rem } =>
314314 let fullname = Filename .concat (dir , name )
315315 and ufullname = Filename .concat (dir , uname )
@@ -381,7 +381,7 @@ let copy_file_chunk = (ic, oc, len) => {
381381 } else {
382382 let r = input (ic , buff , 0 , min (n , 0x1000 ))
383383 if r == 0 {
384- raise (End_of_file )
384+ throw (End_of_file )
385385 } else {
386386 output (oc , buff , 0 , r )
387387 copy (n - r )
@@ -435,12 +435,12 @@ let output_to_file_via_temporary = (~mode=list{Open_text}, filename, fn) => {
435435 } catch {
436436 | exn =>
437437 remove_file (temp_filename )
438- raise (exn )
438+ throw (exn )
439439 }
440440 | exception exn =>
441441 close_out (oc )
442442 remove_file (temp_filename )
443- raise (exn )
443+ throw (exn )
444444 }
445445}
446446
@@ -514,7 +514,7 @@ let search_substring = (pat, str, start) => {
514514 if j >= String .length (pat ) {
515515 i
516516 } else if i + j >= String .length (str ) {
517- raise (Not_found )
517+ throw (Not_found )
518518 } else if String .get (str , i + j ) == String .get (pat , j ) {
519519 search (i , j + 1 )
520520 } else {
@@ -831,7 +831,7 @@ module Color = {
831831 | "error" => cur_styles .contents .error
832832 | "warning" => cur_styles .contents .warning
833833 | "loc" => cur_styles .contents .loc
834- | _ => raise (Not_found )
834+ | _ => throw (Not_found )
835835 }
836836
837837 let color_enabled = ref (true )
@@ -957,15 +957,15 @@ exception HookExnWrapper({error: exn, hook_name: string, hook_info: hook_info})
957957exception HookExn (exn )
958958
959959@raises (HookExn )
960- let raise_direct_hook_exn = e => raise (HookExn (e ))
960+ let raise_direct_hook_exn = e => throw (HookExn (e ))
961961
962962@raises ([HookExnWrapper , genericException ])
963963let fold_hooks = (list , hook_info , ast ) =>
964964 List .fold_left (
965965 (ast , (hook_name , f )) =>
966966 try f (hook_info , ast ) catch {
967- | HookExn (e ) => raise (e )
968- | error => raise (HookExnWrapper ({error : error , hook_name : hook_name , hook_info : hook_info }))
967+ | HookExn (e ) => throw (e )
968+ | error => throw (HookExnWrapper ({error : error , hook_name : hook_name , hook_info : hook_info }))
969969 },
970970 /* when explicit reraise with backtrace will be available,
971971 it should be used here */
0 commit comments