@@ -2286,7 +2286,6 @@ and parse_template_expr ?prefix p =
2286
2286
Some prefix
2287
2287
| _ -> Some " js"
2288
2288
in
2289
- let start_pos = p.Parser. start_pos in
2290
2289
2291
2290
let parse_parts p =
2292
2291
let rec aux acc =
@@ -2319,13 +2318,9 @@ and parse_template_expr ?prefix p =
2319
2318
let parts = parse_parts p in
2320
2319
let strings = List. map fst parts in
2321
2320
let values = Ext_list. filter_map parts snd in
2322
- let end_pos = p.Parser. end_pos in
2323
2321
2324
- let gen_tagged_template_call lident =
2325
- let ident =
2326
- Ast_helper.Exp. ident ~attrs: [] ~loc: Location. none
2327
- (Location. mknoloc lident)
2328
- in
2322
+ let gen_tagged_template_call (lident_loc : Longident.t Location.loc ) =
2323
+ let ident = Ast_helper.Exp. ident ~attrs: [] ~loc: lident_loc.loc lident_loc in
2329
2324
let strings_array =
2330
2325
Ast_helper.Exp. array ~attrs: [] ~loc: Location. none strings
2331
2326
in
@@ -2334,7 +2329,7 @@ and parse_template_expr ?prefix p =
2334
2329
in
2335
2330
Ast_helper.Exp. apply
2336
2331
~attrs: [tagged_template_literal_attr]
2337
- ~loc: (mk_loc start_pos end_pos) ident
2332
+ ~loc: lident_loc.loc ident
2338
2333
[(Nolabel , strings_array); (Nolabel , values_array)]
2339
2334
in
2340
2335
@@ -2374,7 +2369,7 @@ and parse_template_expr ?prefix p =
2374
2369
match prefix with
2375
2370
| Some {txt = Longident. Lident ("js" | "j" | "json" ); _} | None ->
2376
2371
gen_interpolated_string ()
2377
- | Some { txt = lident } -> gen_tagged_template_call lident
2372
+ | Some lident_loc -> gen_tagged_template_call lident_loc
2378
2373
2379
2374
(* Overparse: let f = a : int => a + 1, is it (a : int) => or (a): int =>
2380
2375
* Also overparse constraints:
0 commit comments