Alpha: do not catch runtime exceptions
This commit is contained in:
parent
ec648f5397
commit
a8b2ab325e
@ -141,9 +141,10 @@ let parse_annots loc ?(allow_special_var = false) ?(allow_special_field = false)
|
|||||||
else error (Unexpected_annotation loc)
|
else error (Unexpected_annotation loc)
|
||||||
| _ -> error (Unexpected_annotation loc) in
|
| _ -> error (Unexpected_annotation loc) in
|
||||||
List.fold_left (fun acc s ->
|
List.fold_left (fun acc s ->
|
||||||
match acc with
|
acc >>? fun acc ->
|
||||||
| Ok acc ->
|
if Compare.Int.(String.length s = 0) then
|
||||||
begin match s.[0] with
|
error (Unexpected_annotation loc)
|
||||||
|
else match s.[0] with
|
||||||
| ':' -> sub_or_wildcard ~specials:[] (fun a -> `Type_annot a) s acc
|
| ':' -> sub_or_wildcard ~specials:[] (fun a -> `Type_annot a) s acc
|
||||||
| '@' ->
|
| '@' ->
|
||||||
sub_or_wildcard
|
sub_or_wildcard
|
||||||
@ -153,9 +154,6 @@ let parse_annots loc ?(allow_special_var = false) ?(allow_special_field = false)
|
|||||||
~specials:(if allow_special_field then ['@'] else [])
|
~specials:(if allow_special_field then ['@'] else [])
|
||||||
(fun a -> `Field_annot a) s acc
|
(fun a -> `Field_annot a) s acc
|
||||||
| _ -> error (Unexpected_annotation loc)
|
| _ -> error (Unexpected_annotation loc)
|
||||||
| exception Invalid_argument _ -> error (Unexpected_annotation loc)
|
|
||||||
end
|
|
||||||
| Error _ -> acc
|
|
||||||
) (ok []) l
|
) (ok []) l
|
||||||
>|? List.rev
|
>|? List.rev
|
||||||
|
|
||||||
@ -273,10 +271,8 @@ let extract_field_annot
|
|||||||
= function
|
= function
|
||||||
| Prim (loc, prim, args, annot) ->
|
| Prim (loc, prim, args, annot) ->
|
||||||
let field_annots, annot = List.partition (fun s ->
|
let field_annots, annot = List.partition (fun s ->
|
||||||
match s.[0] with
|
Compare.Int.(String.length s > 0) &&
|
||||||
| '%' -> true
|
Compare.Char.(s.[0] = '%')
|
||||||
| _ -> false
|
|
||||||
| exception Invalid_argument _ -> false
|
|
||||||
) annot in
|
) annot in
|
||||||
parse_field_annot loc field_annots >|? fun field_annot ->
|
parse_field_annot loc field_annots >|? fun field_annot ->
|
||||||
Prim (loc, prim, args, annot), field_annot
|
Prim (loc, prim, args, annot), field_annot
|
||||||
|
Loading…
Reference in New Issue
Block a user