Expand description
Elixir: keyword Call identity (def, defmodule, quote, …),
and applied versus named operators.
Functions§
- elixir_
applying_ operator - The
binary_operatorthat appliesop, an operator token, orNonewhen the token is not applied there. - 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_
remote_ call_ applies - Whether
op, an operator token, is the name of a remote call onKernelwith arguments:Kernel.||(a, b), orx |> 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 it carries noleft/rightoperands either.