diff --git a/tools/hako_shared/json_parser.hako b/tools/hako_shared/json_parser.hako index ddf2b582..4a75bac6 100644 --- a/tools/hako_shared/json_parser.hako +++ b/tools/hako_shared/json_parser.hako @@ -116,21 +116,20 @@ static box JsonParserBox { } } - // Digits (workaround: flatten to avoid MIR nested-if-in-loop bug) - local parsing_done = 0 + // Digits (fixed: use flat control flow instead of nested-if-in-loop) + local digits = "0123456789" loop(p < s.length()) { - if parsing_done == 1 { break } - local ch = s.substring(p, p+1) - local digits = "0123456789" local digit_pos = digits.indexOf(ch) - if digit_pos >= 0 { - num_str = num_str + ch - p = p + 1 - } else { - parsing_done = 1 + // Exit condition: non-digit character found + if digit_pos < 0 { + break } + + // Continue parsing: digit found + num_str = num_str + ch + p = p + 1 } if num_str == "" || num_str == "-" { return null }