From db7beeb7554af5edfe7ff7f0f0953c649aae4da6 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Tue, 29 Aug 2023 13:02:14 +0200 Subject: [PATCH] Fix ppxlib stuff --- packages/reason-css-parser/ppx/Generate.re | 22 +++++++------------ .../ppx/Reason_css_parser_ppx.re | 4 ++-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/reason-css-parser/ppx/Generate.re b/packages/reason-css-parser/ppx/Generate.re index 3e8ee8818..9565c98cc 100644 --- a/packages/reason-css-parser/ppx/Generate.re +++ b/packages/reason-css-parser/ppx/Generate.re @@ -1,12 +1,10 @@ -open Ppxlib; - -module Ast_helper = Ppxlib.Ast_helper; - -module Make = (Ast_builder: Ppxlib.Ast_builder.S) => { - open Ast_builder; +module Make = (Builder: Ppxlib.Ast_builder.S) => { + module Ast_helper = Ppxlib_ast.Ast_helper; + open Ppxlib; + open Builder; open Css_spec_parser; - let txt = txt => {Location.loc: Ast_builder.loc, txt}; + let txt = txt => {Location.loc: Builder.loc, txt}; let kebab_case_to_snake_case = name => name |> String.split_on_char('-') |> String.concat("_"); @@ -248,11 +246,8 @@ module Make = (Ast_builder: Ppxlib.Ast_builder.S) => { /* TODO: Move this to Standard and use as ppx_runtime */ let standard_types = { - open Ppxlib.Ast_builder.Default; - let type_ = (~kind=Parsetree.Ptype_abstract, name, core_type) => { - type_declaration( - ~loc=Location.none, + Builder.type_declaration( ~name={txt: name, loc: Location.none}, ~params=[], ~cstrs=[], @@ -417,8 +412,7 @@ module Make = (Ast_builder: Ppxlib.Ast_builder.S) => { }; }; - let add_types = (~loc, bindings) => { - open Ppxlib; + let add_types = (~loc, bindings): list(Ppxlib.structure_item) => { let new_bindings = bindings |> List.map(value_binding => { @@ -438,7 +432,7 @@ module Make = (Ast_builder: Ppxlib.Ast_builder.S) => { let create_variant_name = (type_name, name) => type_name ++ "__make__" ++ name; - let txt = txt => {Location.loc: Ast_builder.loc, txt}; + let txt = txt => {Location.loc: Builder.loc, txt}; let construct = (~expr=None, name) => pexp_construct(txt(Lident(name)), expr); diff --git a/packages/reason-css-parser/ppx/Reason_css_parser_ppx.re b/packages/reason-css-parser/ppx/Reason_css_parser_ppx.re index 32ff32ce4..5413fb37c 100644 --- a/packages/reason-css-parser/ppx/Reason_css_parser_ppx.re +++ b/packages/reason-css-parser/ppx/Reason_css_parser_ppx.re @@ -6,7 +6,7 @@ let expander = ~recursive, ~loc as exprLoc, ~path as _: string, - ~arg as _: option(loc(Ppxlib.Longident.t)), + ~arg as _: option(loc(Longident.t)), value: string, _, _, @@ -14,7 +14,7 @@ let expander = switch (Css_spec_parser.value_of_string(value)) { | Some(value: Css_spec_parser.value) => module Ast_builder = - Ppxlib.Ast_builder.Make({ + Ast_builder.Make({ let loc = exprLoc; }); module Emit = Generate.Make(Ast_builder);