feat(joinir): Phase 183 LoopBodyLocal role separation + test fixes
Phase 183 Implementation: - Added is_var_used_in_condition() helper for AST variable detection - Implemented LoopBodyLocal filtering in TrimLoopLowerer - Created 4 test files for P1/P2 patterns - Added 5 unit tests for variable detection Test Fixes: - Fixed test_is_outer_scope_variable_pinned (BasicBlockId import) - Fixed test_pattern2_accepts_loop_param_only (literal node usage) Refactoring: - Unified pattern detection documentation - Consolidated CarrierInfo initialization - Documented LoopScopeShape construction paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -327,10 +327,12 @@ static box Stage1Cli {
|
||||
}
|
||||
local prog_path = null
|
||||
local source_path = null
|
||||
// Predeclare to avoid creating loop-body-local variables in the condition scope.
|
||||
local arg = ""
|
||||
|
||||
local i = 2
|
||||
loop(i < argc) {
|
||||
local arg = "" + args.get(i)
|
||||
arg = "" + args.get(i)
|
||||
if arg == "--from-program-json" {
|
||||
if i + 1 >= argc {
|
||||
print("[stage1-cli] emit mir-json: --from-program-json requires a path")
|
||||
@ -392,10 +394,12 @@ static box Stage1Cli {
|
||||
}
|
||||
local backend = "vm"
|
||||
local source_path = null
|
||||
// Predeclare to keep the loop condition independent of loop-body-local variables.
|
||||
local arg = ""
|
||||
|
||||
local i = 1
|
||||
loop(i < argc) {
|
||||
local arg = "" + args.get(i)
|
||||
arg = "" + args.get(i)
|
||||
if arg == "--backend" {
|
||||
if i + 1 >= argc {
|
||||
print("[stage1-cli] run: --backend requires a value (vm|llvm|pyvm)")
|
||||
@ -403,11 +407,13 @@ static box Stage1Cli {
|
||||
}
|
||||
backend = "" + args.get(i + 1)
|
||||
i = i + 2
|
||||
} else {
|
||||
source_path = arg
|
||||
i = i + 1
|
||||
break
|
||||
continue
|
||||
}
|
||||
|
||||
// First non-option argument is the source path; exit loop after capture.
|
||||
source_path = arg
|
||||
i = i + 1
|
||||
if source_path != null { i = argc }
|
||||
}
|
||||
|
||||
if source_path == null || source_path == "" {
|
||||
|
||||
Reference in New Issue
Block a user