fix: JS backend compiles print() to console.log()

Bare `print()` calls in Lux now emit `console.log()` in JS output
instead of undefined `print()`. Fixes BUG-006.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 21:05:23 -05:00
parent 0ee3050704
commit d05b13d840
2 changed files with 5 additions and 1 deletions

View File

@@ -1066,6 +1066,10 @@ impl JsBackend {
let arg = self.emit_expr(&args[0])?;
return Ok(format!("String({})", arg));
}
if ident.name == "print" {
let arg = self.emit_expr(&args[0])?;
return Ok(format!("console.log({})", arg));
}
}
let arg_strs: Result<Vec<_>, _> = args.iter().map(|a| self.emit_expr(a)).collect();