stage2: support dbg_stmt at comptime
This commit is contained in:
@@ -643,8 +643,12 @@ fn analyzeInstBreakVoid(mod: *Module, scope: *Scope, inst: *zir.Inst.BreakVoid)
|
||||
}
|
||||
|
||||
fn analyzeInstDbgStmt(mod: *Module, scope: *Scope, inst: *zir.Inst.NoOp) InnerError!*Inst {
|
||||
const b = try mod.requireRuntimeBlock(scope, inst.base.src);
|
||||
return mod.addNoOp(b, inst.base.src, Type.initTag(.void), .dbg_stmt);
|
||||
if (scope.cast(Scope.Block)) |b| {
|
||||
if (!b.is_comptime) {
|
||||
return mod.addNoOp(b, inst.base.src, Type.initTag(.void), .dbg_stmt);
|
||||
}
|
||||
}
|
||||
return mod.constVoid(scope, inst.base.src);
|
||||
}
|
||||
|
||||
fn analyzeInstDeclRefStr(mod: *Module, scope: *Scope, inst: *zir.Inst.DeclRefStr) InnerError!*Inst {
|
||||
|
||||
@@ -973,8 +973,8 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\comptime {
|
||||
\\ _ = foo;
|
||||
\\}
|
||||
\\extern var foo;
|
||||
, &[_][]const u8{":2:5: error: unable to resolve comptime value"});
|
||||
\\extern var foo: i32;
|
||||
, &[_][]const u8{":2:9: error: unable to resolve comptime value"});
|
||||
case.addError(
|
||||
\\export fn entry() void {
|
||||
\\ _ = foo;
|
||||
|
||||
Reference in New Issue
Block a user