Stage-B: add --v1-compat opt-in path and smoke

This commit is contained in:
nyash-codex
2025-11-01 03:56:25 +09:00
parent 1f415e733c
commit 4f4ee948e0
6 changed files with 92 additions and 6 deletions

View File

@ -28,7 +28,7 @@ static box StageBMain {
}
_collect_flags(args) {
local flags = { source: null, prefer_cfg: 1, stage3: 0 }
local flags = { source: null, prefer_cfg: 1, stage3: 0, v1_compat: 0 }
if args == null { return flags }
local i = 0
@ -44,6 +44,8 @@ static box StageBMain {
i = i + 1
} else if token == "--stage3" {
flags.stage3 = 1
} else if token == "--v1-compat" {
flags.v1_compat = 1
}
i = i + 1
}
@ -65,8 +67,14 @@ static box StageBMain {
local externs_json = p.get_externs_json()
local ast_json = p.parse_program2(src)
local prefer = flags.prefer_cfg
local jv0 = FlowEntryBox.emit_v0_from_ast_with_context(ast_json, prefer, usings_json, null, externs_json)
if jv0 == null {
local jv0 = null
if flags.v1_compat == 1 {
jv0 = FlowEntryBox.emit_v1_compat_from_ast_with_meta(ast_json, prefer, externs_json)
}
if jv0 == null || jv0 == "" {
jv0 = FlowEntryBox.emit_v0_from_ast_with_context(ast_json, prefer, usings_json, null, externs_json)
}
if jv0 == null || jv0 == "" {
jv0 = FlowEntryBox.emit_v0_from_ast(ast_json, prefer)
}
// Attach usings metadata when availableStage-B pipeline consumes via resolver