AstGen: emit dbg_stmt before function calls and branch conditions

This commit is contained in:
Veikka Tuominen 2022-03-15 15:11:35 +02:00
parent af2b03de83
commit 0f112b9f6d

View File

@ -5148,6 +5148,7 @@ fn ifExpr(
else
false;
try emitDbgNode(parent_gz, if_full.ast.cond_expr);
const cond: struct {
inst: Zir.Inst.Ref,
bool_bit: Zir.Inst.Ref,
@ -5458,6 +5459,7 @@ fn whileExpr(
else
false;
try emitDbgNode(parent_gz, while_full.ast.cond_expr);
const cond: struct {
inst: Zir.Inst.Ref,
bool_bit: Zir.Inst.Ref,
@ -5678,6 +5680,8 @@ fn forExpr(
else
false;
try emitDbgNode(parent_gz, for_full.ast.cond_expr);
const cond_rl: ResultLoc = if (payload_is_ref) .ref else .none;
const array_ptr = try expr(parent_gz, scope, cond_rl, for_full.ast.cond_expr);
const len = try parent_gz.addUnNode(.indexable_ptr_len, array_ptr, for_full.ast.cond_expr);
@ -7810,6 +7814,19 @@ fn callExpr(
break :blk .auto;
};
{
astgen.advanceSourceCursor(astgen.tree.tokens.items(.start)[call.ast.lparen]);
const line = astgen.source_line - gz.decl_line;
const column = astgen.source_column;
_ = try gz.add(.{ .tag = .dbg_stmt, .data = .{
.dbg_stmt = .{
.line = line,
.column = column,
},
} });
}
assert(callee != .none);
assert(node != 0);