feat: Apply Copilot's WASM UTF-8 fix manually
- Change from compile_module() to compile_to_wat() to fix UTF-8 error - WASM compilation now outputs WAT text format directly - Successfully generates WAT file for simple test case - Note: Debug build still has issues (separate bug) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -300,10 +300,10 @@ impl NyashRunner {
|
||||
}
|
||||
};
|
||||
|
||||
// Compile to WASM
|
||||
// Compile to WASM (Phase 9.77a fix: use compile_to_wat instead of compile_module)
|
||||
let mut wasm_backend = WasmBackend::new();
|
||||
let wasm_code = match wasm_backend.compile_module(compile_result.module) {
|
||||
Ok(wasm) => wasm,
|
||||
let wat_text = match wasm_backend.compile_to_wat(compile_result.module) {
|
||||
Ok(wat) => wat,
|
||||
Err(e) => {
|
||||
eprintln!("❌ WASM compilation error: {}", e);
|
||||
process::exit(1);
|
||||
@ -321,14 +321,8 @@ impl NyashRunner {
|
||||
});
|
||||
let output_file = format!("{}.wat", output);
|
||||
|
||||
// Write WASM output
|
||||
let output_str = match std::str::from_utf8(&wasm_code) {
|
||||
Ok(s) => s,
|
||||
Err(_) => {
|
||||
eprintln!("❌ Generated WASM is not valid UTF-8");
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
// Write WAT output (already a string)
|
||||
let output_str = wat_text;
|
||||
|
||||
match fs::write(&output_file, output_str) {
|
||||
Ok(()) => {
|
||||
|
||||
Reference in New Issue
Block a user