Skip to content

Commit eadd133

Browse files
committed
tweak use local exception
1 parent cfcfd0b commit eadd133

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

jscomp/syntax/ast_payload.ml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ let raw_as_string_exp_exn
125125
Some e
126126
| _ -> None
127127

128-
let as_core_type loc x =
128+
let as_core_type loc (x : t) =
129129
match x with
130-
| Parsetree.PTyp x -> x
130+
| PTyp x -> x
131131
| _ -> Location.raise_errorf ~loc "except a core type"
132132

133133
let as_ident (x : t ) =
@@ -143,10 +143,6 @@ let as_ident (x : t ) =
143143
}
144144
] -> Some ident
145145
| _ -> None
146-
(* open Ast_helper *)
147-
148-
(* let raw_string_payload loc (s : string) : t =
149-
PStr [ Str.eval ~loc (Ast_compatible.const_exp_string ~loc s) ] *)
150146

151147

152148
type lid = string Asttypes.loc
@@ -164,7 +160,7 @@ type action =
164160

165161
let ident_or_record_as_config
166162
loc
167-
(x : Parsetree.payload)
163+
(x : t)
168164
: ( string Location.loc * Parsetree.expression option) list
169165
=
170166
match x with
@@ -211,7 +207,7 @@ let ident_or_record_as_config
211207

212208
let assert_strings loc (x : t) : string list
213209
=
214-
let module M = struct exception Not_str end in
210+
let exception Not_str in
215211
match x with
216212
| PStr [ {pstr_desc =
217213
Pstr_eval (
@@ -227,8 +223,8 @@ let assert_strings loc (x : t) : string list
227223
Pconst_string
228224
(name,_)); _} ->
229225
name
230-
| _ -> raise M.Not_str)
231-
with M.Not_str ->
226+
| _ -> raise Not_str)
227+
with Not_str ->
232228
Location.raise_errorf ~loc "expect string tuple list"
233229
)
234230
| PStr [ {

0 commit comments

Comments
 (0)