You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delete Bs_ast_mapper, keeping Ast_mapper at upstream shape
Bs_ast_mapper was a 600-line mechanical fork of the vendored Ast_mapper
whose entire delta - still delimited by fossilized cppo (* #if *)
comments - was three group-level hooks: type_declaration_list,
value_bindings, and value_bindings_rec. Only value_bindings ever had a
client (tuple/module-record pattern flattening for non-recursive lets);
the other two were never overridden by anything. Meanwhile the fork had
drifted: it dropped ~loc/~attrs when rebuilding JSX fragments and did
not remap JSX element-name locations. Every parsetree change paid the
duplication tax twice.
Rather than folding hooks into Ast_mapper, keep it byte-identical to
its upstream shape and move the one real behavior into the client:
bs_builtin_ppx's default_expr_mapper is now a thin wrapper that
flattens non-recursive Pexp_let groups before delegating, so every
fallback in expr_mapper inherits the flattening uniformly (hello_res's
nested [let {length: l, add} = module(List)] reaches it only through a
fallback and pins this), and structure_item_mapper handles
Pstr_value(Nonrecursive) the same way. Recursive groups map per
binding - their patterns are restricted to variables, so group
rewrites do not apply.
Also: inline Ast_typ_uncurry's one function into its one consumer and
delete the module; replace ast_external_mk's hand-rolled expression,
structure, and module-expr records with Ast_helper constructors;
replace ast_tdcls's two dead-hook accessor calls with plain List.map.
Generated output is byte-identical across the test suite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
0 commit comments