diff --git a/src/expander.ts b/src/expander.ts index e0099a6..6f8037e 100644 --- a/src/expander.ts +++ b/src/expander.ts @@ -9,17 +9,7 @@ import { extend_context_lexical, CorePatterns, } from "./STX"; -import { - change, - change_splicing, - go_down, - go_next, - go_right, - go_up, - mkzipper, - stx_list_content, - wrap_loc, -} from "./zipper"; +import { change, go_down, go_next, go_right, go_up, mkzipper, wrap_loc } from "./zipper"; import { apply_syntax_rules, core_handlers } from "./syntax-core-patterns"; import { debug, DONE, inspect, in_isolation, Step, syntax_error } from "./step"; @@ -176,13 +166,6 @@ function expand_program(step: { }); } -const empty_statement: STX = { - type: "list", - tag: "empty_statement", - wrap: undefined, - content: null, -}; - function preexpand_body(step: { loc: Loc; rib: Rib; @@ -226,16 +209,6 @@ function preexpand_body_curly(step: { step.loc, (loc, k) => preexpand_forms({ ...step, loc, k: (gs) => k(gs.loc, gs) }), (loc, { rib, context, counter, unit }) => { - if (loc.t.tag === "slice") { - const subforms = stx_list_content(loc.t); - const new_loc = change_splicing( - loc, - subforms === null ? [empty_statement, null] : subforms, - ); - return inspect(new_loc, "spliced", () => { - preexpand_body_curly({ loc: new_loc, rib, unit: step.unit, context, counter, k: step.k }); - }); - } return go_right( loc, (loc) => preexpand_body_curly({ loc, rib, counter, context, unit, k: step.k }), @@ -275,6 +248,7 @@ const atom_handlers_table: { [tag in atom_tag]: "next" | "stop" } = { const list_handlers_table: { [tag in list_tag]: "descend" | "stop" } = { lexical_declaration: "stop", variable_declarator: "stop", + export_statement: "stop", slice: "descend", arrow_function: "stop", statement_block: "stop", diff --git a/tests/arrow-function-5.ts b/tests/arrow-function-5.ts new file mode 100644 index 0000000..78569a8 --- /dev/null +++ b/tests/arrow-function-5.ts @@ -0,0 +1,5 @@ +const foo = (x) => { + using_syntax_rules([t,t,x]).rewrite(splice(() => { + t + })); +} diff --git a/tests/arrow-function-5.ts.expanded b/tests/arrow-function-5.ts.expanded new file mode 100644 index 0000000..5b6d044 --- /dev/null +++ b/tests/arrow-function-5.ts.expanded @@ -0,0 +1,5 @@ +const foo_3 = (x_5) => { + x_5; +}; +================================ +DONE