Add component parameter support and fix JS runtime

- Emit function parameters in component signature
- JS runtime passes props as positional arguments
- Remove incorrect return value handling (components call js_set_root internally)
- Enables: def Tabs(orientation=0)
- All tests passing (30/30)
This commit is contained in:
Aaron Sinclair committed 2025-11-15 03:39:43 -08:00
1 parent 41474aceda
commit cdddbf675a
5 files changed
+12 -7

No files matched your search

+10 -1
View File
@@ -196,8 +196,17 @@ class SignalLLVMIRGenerator:
def _emit_component(self, ir: dict[str, Any]) -> None:
"""Emit component render function."""
component_name = ir["name"]
# Build parameter list
params = ir.get("params", [])
param_list = []
for param in params:
# For now, all params are i32
param_list.append(f"i32 %{param['name']}")
param_str = ", ".join(param_list) if param_list else ""
self.lines.append("; Component render function")
self.lines.append(f"define void @render_{component_name}() {{")
self.lines.append(f"define void @render_{component_name}({param_str}) {{")
self.lines.append("entry:")
# Process component body (skip signals and functions, already handled)