AstGen: fix @breakpoint ZIR
Previously it relied on the breakpoint ZIR instruction being void, but that's no longer how things work.
This commit is contained in:
@@ -3894,11 +3894,11 @@ fn builtinCall(
|
||||
return rvalue(gz, scope, rl, result, node);
|
||||
},
|
||||
.breakpoint => {
|
||||
const result = try gz.add(.{
|
||||
_ = try gz.add(.{
|
||||
.tag = .breakpoint,
|
||||
.data = .{ .node = gz.astgen.decl.nodeIndexToRelative(node) },
|
||||
});
|
||||
return rvalue(gz, scope, rl, result, node);
|
||||
return rvalue(gz, scope, rl, .void_value, node);
|
||||
},
|
||||
.import => {
|
||||
const target = try expr(gz, scope, .none, params[0]);
|
||||
|
||||
@@ -280,6 +280,15 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\}
|
||||
, "");
|
||||
|
||||
// If expression with breakpoint that does not get hit
|
||||
case.addCompareOutput(
|
||||
\\export fn main() c_int {
|
||||
\\ var x: i32 = 1;
|
||||
\\ if (x != 1) @breakpoint();
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
|
||||
// Switch expression
|
||||
case.addCompareOutput(
|
||||
\\export fn main() c_int {
|
||||
|
||||
Reference in New Issue
Block a user