View Source merlin_attributes (merlin v3.0.0)
Summary
Types
Represents an attribute form.
Functions
Return the arguments for the first attribute form with the given name, or {error, notfound}
if no such attribute is found.
Returns
true
if the given Form
is an attribute with the given name, false
otherwise.Return the name of an attribute form.
Types
-type attribute() :: merlin:ast().
Represents an attribute form.
That is, the AST for-some_attribute(...).
.
Functions
-spec find(Forms, Name) -> {ok, [merlin:ast()]} | {error, notfound} when Forms :: [merlin:ast()], Name :: atom().
Return the arguments for the first attribute form with the given name, or {error, notfound}
if no such attribute is found.
The user annotations are copied over from the attribute node. This is is useful to get the merlin_module:analysis()
for a module.
AnnotatedForms = merlin_module:annotate(Forms),
{ok, ModuleArguments} = merlin_attributes:find(Forms, module),
#{module := _} = merlin_annotations:get(ModuleArguments, analysis).
true
if the given Form
is an attribute with the given name, false
otherwise.
-spec name(attribute()) -> atom().