Stage‑B fallback TTL: HAKO_STAGEB_ALLOW_FALLBACK (default ON); Runner helper child_env (OOB strict helpers) and use in Gate‑C; Add quick smokes: map len/set/get, string index/substring; Bridge canonicalize tests default‑on; Update bridge scripts to robust root detection.
This commit is contained in:
@ -4,6 +4,15 @@ using lang.compiler.parser.box as ParserBox
|
||||
using lang.compiler.pipeline_v2.flow_entry as FlowEntryBox
|
||||
|
||||
static box StageBMain {
|
||||
_fallback_enabled() {
|
||||
// Default ON; set HAKO_STAGEB_ALLOW_FALLBACK=0 (or NYASH_STAGEB_ALLOW_FALLBACK=0) to disable
|
||||
local v = env.local.get("HAKO_STAGEB_ALLOW_FALLBACK")
|
||||
if v == null { v = env.local.get("NYASH_STAGEB_ALLOW_FALLBACK") }
|
||||
if v == null { return 1 }
|
||||
local s = "" + v
|
||||
if s == "0" or s == "false" or s == "off" { return 0 }
|
||||
return 1
|
||||
}
|
||||
_fallback_program() {
|
||||
return "{\"version\":0,\"kind\":\"Program\",\"body\":[{\"type\":\"Return\",\"expr\":{\"type\":\"Int\",\"value\":0}}]}"
|
||||
}
|
||||
@ -79,7 +88,12 @@ static box StageBMain {
|
||||
jv0 = FlowEntryBox.emit_v0_from_ast(ast_json, prefer)
|
||||
}
|
||||
if jv0 == null || jv0 == "" {
|
||||
jv0 = me._fallback_program()
|
||||
if me._fallback_enabled() == 1 {
|
||||
jv0 = me._fallback_program()
|
||||
} else {
|
||||
// Return empty to surface failure at caller; TTL: enable stricter failure once all paths are green
|
||||
jv0 = ""
|
||||
}
|
||||
}
|
||||
return jv0
|
||||
}
|
||||
@ -91,7 +105,7 @@ static box StageBMain {
|
||||
local stage3 = flags.stage3
|
||||
local v1_compat = flags.v1_compat
|
||||
local json = me._do_compile_stage_b(src, prefer, stage3, v1_compat)
|
||||
if json == null || json == "" { json = me._fallback_program() }
|
||||
if (json == null || json == "") && me._fallback_enabled() == 1 { json = me._fallback_program() }
|
||||
print(json)
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user