feat: runtime content processing, supporting glue

This commit is contained in:
Brett Broadhurst 2026-03-30 16:47:05 -06:00
parent d325cdf965
commit f5eac49729
Failed to generate hash of commit
12 changed files with 387 additions and 286 deletions

View file

@ -697,10 +697,6 @@ fn irContentPush(sema: *Sema, builder: *Builder, inst: Ir.Inst.Index) InnerError
try builder.addByteOp(.stream_push);
}
fn irContentFlush(_: *Sema, builder: *Builder, _: Ir.Inst.Index) InnerError!void {
try builder.addByteOp(.stream_flush);
}
fn irChoiceBr(sema: *Sema, builder: *Builder, inst: Ir.Inst.Index) InnerError!void {
const gpa = sema.gpa;
const data = sema.ir.instructions[@intFromEnum(inst)].data.payload;
@ -716,6 +712,8 @@ fn irChoiceBr(sema: *Sema, builder: *Builder, inst: Ir.Inst.Index) InnerError!vo
const case_label = try builder.addLabel();
branch_labels.appendAssumeCapacity(case_label);
try builder.addByteOp(.stream_mark);
switch (case_extra.data.operand_1) {
.none => {},
else => |content| {
@ -762,8 +760,7 @@ fn irChoiceBr(sema: *Sema, builder: *Builder, inst: Ir.Inst.Index) InnerError!vo
try builder.addByteOp(.stream_push);
},
}
try builder.addByteOp(.stream_flush);
try builder.addByteOp(.stream_line);
_ = try analyzeBodyInner(sema, builder, body_slice, false);
}
}
@ -1018,8 +1015,12 @@ fn analyzeBodyInner(
try irContentPush(sema, builder, inst);
continue;
},
.content_flush => {
try irContentFlush(sema, builder, inst);
.content_line => {
try builder.addByteOp(.stream_line);
continue;
},
.content_glue => {
try builder.addByteOp(.stream_glue);
continue;
},
.choice_br => {