Skip to content

Commit

Permalink
renamed binding from type_alias to just type
Browse files Browse the repository at this point in the history
  • Loading branch information
azizghuloum committed Dec 2, 2024
1 parent 9771604 commit cd0826a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/expander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function gen_lexical({
);
}

function gen_type_alias({
function gen_type_binding({
loc,
rib,
counter,
Expand All @@ -76,7 +76,7 @@ function gen_type_alias({
context,
counter,
label,
"type_alias",
"type",
stx.content,
({ context, counter, name }) => ({
rib,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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<goodies, "rib">): never {
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion src/stx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function extend_context_lexical<S>(
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 {
Expand Down
2 changes: 1 addition & 1 deletion src/syntax-structures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export type Loc = TaggedReconstructiveZipper.Loc<list_tag, STX>;

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 };
Expand Down

0 comments on commit cd0826a

Please sign in to comment.