stage2: break and continue out of loops

This commit is contained in:
Veikka Tuominen
2020-12-26 02:17:36 +02:00
parent c99c6c0a68
commit 40aad4f47e
3 changed files with 202 additions and 45 deletions

View File

@@ -796,6 +796,10 @@ pub const Scope = struct {
/// The first N instructions in a function body ZIR are arg instructions.
instructions: std.ArrayListUnmanaged(*zir.Inst) = .{},
label: ?Label = null,
break_block: ?*zir.Inst.Block = null,
continue_block: ?*zir.Inst.Block = null,
/// only valid if label != null or (continue_block and break_block) != null
break_result_loc: astgen.ResultLoc = undefined,
pub const Label = struct {
token: ast.TokenIndex,