Skip to content

Commit

Permalink
Drop dependency of ppx_tools_versioned
Browse files Browse the repository at this point in the history
  • Loading branch information
Nymphium authored and tmcgilchrist committed Mar 31, 2022
1 parent 5d5603d commit 53b64e5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
3 changes: 1 addition & 2 deletions aws-gen.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ depends: [
"base-unix"
"cmdliner" {>= "1.1.0"}
"fmt"
"ppx_tools_versioned"
"yojson" {>= "1.6.0"}
"ocaml-migrate-parsetree"
"ocaml-migrate-parsetree" {< "2.0.0"}
"ocamlgraph"
"dune" {>= "2.7"}
]
Expand Down
4 changes: 1 addition & 3 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
(names aws_gen endpoint_gen)
(public_names aws-gen endpoint-gen)
(package aws-gen)
(preprocess
(pps ppx_tools_versioned.metaquot_404))
(libraries yojson cmdliner fmt unix ppx_tools_versioned
(libraries yojson cmdliner fmt unix
ocaml-migrate-parsetree ocamlgraph atdgen str))
8 changes: 3 additions & 5 deletions src/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

open Structures
open Util
open Migrate_parsetree
open Ast_404

let is_list ~shapes ~shp =
try
Expand Down Expand Up @@ -138,10 +136,10 @@ let types is_ec2 shapes =
members)))
in
Syntax.let_ "make" (mkfun members body)
| Shape.List _ -> [%stri let make elems () = elems]
| Shape.Enum _ -> [%stri let make v () = v]
| Shape.List _ -> Syntax.(let_ "make" (let elems = "elems" in fun_ elems (fun_ "()" (ident elems))))
| Shape.Enum _ -> Syntax.(let_ "make" (let v = "v" in fun_ v (fun_ "()" (ident v))))
(* TODO: maybe accept a list of tuples and create a Hashtbl *)
| Shape.Map _ -> [%stri let make elems () = elems]
| Shape.Map _ -> Syntax.(let_ "make" (let elems = "elems" in fun_ elems (fun_ "()" (ident elems))))
in
let extra =
let open Syntax in
Expand Down
3 changes: 2 additions & 1 deletion src/syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ open Migrate_parsetree
open Ast_404
open Parsetree
open Ast_helper
open Ast_convenience_404
open Asttypes

let lid s = Location.mkloc (Util.of_option_exn ( Longident.unflatten [ s ] )) !default_loc

let strloc txt = { txt; loc = !default_loc }

(* open Module (in .ml) *)
Expand Down
5 changes: 5 additions & 0 deletions src/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,8 @@ let option_map l ~f =
match l with
| None -> None
| Some x -> Some (f ^ x)

let of_option_exn = function
| Some v -> v
| None -> failwith "Expected Some v, got None."

2 changes: 2 additions & 0 deletions src/util.mli
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ val inline_shapes :
val filter_map : 'a list -> f:('a -> 'b option) -> 'b list

val option_map : string option -> f:string -> string option

val of_option_exn : 'a option -> 'a

0 comments on commit 53b64e5

Please sign in to comment.