Skip to content

Commit

Permalink
Add a unit argument to Expansion_context's smart constructors
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Rebours <nathan.p.rebours@gmail.com>
  • Loading branch information
NathanReb committed Apr 2, 2019
1 parent c884e62 commit 6a6eba4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/context_free.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module Generated_code_hook = struct
end

let rec map_node_rec context ts super_call loc base_ctxt x =
let ctxt = Expansion_context.Extension.make ~extension_point_loc:loc ~base:base_ctxt in
let ctxt = Expansion_context.Extension.make ~extension_point_loc:loc ~base:base_ctxt () in
match EC.get_extension context x with
| None -> super_call base_ctxt x
| Some (ext, attrs) ->
Expand All @@ -209,7 +209,7 @@ let rec map_node_rec context ts super_call loc base_ctxt x =
;;

let map_node context ts super_call loc base_ctxt x ~hook =
let ctxt = Expansion_context.Extension.make ~extension_point_loc:loc ~base:base_ctxt in
let ctxt = Expansion_context.Extension.make ~extension_point_loc:loc ~base:base_ctxt () in
match EC.get_extension context x with
| None -> super_call base_ctxt x
| Some (ext, attrs) ->
Expand All @@ -236,7 +236,7 @@ let rec map_nodes context ts super_call get_loc base_ctxt l ~hook ~in_generated_
x :: l
| Some (ext, attrs) ->
let extension_point_loc = get_loc x in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt () in
match E.For_context.convert_inline ts ~ctxt ext with
| None ->
let x = super_call base_ctxt x in
Expand Down Expand Up @@ -321,7 +321,7 @@ let handle_attr_group_inline attrs rf items ~loc ~base_ctxt =
match get_group group.attribute items with
| None -> acc
| Some values ->
let ctxt = Expansion_context.Deriver.make ~derived_item_loc:loc ~base:base_ctxt in
let ctxt = Expansion_context.Deriver.make ~derived_item_loc:loc ~base:base_ctxt () in
let expect_items = group.expand ~ctxt rf items values in
expect_items :: acc)

Expand All @@ -331,7 +331,7 @@ let handle_attr_inline attrs item ~loc ~base_ctxt =
match Attribute.get a.attribute item with
| None -> acc
| Some value ->
let ctxt = Expansion_context.Deriver.make ~derived_item_loc:loc ~base:base_ctxt in
let ctxt = Expansion_context.Deriver.make ~derived_item_loc:loc ~base:base_ctxt () in
let expect_items = a.expand ~ctxt item value in
expect_items :: acc)

Expand Down Expand Up @@ -545,7 +545,7 @@ class map_top_down ?(expect_mismatch_handler=Expect_mismatch_handler.nop)
match item.pstr_desc with
| Pstr_extension (ext, attrs) -> begin
let extension_point_loc = item.pstr_loc in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt () in
match E.For_context.convert_inline structure_item ~ctxt ext with
| None ->
let item = super#structure_item base_ctxt item in
Expand Down Expand Up @@ -616,7 +616,7 @@ class map_top_down ?(expect_mismatch_handler=Expect_mismatch_handler.nop)
match item.psig_desc with
| Psig_extension (ext, attrs) -> begin
let extension_point_loc = item.psig_loc in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt in
let ctxt = Expansion_context.Extension.make ~extension_point_loc ~base:base_ctxt () in
match E.For_context.convert_inline signature_item ~ctxt ext with
| None ->
let item = super#signature_item base_ctxt item in
Expand Down
4 changes: 2 additions & 2 deletions src/expansion_context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Extension = struct
; base : Base.t
}

let make ~extension_point_loc ~base = {extension_point_loc; base}
let make ~extension_point_loc ~base () = {extension_point_loc; base}

let extension_point_loc t = t.extension_point_loc
let code_path t = t.base.code_path
Expand All @@ -36,7 +36,7 @@ module Deriver = struct
; base : Base.t
}

let make ~derived_item_loc ~base = {derived_item_loc; base}
let make ~derived_item_loc ~base () = {derived_item_loc; base}

let derived_item_loc t = t.derived_item_loc
let code_path t = t.base.code_path
Expand Down
4 changes: 2 additions & 2 deletions src/expansion_context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module Extension : sig
(** Undocumented section *)

(** Build a new expansion context with the given extension point location and base context *)
val make : extension_point_loc:Location.t -> base:Base.t -> t
val make : extension_point_loc:Location.t -> base:Base.t -> unit -> t
end

module Deriver : sig
Expand All @@ -62,5 +62,5 @@ module Deriver : sig
(** Undocumented section *)

(** Build a new expansion context with the given item location and code path *)
val make : derived_item_loc:Location.t -> base:Base.t -> t
val make : derived_item_loc:Location.t -> base:Base.t -> unit -> t
end

0 comments on commit 6a6eba4

Please sign in to comment.