feat: runtime content processing, supporting glue
This commit is contained in:
parent
d325cdf965
commit
f5eac49729
12 changed files with 387 additions and 286 deletions
17
src/Sema.zig
17
src/Sema.zig
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue