diff --git a/el-compiler/src/codegen.el b/el-compiler/src/codegen.el index 81b164d..f253533 100644 --- a/el-compiler/src/codegen.el +++ b/el-compiler/src/codegen.el @@ -690,6 +690,12 @@ fn cg_expr(expr: Map) -> String { } } } + // http_serve(port): backward-compat 1-arg form — auto-inject handle_request + if str_eq(fn_name, "http_serve") { + if arity == 1 { + return "http_serve(" + args_c + ", handle_request)" + } + } return fn_name + "(" + args_c + ")" } @@ -1995,7 +2001,7 @@ fn builtin_arity(name: String) -> Int { if str_eq(name, "http_get_with_headers") { return 2 } if str_eq(name, "http_post_with_headers") { return 3 } if str_eq(name, "http_post_form_auth") { return 3 } - if str_eq(name, "http_serve") { return 2 } + if str_eq(name, "http_serve") { return -1 } // variadic: 1-arg (port, auto-injects handle_request) or 2-arg (port, handler) if str_eq(name, "http_set_handler") { return 1 } // Filesystem if str_eq(name, "fs_read") { return 1 }