2021-09-06 17:13:52 +08:00
|
|
|
; Scopes
|
|
|
|
|
2022-08-06 18:58:06 +08:00
|
|
|
[
|
|
|
|
(function_item)
|
2023-11-04 05:21:01 +08:00
|
|
|
(struct_item)
|
|
|
|
(enum_item)
|
|
|
|
(union_item)
|
|
|
|
(type_item)
|
|
|
|
(trait_item)
|
|
|
|
(impl_item)
|
2022-08-06 18:58:06 +08:00
|
|
|
(closure_expression)
|
|
|
|
(block)
|
|
|
|
] @local.scope
|
2021-09-06 17:13:52 +08:00
|
|
|
|
|
|
|
; Definitions
|
|
|
|
|
|
|
|
(parameter
|
2025-02-25 01:46:34 +08:00
|
|
|
pattern: (identifier) @local.definition.variable.parameter)
|
2021-09-06 17:13:52 +08:00
|
|
|
|
2025-02-25 01:46:34 +08:00
|
|
|
(closure_parameters (identifier) @local.definition.variable.parameter)
|
2021-09-06 17:13:52 +08:00
|
|
|
|
|
|
|
; References
|
|
|
|
(identifier) @local.reference
|
2025-07-12 21:35:13 +08:00
|
|
|
|
|
|
|
; In here, `bar` is a function, as it is equal to a closure:
|
|
|
|
;
|
|
|
|
; let bar = || 4;
|
|
|
|
;
|
|
|
|
; After this, we know that `bar` must be a function:
|
|
|
|
;
|
|
|
|
; let a = bar;
|
|
|
|
; ^^^ function
|
|
|
|
;
|
|
|
|
; let a = f(bar)
|
|
|
|
; ^^^ function
|
|
|
|
(let_declaration
|
|
|
|
pattern: (identifier) @local.definition.function
|
|
|
|
value: (closure_expression))
|