Lua: improve scope queries

- Set scope to parent
- Group all scopes
- Use the . operator
This commit is contained in:
Santos Gallegos 2021-02-06 22:29:14 -05:00 committed by Thomas Vigouroux
parent 83c3b4ad75
commit e5319aa9aa

View file

@ -15,28 +15,28 @@
(identifier) @definition.var))
;; Function definitions
;; Functions definitions creates both a definition and a new scope
((function
(function_name
(function_name_field
(identifier) @definition.associated
(property_identifier) @definition.method))) @scope)
(identifier) @definition.associated . (property_identifier) @definition.method)))
(#set! definition.method.scope "parent"))
((function
(function_name (identifier) @definition.function)) @scope)
(function_name (identifier) @definition.function))
(#set! definition.function.scope "parent"))
((local_function (identifier) @definition.function)
(#set! definition.function.scope "parent"))
((local_function
(identifier) @definition.function) @scope)
[
(local_variable_declaration
(variable_declarator
(identifier) @definition.function)
(function_definition) @scope)
(function_definition) @scope
]
(variable_declarator (identifier) @definition.function) . (function_definition))
;; Scopes
[
(program)
(function)
(local_function)
(function_definition)
(if_statement)
(for_in_statement)
(repeat_statement)