Refactor UntypedKind::Parameter to Identifier

The `Parameter` kind in `UntypedKind` was only used for identifiers that
were being declared or referenced. This commit renames it to
`Identifier` and updates all the necessary code to reflect this change.
This simplifies the AST and makes it more consistent.

Additionally, a new macro `repeat` has been added to
`src/ast/system.myc`.
This commit is contained in:
Michael Schimmel
2026-03-09 11:08:30 +01:00
parent cb4507b2da
commit fa23a4c125
12 changed files with 34 additions and 105 deletions
+2 -7
View File
@@ -197,11 +197,6 @@ impl Binder {
}
}
UntypedKind::Parameter(_) => {
diag.push_error("Unexpected 'Parameter' node in general binder context. This should be handled via 'bind_pattern'.", Some(node.identity.clone()));
self.make_node(node.identity.clone(), BoundKind::Error)
}
UntypedKind::FieldAccessor(k) => {
self.make_node(node.identity.clone(), BoundKind::FieldAccessor(*k))
}
@@ -230,7 +225,7 @@ impl Binder {
UntypedKind::Def { target, value } => {
// Special case: Single identifier (to support recursion)
if let UntypedKind::Parameter(ref name) = target.kind {
if let UntypedKind::Identifier(ref name) = target.kind {
let addr_opt = self.declare_variable(
name,
node.identity.clone(), // Identity of the Def node
@@ -543,7 +538,7 @@ impl Binder {
diag: &mut Diagnostics,
) -> BoundNode {
match &node.kind {
UntypedKind::Parameter(sym) => {
UntypedKind::Identifier(sym) => {
if let Some(addr) = self.declare_variable(sym, node.identity.clone(), kind, diag) {
self.make_node(
node.identity.clone(),