aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/erlang/locals.scm
blob: 156e403817d4d54f422e4509cbaecafb120c6586 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
; Specs and Callbacks
(attribute
  (stab_clause
    pattern: (arguments (variable)? @local.definition)
    ; If a spec uses a variable as the return type (and later a `when` clause to type it):
    body: (variable)? @local.definition)) @local.scope

; parametric `-type`s
((attribute
    name: (atom) @_type
    (arguments
      (binary_operator
        left: (call (arguments (variable) @local.definition))
        operator: "::") @local.scope))
 (#match? @_type "(type|opaque)"))

; macros
((attribute
   name: (atom) @_define
   (arguments
     (call (arguments (variable) @local.definition)))) @local.scope
 (#eq? @_define "define"))

; `fun`s
(anonymous_function (stab_clause pattern: (arguments (variable) @local.definition))) @local.scope

; Ordinary functions
(function_clause pattern: (arguments (variable) @local.definition)) @local.scope

(variable) @local.reference