apps: fix ConsoleStd print recursion

This commit is contained in:
moe-charm
2025-09-23 13:03:35 +09:00
parent b7a3e129bd
commit 82957f3cf6

View File

@ -1,20 +1,26 @@
// ConsoleStd — minimal standard console helpers (commonized API) // ConsoleStd — minimal standard console helpers (commonized API)
// Global helper to avoid name shadowing when invoking the language-level print.
function __console_std_emit(value) {
print(value)
return 0
}
static box ConsoleStd { static box ConsoleStd {
// print/println/log: convert null to "" and return 0 // print/println/log: convert null to "" and return 0
print(x) { print(x) {
if x == null { x = "" } if x == null { x = "" }
print(x) __console_std_emit(x)
return 0 return 0
} }
println(x) { println(x) {
if x == null { x = "" } if x == null { x = "" }
print(x) __console_std_emit(x)
return 0 return 0
} }
log(x) { log(x) {
if x == null { x = "" } if x == null { x = "" }
print(x) __console_std_emit(x)
return 0 return 0
} }
} }