Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define Pconst_string_patt
Browse files Browse the repository at this point in the history
Suggested by Gabriel Scherer.
ocaml-ppx#222 (comment)
thierry-martinez committed May 23, 2020
1 parent c9e521e commit e16e4d0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/api/ppx_deriving.cppo.ml
Original file line number Diff line number Diff line change
@@ -27,6 +27,12 @@
#define Rinherit_patt(typ) {prf_desc = Rinherit(typ); _}
#endif

#if OCAML_VERSION < (4, 11, 0)
#define Pconst_string_patt(s, loc) Pconst_string(s, loc)
#else
#define Pconst_string_patt(s, loc) Pconst_string(s, loc, _)
#endif

open Longident
open Location
open Asttypes
@@ -152,12 +158,7 @@ type constant =

let string_of_constant_opt (constant : constant) : string option =
match constant with
#if OCAML_VERSION >= (4, 11, 0)
| Pconst_string (s, _, _) ->
#else
| Pconst_string (s, _) ->
#endif
Some s
| Pconst_string_patt (s, _) -> Some s
| _ -> None

let string_of_expression_opt (e : Parsetree.expression) : string option =

0 comments on commit e16e4d0

Please sign in to comment.