From cd0826ac7779de1b6d756bb35c5bd74a6adc9d2d Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 2 Dec 2024 05:29:25 +0300 Subject: [PATCH] renamed binding from type_alias to just type --- src/expander.ts | 16 ++++++++-------- src/stx.ts | 2 +- src/syntax-structures.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/expander.ts b/src/expander.ts index baa49d8..ca354eb 100644 --- a/src/expander.ts +++ b/src/expander.ts @@ -56,7 +56,7 @@ function gen_lexical({ ); } -function gen_type_alias({ +function gen_type_binding({ loc, rib, counter, @@ -76,7 +76,7 @@ function gen_type_alias({ context, counter, label, - "type_alias", + "type", stx.content, ({ context, counter, name }) => ({ rib, @@ -171,7 +171,7 @@ function extract_type_alias_declaration_bindings({ loc, (loc) => { assert(loc.t.type === "atom" && loc.t.tag === "identifier", "expected an identifier"); - const gs = gen_type_alias({ loc, rib, counter, context, unit }); + const gs = gen_type_binding({ loc, rib, counter, context, unit }); return { ...gs, loc: go_up(loc) }; }, syntax_error, @@ -439,7 +439,7 @@ function preexpand_forms(step: { const binding = resolution.binding; switch (binding.type) { case "lexical": - case "type_alias": + case "type": case "ts": return next(loc); case "core_syntax": { @@ -835,12 +835,12 @@ function expand_type_parameters( function pre_var({ loc, rib, counter, unit, context }: goodies): never { switch (loc.t.tag) { case "identifier": - const { name, ...gs } = gen_type_alias({ loc, rib, counter, context, unit }); + const { name, ...gs } = gen_type_binding({ loc, rib, counter, context, unit }); return pre_after_var({ ...gs, loc: rename(loc, name) }); case "type_parameter": return go_down(loc, (loc) => { if (loc.t.tag !== "identifier") syntax_error(loc, "expected an identifier"); - const { name, ...gs } = gen_type_alias({ loc, rib, counter, context, unit }); + const { name, ...gs } = gen_type_binding({ loc, rib, counter, context, unit }); return pre_after_var({ ...gs, loc: go_up(rename(loc, name)) }); }); default: @@ -931,7 +931,7 @@ function postexpand_type_alias_declaration( const { content, wrap } = loc.t; const resolution = resolve(content, wrap, context, unit, "types_env"); assert(resolution.type === "bound"); - assert(resolution.binding.type === "type_alias"); + assert(resolution.binding.type === "type"); const new_name = resolution.binding.name; return go_right(rename(loc, new_name), (loc) => { function do_after_equal({ loc, counter, unit, context }: Omit): never { @@ -1033,7 +1033,7 @@ function postexpand_body(step: { const { binding } = resolution; switch (binding.type) { case "ts": - case "type_alias": + case "type": case "lexical": { return cont(rename(loc, binding.name)); } diff --git a/src/stx.ts b/src/stx.ts index 08fda9e..6e3bf8b 100644 --- a/src/stx.ts +++ b/src/stx.ts @@ -138,7 +138,7 @@ export function extend_context_lexical( context: Context, counter: number, label: string, - binding_type: "lexical" | "type_alias", + binding_type: "lexical" | "type", original_name: string, k: (args: { context: Context; name: string; counter: number }) => S, ): S { diff --git a/src/syntax-structures.ts b/src/syntax-structures.ts index 7b46be4..bc4b88c 100644 --- a/src/syntax-structures.ts +++ b/src/syntax-structures.ts @@ -70,7 +70,7 @@ export type Loc = TaggedReconstructiveZipper.Loc; export type Binding = | { type: "lexical"; name: string } - | { type: "type_alias"; name: string } + | { type: "type"; name: string } | { type: "core_syntax"; name: string; pattern: STX } | { type: "syntax_rules_transformer"; clauses: { pattern: Loc; template: STX }[] } | { type: "ts"; name: string };