-
Notifications
You must be signed in to change notification settings - Fork 8
add unused_identifier and special_identifier #20
Conversation
There are some corner cases with def func(_foo?, _bar!, <<_baz::binary>>) do
:ok
end (program [0, 0] - [3, 0]
(call [0, 0] - [2, 3]
function: (function_identifier [0, 0] - [0, 3])
(call [0, 4] - [0, 40]
function: (function_identifier [0, 4] - [0, 8])
(arguments [0, 8] - [0, 40]
(identifier [0, 9] - [0, 14])
(identifier [0, 16] - [0, 21])
(binary [0, 23] - [0, 39]
(binary_op [0, 25] - [0, 37]
left: (identifier [0, 25] - [0, 29])
right: (identifier [0, 31] - [0, 37])))))
(do_block [0, 41] - [2, 3]
(atom [1, 2] - [1, 5]
(atom_literal [1, 2] - [1, 5]))))) I think we have to check for |
We can remove
btw, which issues are you referring to? 🤔 |
__using__(x)
_another(y) (program [0, 0] - [3, 0]
(call [0, 0] - [0, 12]
function: (function_identifier [0, 0] - [0, 9])
(arguments [0, 9] - [0, 12]
(identifier [0, 10] - [0, 11])))
(call [1, 0] - [1, 11]
function: (function_identifier [1, 0] - [1, 8])
(arguments [1, 8] - [1, 11]
(identifier [1, 9] - [1, 10])))) <program>
<call>
<function_identifier type="function">__using__</function_identifier>
<arguments>(
<identifier>x</identifier>
)</arguments>
</call>
<call>
<function_identifier type="function">_another</function_identifier>
<arguments>(
<identifier>y</identifier>
)</arguments>
</call>
</program> in the above example, the identifier is represented |
removed |
Ok, it's about keeping the AST information. From query perspective we can still use (call function: (function_identifier) @special_function
(#match? @special_function "^__.+__$")) But if we are thinking of keeping AST consistent then we can use child-node as well like you said. |
yes,
child-node would expose the info, but not that consistent with AST nodes. Anyhow this is probably something we can solve later. |
Thinking again about child-node, If we add child-node for |
This introduces a couple of new issues. Earlier we used to alias
identifier
asremote_identifier
andfunction_identifier
. I removedremote_identifier
as it was not actually used for any highlighting(
dot_call
itself provides enough ways to highlight ifrequired).
function_identifier
on the other hand is tricky to remove,as we use it for def* highlight case.
One way is to introduce a child node
(function_identifier (special_identifier))
which keeps the info. Do we need this though?
fixes #19