Fix ppx flags with (staged_pps ...) (#1218)

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jérémie Dimino 2018-09-04 15:29:58 +01:00 committed by GitHub
parent 610b20d8c2
commit fb53dcca01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 4 deletions

View File

@ -42,6 +42,8 @@ next
wrapped modules but keep unwrapped modules with a deprecation message to
preserve compatibility. (#1188, fix #985, @rgrinberg)
- Fix the flags passed to the ppx rewriter when using `staged_pps` (#1218, @diml)
1.1.1 (08/08/2018)
------------------

View File

@ -272,6 +272,13 @@ module Unexpanded = struct
let standard = standard
let of_strings ~pos l =
{ ast = Ast.Union (List.map l ~f:(fun x ->
Ast.Element (String_with_vars.virt_text pos x)))
; loc = Some (Loc.of_pos pos)
; context = Univ_map.empty
}
let field ?(default=standard) ?check name =
let dparse =
match check with

View File

@ -80,6 +80,8 @@ module Unexpanded : sig
include Dsexp.Sexpable with type t := t
val standard : t
val of_strings : pos:string * int * int * int -> string list -> t
val field
: ?default:t
-> ?check:unit Dsexp.Of_sexp.t

View File

@ -49,8 +49,10 @@ module Driver = struct
(let%map loc = loc
and flags = Ordered_set_lang.Unexpanded.field "flags"
and as_ppx_flags =
Ordered_set_lang.Unexpanded.field "flags"
~check:(Syntax.since syntax (1, 1))
Ordered_set_lang.Unexpanded.field "as_ppx_flags"
~check:(Syntax.since syntax (1, 2))
~default:(Ordered_set_lang.Unexpanded.of_strings ["--as-ppx"]
~pos:__POS__)
and lint_flags = Ordered_set_lang.Unexpanded.field "lint_flags"
and main = field "main" string
and replaces =

View File

@ -69,7 +69,7 @@ Test that going throught the -ppx option of the compiler works
$ dune build test_ppx_staged.cma
ocamldep .test_ppx_staged.objs/test_ppx_staged.ml.d
tool name: ocamldep
args:--cookie library-name="test_ppx_staged"
args:--as-ppx --cookie library-name="test_ppx_staged"
ocamlc .test_ppx_staged.objs/test_ppx_staged.{cmi,cmo,cmt}
tool name: ocamlc
args:--cookie library-name="test_ppx_staged"
args:--as-ppx --cookie library-name="test_ppx_staged"