selfhost(pyvm): MiniVmPrints – prefer JSON route early-return (ok==1) to avoid fallback loops; keep default behavior unchanged elsewhere
This commit is contained in:
38
apps/selfhost/compiler/boxes/debug_box.nyash
Normal file
38
apps/selfhost/compiler/boxes/debug_box.nyash
Normal file
@ -0,0 +1,38 @@
|
||||
// DebugBox — conditional debug output aggregator (extracted)
|
||||
box DebugBox {
|
||||
enabled
|
||||
birth() {
|
||||
me.enabled = 0
|
||||
return 0
|
||||
}
|
||||
set_enabled(v) {
|
||||
me.enabled = v
|
||||
return 0
|
||||
}
|
||||
log(msg) {
|
||||
if me.enabled {
|
||||
local c = new ConsoleBox()
|
||||
c.println("[DEBUG] " + msg)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
info(msg) {
|
||||
if me.enabled {
|
||||
local c = new ConsoleBox()
|
||||
c.println("[INFO] " + msg)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
error(msg) {
|
||||
if me.enabled {
|
||||
local c = new ConsoleBox()
|
||||
c.println("[ERROR] " + msg)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// Include stub to satisfy current include lowering (expects a static box)
|
||||
static box DebugStub {
|
||||
main(args) { return 0 }
|
||||
}
|
||||
Reference in New Issue
Block a user