Expand description
Elixir: keyword Call identity (def, defmodule, quote, …),
and applied versus named operators.
Structs§
- Elixir
Remote Call - A recognized short-circuit
Kernelcall and the context its operands need.
Functions§
- elixir_
applying_ operator - The
binary_operatorthat appliesop, an operator token, orNonewhen the token is not applied there. - elixir_
applying_ remote_ call - The
Kernelremote call that appliesop, a short-circuit operator’s name — the callelixir_kernel_short_circuit_nameanswersopfor — with its argument list and ancestry, orNonewhenopsits anywhere else. A token’s parents are theoperator_identifier, then thedot, then the call; theidentifiernamingKernel.andsits on thedotdirectly. Any other node fails on the first one or two parents’ kinds, so the check is cheap enough to ask of every identifier a walk meets. - elixir_
call_ keyword - Reads the text of the
targetfield of an ElixirCallnode. - elixir_
do_ block_ call_ children - Iterates the direct-child
Callnodes inside thedo_blockof an Elixir Call (typically adefmodule). Used byNpm/Npato scan a module body for method-defining macros /defstructwithout descending into nested modules. Yields no items when the Call has nodo_block. - elixir_
is_ class_ macro - Class-defining macro (
defmodule). Paired withelixir_is_method_macrowhere a caller needs both (“any space-opening declaration”). - elixir_
is_ inside_ quote_ block - Returns true when
nodeis lexically nested inside thedo_blockof aquote do … endCall (Elixir’s metaprogramming template). Adef/defp/defmacro/defmacropinsidequotedoes not define a method of any enclosing module — the syntax tree is a code template emitted later, when the surrounding macro is invoked. Treating those quoted Calls as methods inflatesWmcand disagrees withNpm’s direct-children classification (#310). - elixir_
is_ method_ macro - Method-defining macros (
def,defp,defmacro,defmacrop). The set is duplicated across checker, getter, and several metric impls because each consults it from a different trait surface; centralising the literal here keeps future additions (e.g.defguard) consistent. - elixir_
kernel_ short_ circuit_ name - The name of the short-circuit operator a remote call on
Kernelwith arguments applies, orNonefor any other node: the||ofKernel.||(a, b), or ofx |> Kernel.||(y), which the pipe rewrites to it. Such a call expands theKernelmacro exactly asa || bdoes, so it short-circuits and decides as the operator does, where a capture (&Kernel.||/2, a call with no arguments) only names it. It has nobinary_operator, so its operands are the call’s arguments, and under a pipe the piped value, rather thanleft/rightfields. - elixir_
short_ circuit_ kind - The short-circuit operation an operator token kind applies, keyed by
its symbol:
&&for&&andand,||for||andor. A word form demands a boolean left operand, but it is the same conjunction or disjunction to read, so one sequence key serves both spellings.Nonefor any other kind. - elixir_
short_ circuit_ name elixir_short_circuit_kindfor an operator’s name aselixir_kernel_short_circuit_namereturns it: a token, or theidentifierspellingKernel.and/Kernel.or(#1582), whose bytes decide. Ask it only of such a name — an identifier is anandoperator nowhere else.