julia
c5b49888 - [JuliaLowering] Make `@cfunction` identifier callable scope-resolved (#61609)

Commit
33 days ago
[JuliaLowering] Make `@cfunction` identifier callable scope-resolved (#61609) The non-`$` branch of `@cfunction` now scope-resolves an identifier callable so the lowered IR carries a binding reference (usable by downstream tools like a language server that consume the IR). The transform happens in `est_to_dst`, so both the new-style `@cfunction` macro and flisp-expanded `@cfunction` (e.g. via `@doc`) get the same treatment. The identifier inside `[K"inert" [K"Identifier"]]` is rewrapped in `K"static_eval"` with `scope_layer=1` (the outermost lowering layer, corresponding to the method module used by `method.c`'s `jl_toplevel_eval`), so the binding reference in the IR matches `@cfunction`'s flisp runtime resolution. Non-identifier callables (function definitions, etc.) stay inert since they are not direct binding references. At `_to_lowered_expr` time, the scope-resolved fptr is converted back to a bare `QuoteNode(Symbol)` so `method.c`'s `jl_toplevel_eval` looks it up in the method's module at eval time, preserving Base `@cfunction`'s current runtime behavior. --- Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Author
Parents
Loading