feat(repl): REPL Quiet Mode - デバッグログ自動抑制

REPL mode では内部デバッグログを自動抑制:
- src/runner/repl/repl_runner.rs: NYASH_QUIET_INTERNAL_LOGS 設定/解除
- src/mir/builder/decls.rs: NYASH_QUIET_INTERNAL_LOGS チェック追加
- NYASH_CLI_VERBOSE=1 でデバッグログ有効化可能

UX improvement:
  Before: >>> print("Hello")
          [build_static_main_box] Storing fn_body_ast...
          Hello

  After:  >>> print("Hello")
          Hello

Test results:
   通常モード: ログ抑制
   デバッグモード (NYASH_CLI_VERBOSE=1): ログ表示
   File mode regression: 154/154 pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 14:26:42 +09:00
parent dd1b2a22e1
commit 1cec724ce0
2 changed files with 18 additions and 4 deletions

View File

@ -129,10 +129,12 @@ impl super::MirBuilder {
}
}
// Phase 200-C: Store fn_body_ast for inline main() lowering
eprintln!(
"[build_static_main_box] Storing fn_body_ast with {} nodes for inline main()",
body.len()
);
if std::env::var("NYASH_QUIET_INTERNAL_LOGS").ok().as_deref() != Some("1") {
eprintln!(
"[build_static_main_box] Storing fn_body_ast with {} nodes for inline main()",
body.len()
);
}
self.comp_ctx.fn_body_ast = Some(body.clone());
// Lower statements in order to preserve def→use

View File

@ -99,6 +99,12 @@ impl ReplRunnerBox {
use crate::mir::MirCompiler;
use crate::backend::mir_interpreter::MirInterpreter;
// REPL mode では内部デバッグログを抑制NYASH_CLI_VERBOSE=1 で無効化)
let verbose = std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1");
if !verbose {
std::env::set_var("NYASH_QUIET_INTERNAL_LOGS", "1");
}
// Initialize session on first use
{
let mut session_ref = self.session.borrow_mut();
@ -138,6 +144,12 @@ impl ReplRunnerBox {
// Phase 288 P3: print() output already displayed via ExternCall
// Expression auto-display deferred to Phase 288.1
// 評価完了後に環境変数をクリーンアップ
if !verbose {
std::env::remove_var("NYASH_QUIET_INTERNAL_LOGS");
}
Ok(String::new())
}
}