From 44fe55e5a309b667366a596b33be08b2097ce8f0 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Sun, 24 Nov 2024 18:27:04 +0300 Subject: [PATCH] fixed missing rib and added test case --- src/expander.ts | 2 +- tests/macro-generating-macro-1.ts | 5 +++++ tests/macro-generating-macro-1.ts.expanded | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/macro-generating-macro-1.ts create mode 100644 tests/macro-generating-macro-1.ts.expanded diff --git a/src/expander.ts b/src/expander.ts index d2bbf7b..c0f8c05 100644 --- a/src/expander.ts +++ b/src/expander.ts @@ -327,7 +327,7 @@ function expand_concise_body(step: { }): never { const loc = step.loc; const k: (gs: goodies) => never = (gs: goodies) => { - const new_unit = extend_unit(step.unit, step.rib_id, gs.rib); + const new_unit = extend_unit(gs.unit, step.rib_id, gs.rib); return postexpand_body({ ...gs, unit: new_unit, k: step.k }); }; return loc.t.type === "list" && loc.t.tag === "statement_block" diff --git a/tests/macro-generating-macro-1.ts b/tests/macro-generating-macro-1.ts new file mode 100644 index 0000000..1d89293 --- /dev/null +++ b/tests/macro-generating-macro-1.ts @@ -0,0 +1,5 @@ +using_syntax_rules( + [capture, + capture(expr, id, body), + using_syntax_rules([id, id, expr]).rewrite(body)], +).rewrite((x) => capture(x, t, (x) => x + t)) diff --git a/tests/macro-generating-macro-1.ts.expanded b/tests/macro-generating-macro-1.ts.expanded new file mode 100644 index 0000000..bf46f2d --- /dev/null +++ b/tests/macro-generating-macro-1.ts.expanded @@ -0,0 +1,3 @@ +(x_5) => (x_11) => x_11 + x_5; +================================ +DONE