File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -1812,18 +1812,9 @@ and parse_constrained_expr_region p =
1812
1812
| _ -> Some expr)
1813
1813
| _ -> None
1814
1814
1815
- and parse_regex p pattern flags =
1816
- let start_pos = p.Parser. start_pos in
1815
+ and parse_regex ~start_pos p pattern flags =
1817
1816
Parser. next p;
1818
- let loc =
1819
- mk_loc
1820
- {
1821
- start_pos with
1822
- (* Account for the inserted leading `/` *)
1823
- pos_cnum = start_pos.pos_cnum - 1 ;
1824
- }
1825
- p.prev_end_pos
1826
- in
1817
+ let loc = mk_loc start_pos p.prev_end_pos in
1827
1818
let payload =
1828
1819
Parsetree. PStr
1829
1820
[
@@ -1911,13 +1902,13 @@ and parse_atomic_expr p =
1911
1902
| Forwardslash -> (
1912
1903
Parser. next_regex_token p;
1913
1904
match p.token with
1914
- | Regex (pattern , flags ) -> parse_regex p pattern flags
1905
+ | Regex (pattern , flags ) -> parse_regex ~start_pos p pattern flags
1915
1906
| _ -> Ast_helper.Exp. extension (Location. mknoloc " re" , Parsetree. PStr [] )
1916
1907
)
1917
1908
| ForwardslashDot -> (
1918
1909
Parser. next_regex_token p;
1919
1910
match p.token with
1920
- | Regex (pattern , flags ) -> parse_regex p (" ." ^ pattern) flags
1911
+ | Regex (pattern , flags ) -> parse_regex ~start_pos p (" ." ^ pattern) flags
1921
1912
| _ -> Ast_helper.Exp. extension (Location. mknoloc " re" , Parsetree. PStr [] )
1922
1913
)
1923
1914
| token -> (
You can’t perform that action at this time.
0 commit comments