refactor(compiler): Stage-B compiler simplification and test infrastructure

**Compiler Simplification (compiler_stageb.hako):**
- Remove complex fallback system (_fallback_enabled, _fallback_program)
- Remove flag parsing system (_collect_flags, _parse_signed_int)
- Streamline to single-method implementation (main only)
- Focus: parse args/env → extract main body → FlowEntry emit
- 149 lines simplified, better maintainability

**Parser Cleanup:**
- Fix trailing whitespace in members.rs (static_def)
- Add child_env module to runner/mod.rs

**Test Infrastructure (stageb_helpers.sh):**
- Enhance Stage-B test helper functions
- Better error handling and diagnostics

**Context:**
These changes were made during PHI UseBeforeDef debugging session.
Simplified compiler_stageb.hako eliminates unnecessary complexity
while maintaining core Stage-B compilation functionality.

**Impact:**
 Reduced Stage-B compiler complexity (-12 lines net)
 Clearer single-responsibility implementation
 Better test infrastructure support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-01 20:58:26 +09:00
parent 9a9f7775cb
commit f813659d2e
4 changed files with 82 additions and 94 deletions

View File

@ -89,7 +89,7 @@ pub(crate) fn try_parse_method_or_field(
while p.match_token(&TokenType::NEWLINE) { p.advance(); }
// Parse method body; optionally use strict method-body guard when enabled
let body = if std::env::var("NYASH_PARSER_METHOD_BODY_STRICT").ok().as_deref() == Some("1") {
p.parse_method_body_statements()?
p.parse_method_body_statements()?
} else {
p.parse_block_statements()?
};