Skip to content

Commit

Permalink
avoid generating extra let binding if no query params
Browse files Browse the repository at this point in the history
  • Loading branch information
tatchi authored and andreypopp committed Jun 15, 2024
1 parent 30f7743 commit ca3ba26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions native/ppx_deriving_router_common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,10 @@ module Derive_href = struct
[%e acc]]
in
let body = f body q in
List.fold_left qs ~init:body ~f
let body = List.fold_left qs ~init:body ~f in
[%expr
let [%p psep] = ref '?' in
[%e body]]
in
let body =
List.fold_left (List.rev path) ~init:body ~f:(fun acc param ->
Expand All @@ -409,7 +412,6 @@ module Derive_href = struct
let body =
[%expr
let [%p pout] = Buffer.create 16 in
let [%p psep] = ref '?' in
[%e body]]
in
let bnds =
Expand Down

0 comments on commit ca3ba26

Please sign in to comment.