package ppxlib
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Standard infrastructure for ppx rewriters
Install
dune-project
Dependency
Authors
Maintainers
Sources
ppxlib-0.38.0.tbz
sha256=89e049b3102f6670a213d34d802ea3ab0fc530a8959d2f1a1e8db830063429a3
sha512=2fbbf124fc61e1f22242d13505e9af39d4a3c7cf03def1c33ee8bd915195be9b817636667302e9c6ceddc74a9a4a54926340e21c96fd770a2bc6752400315cfd
doc/src/ppxlib/quoter.ml.html
Source file quoter.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49open Import type t = { mutable next_id : int; mutable bindings : Parsetree.value_binding list; } let create () = { next_id = 0; bindings = [] } let sanitize t e = match t.bindings with | [] -> e | bindings -> let (module Ast) = Ast_builder.make e.pexp_loc in Ast.pexp_let Nonrecursive bindings e let quote t (e : expression) = let loc = e.pexp_loc in let (module Ast) = Ast_builder.make loc in let name = "__" ^ Int.to_string t.next_id in let binding_expr, quoted_expr = match e with (* Optimize identifier quoting by avoiding closure. See https://github.com/ocaml-ppx/ppx_deriving/pull/252. *) | { pexp_desc = Pexp_ident _; _ } -> (e, Ast.evar name) | _ -> let p = let unit = Ast_builder.Default.Located.lident ~loc "()" in Ast.ppat_construct unit None in let params = [ { pparam_desc = Pparam_val (Nolabel, None, p); pparam_loc = Location.none; }; ] in let binding_expr = Ast.pexp_function params None (Pfunction_body e) in let quoted_expr = Ast.eapply (Ast.evar name) [ Ast.eunit ] in (binding_expr, quoted_expr) in let binding = let pat = Ast.pvar name in Ast.value_binding ~pat ~expr:binding_expr in t.bindings <- binding :: t.bindings; t.next_id <- t.next_id + 1; quoted_expr
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>