Severity: High
Area: Compiler — codegen.ex
Description
local function name() ... end (i.e., Statement.LocalFunc AST nodes) has no codegen handler. The catch-all defp gen_statement(_stmt, ctx), do: {[], ctx} silently discards the declaration — no instructions are emitted and no error is raised.
Reproduction
local function add(a, b)
return a + b
end
return add(1, 2)
-- Expected: 3
-- Actual: runtime error — "add" is nil
Workaround
Use a regular (global) function declaration or an assignment:
function add(a, b) -- global
return a + b
end
local add = function(a, b) -- explicit assignment
return a + b
end
Severity: High
Area: Compiler —
codegen.exDescription
local function name() ... end(i.e.,Statement.LocalFuncAST nodes) has no codegen handler. The catch-alldefp gen_statement(_stmt, ctx), do: {[], ctx}silently discards the declaration — no instructions are emitted and no error is raised.Reproduction
Workaround
Use a regular (global) function declaration or an assignment: