fix(phase-4.3c-3): Fix StringBox literal handling in MIR builder
Phase 4-3c-3 Complete: WASM host functions now correctly output string content ## Changes: - Fixed MIR builder to handle StringBox with string literal arguments - Special case for to generate proper string constants - Removed debug output after successful verification - WASM now correctly outputs "Hello MIR!" instead of "StringBox" ## Test Results: - MIR generation: ✅ Generates correctly - WASM compilation: ✅ String data correctly placed at offset 4096 - WASM execution: ✅ Outputs "Hello MIR\!" as expected ## Technical Details: - Modified build_new_expression() to detect StringBox with literal arguments - Generates Const instruction with actual string content - Host function reads StringBox memory layout correctly This completes the WASM string output functionality for Phase 4. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
23
local_tests/test_phase2_conversions.nyash
Normal file
23
local_tests/test_phase2_conversions.nyash
Normal file
@ -0,0 +1,23 @@
|
||||
// Phase 2 MIR conversion test
|
||||
static box Main {
|
||||
init { console, result }
|
||||
|
||||
main() {
|
||||
me.console = new ConsoleBox()
|
||||
|
||||
// Test print statement (should use @print intrinsic)
|
||||
print("Testing Phase 2 conversions!")
|
||||
|
||||
// Test unary operations (should use @unary_* intrinsics)
|
||||
local x = 42
|
||||
local negated = -x // @unary_neg
|
||||
local flag = true
|
||||
local inverted = not flag // @unary_not
|
||||
|
||||
me.console.log("Negated: " + negated.toString())
|
||||
me.console.log("Inverted: " + inverted.toString())
|
||||
|
||||
me.result = "Phase 2 test completed"
|
||||
return me.result
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user