iter 22b.1.1: ClassDef/InstanceDef AST + downstream match arms

Adds Def::Class(ClassDef) and Def::Instance(InstanceDef) variants per
Decision 11 §"Form-A schema". All optional fields (superclass, doc,
default body) carry skip_serializing_if so canonical-JSON bytes of
pre-22b fixtures stay bit-identical.

Downstream match-on-Def sites are extended with explicit Class/Instance
arms. Behaviour for 22b.1 is placeholder (skip in typecheck/codegen,
one-line summary in pretty/manifest, placeholder marker in prose/print)
with TODO comments naming the deferred sub-iters (22b.2 typecheck,
22b.3 codegen, 22b.4 prose-projection arms).
This commit is contained in:
2026-05-09 12:31:23 +02:00
parent 522500a6f6
commit f25d7b6cd6
12 changed files with 264 additions and 4 deletions
+22
View File
@@ -77,6 +77,28 @@ fn write_def(out: &mut String, def: &Def, level: usize) {
Def::Type(td) => write_type_def(out, td, level),
Def::Fn(fd) => write_fn_def(out, fd, level),
Def::Const(cd) => write_const_def(out, cd, level),
// Iter 22b.1: ClassDef / InstanceDef render as a single-line
// placeholder so prose round-trip survives a module that
// contains them. The full Form-B projection (mirror of the
// ClassDef / InstanceDef Form-A schema, with method bodies
// re-indented and superclass / default markers spelled out)
// is deferred to 22b.4 alongside the prose-roundtrip parser
// arms. The placeholder is informational only — the prose
// round-trip mediator does not yet read these forms back.
Def::Class(c) => {
indent(out, level);
out.push_str("// (class ");
out.push_str(&c.name);
out.push(' ');
out.push_str(&c.param);
out.push_str(") -- 22b.4 will render full Form-B\n");
}
Def::Instance(i) => {
indent(out, level);
out.push_str("// (instance ");
out.push_str(&i.class);
out.push_str(") -- 22b.4 will render full Form-B\n");
}
}
}