← All docs
function_exists() — internals
Compiler internals for function_exists(): lowering path, type checks, and runtime helpers.
function_exists() — internals
Where it lives
- Signature:
src/builtins/callables/function_exists.rs - Lowering:
src/codegen/lower_inst/builtins.rs:568 (lower_function_exists) - Function symbol:
lower_function_exists()
Lowering notes
- Lowers
function_exists("name")for compile-time string names. - Recognizes user functions, externs, catalog builtins, and the date/time procedural aliases
- that
name_resolverdesugars (including the injected timezone-introspection prelude - functions). The aliases are matched through
is_date_procedural_aliasrather than the catalog - because their call sites are rewritten before codegen, so they never reach the builtin catalog
- yet must still report as existing to match PHP.
Runtime helpers
No direct __rt_* helpers captured — the lowering is inlined or routes through another builtin.
Signature summary
function function_exists(string $function): bool
What the type checker enforces
- Arity: takes exactly 1 argument.
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/symbols/function_exists.rs(eval_builtin!) - Dispatch hooks:
direct,values