From c617ed5589d70a4d3cb03a17a5f4859828081b3c Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 12:52:33 +0100 Subject: [PATCH 1/6] Update argument list domains and argument iteration domains in JS and TS --- .../argumentList.formal.empty10.scope | 13 + .../argumentList.formal.empty11.scope | 13 + .../argumentList.formal.empty12.scope | 13 + .../argumentList.formal.empty13.scope | 13 + .../argumentList.formal.empty14.scope | 13 + .../argumentList.formal.empty15.scope | 13 + .../argumentList.formal.empty2.scope | 13 + .../argumentList.formal.empty3.scope | 13 + .../argumentList.formal.empty4.scope | 13 + .../argumentList.formal.empty5.scope | 13 + .../argumentList.formal.empty6.scope | 13 + .../argumentList.formal.empty7.scope | 13 + .../argumentList.formal.empty8.scope | 13 + .../argumentList.formal.empty9.scope | 13 + .../argumentList.formal.method.empty2.scope | 18 + .../argumentList.formal.method.empty3.scope | 15 + .../argumentList.formal.method.empty4.scope | 18 + .../argumentList.formal.method.empty5.scope | 15 + .../argumentList.formal.method.empty6.scope | 15 + .../argumentList.formal.method.empty7.scope | 15 + .../argumentList.formal.method.empty8.scope | 15 + ...rgumentList.formal.constructor.empty.scope | 15 + .../argumentList.formal.empty.scope | 13 + .../argumentList.formal.empty2.scope | 13 + .../argumentList.formal.method.empty.scope | 15 + .../argumentList.formal.method.empty2.scope | 15 + queries/javascript.core.scm | 11 - queries/javascript.function.scm | 504 ++++++++++++++---- queries/javascript.scm | 60 ++- queries/typescript.core.scm | 130 +++-- 30 files changed, 921 insertions(+), 148 deletions(-) create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty10.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty11.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty12.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty13.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty14.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty15.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty2.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty3.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty4.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty5.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty6.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty7.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty8.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty9.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty2.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty3.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty4.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty5.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty6.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty7.scope create mode 100644 data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty8.scope create mode 100644 data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.constructor.empty.scope create mode 100644 data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty.scope create mode 100644 data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty2.scope create mode 100644 data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty.scope create mode 100644 data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty2.scope diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty10.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty10.scope new file mode 100644 index 0000000000..f2c8d6f5ef --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty10.scope @@ -0,0 +1,13 @@ +export const foo = () => {}; +--- + +[Content] = +[Removal] = 0:20-0:20 + >< +0| export const foo = () => {}; + +[Domain] = 0:0-0:28 + >----------------------------< +0| export const foo = () => {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty11.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty11.scope new file mode 100644 index 0000000000..17d66b7410 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty11.scope @@ -0,0 +1,13 @@ +export default function() {} +--- + +[Content] = +[Removal] = 0:24-0:24 + >< +0| export default function() {} + +[Domain] = 0:0-0:28 + >----------------------------< +0| export default function() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty12.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty12.scope new file mode 100644 index 0000000000..7d2b9e851c --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty12.scope @@ -0,0 +1,13 @@ +export default function *() {} +--- + +[Content] = +[Removal] = 0:26-0:26 + >< +0| export default function *() {} + +[Domain] = 0:0-0:30 + >------------------------------< +0| export default function *() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty13.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty13.scope new file mode 100644 index 0000000000..c7d6b7b418 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty13.scope @@ -0,0 +1,13 @@ +export default () => {}; +--- + +[Content] = +[Removal] = 0:16-0:16 + >< +0| export default () => {}; + +[Domain] = 0:0-0:24 + >------------------------< +0| export default () => {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty14.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty14.scope new file mode 100644 index 0000000000..a3e8948241 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty14.scope @@ -0,0 +1,13 @@ +const foo = function bar() {}; +--- + +[Content] = +[Removal] = 0:25-0:25 + >< +0| const foo = function bar() {}; + +[Domain] = 0:12-0:29 + >-----------------< +0| const foo = function bar() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty15.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty15.scope new file mode 100644 index 0000000000..af98fc1517 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty15.scope @@ -0,0 +1,13 @@ +const foo = function *bar() {}; +--- + +[Content] = +[Removal] = 0:26-0:26 + >< +0| const foo = function *bar() {}; + +[Domain] = 0:12-0:30 + >------------------< +0| const foo = function *bar() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty2.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty2.scope new file mode 100644 index 0000000000..5bee893b29 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty2.scope @@ -0,0 +1,13 @@ +function *foo() {} +--- + +[Content] = +[Removal] = 0:14-0:14 + >< +0| function *foo() {} + +[Domain] = 0:0-0:18 + >------------------< +0| function *foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty3.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty3.scope new file mode 100644 index 0000000000..bbba3b2748 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty3.scope @@ -0,0 +1,13 @@ +const foo = function() {}; +--- + +[Content] = +[Removal] = 0:21-0:21 + >< +0| const foo = function() {}; + +[Domain] = 0:0-0:26 + >--------------------------< +0| const foo = function() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty4.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty4.scope new file mode 100644 index 0000000000..9a058aae26 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty4.scope @@ -0,0 +1,13 @@ +const foo = function *() {}; +--- + +[Content] = +[Removal] = 0:23-0:23 + >< +0| const foo = function *() {}; + +[Domain] = 0:0-0:28 + >----------------------------< +0| const foo = function *() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty5.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty5.scope new file mode 100644 index 0000000000..ec98fc5fe1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty5.scope @@ -0,0 +1,13 @@ +const foo = () => {}; +--- + +[Content] = +[Removal] = 0:13-0:13 + >< +0| const foo = () => {}; + +[Domain] = 0:0-0:21 + >---------------------< +0| const foo = () => {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty6.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty6.scope new file mode 100644 index 0000000000..634728e55a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty6.scope @@ -0,0 +1,13 @@ +export function foo() {} +--- + +[Content] = +[Removal] = 0:20-0:20 + >< +0| export function foo() {} + +[Domain] = 0:0-0:24 + >------------------------< +0| export function foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty7.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty7.scope new file mode 100644 index 0000000000..946d2c9a3b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty7.scope @@ -0,0 +1,13 @@ +export function *foo() {} +--- + +[Content] = +[Removal] = 0:21-0:21 + >< +0| export function *foo() {} + +[Domain] = 0:0-0:25 + >-------------------------< +0| export function *foo() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty8.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty8.scope new file mode 100644 index 0000000000..18a277b6b2 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty8.scope @@ -0,0 +1,13 @@ +export const foo = function() {}; +--- + +[Content] = +[Removal] = 0:28-0:28 + >< +0| export const foo = function() {}; + +[Domain] = 0:0-0:33 + >---------------------------------< +0| export const foo = function() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty9.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty9.scope new file mode 100644 index 0000000000..1a2dc951c3 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.empty9.scope @@ -0,0 +1,13 @@ +export const foo = function *() {}; +--- + +[Content] = +[Removal] = 0:30-0:30 + >< +0| export const foo = function *() {}; + +[Domain] = 0:0-0:35 + >-----------------------------------< +0| export const foo = function *() {}; + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty2.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty2.scope new file mode 100644 index 0000000000..680af8018e --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty2.scope @@ -0,0 +1,18 @@ +class Foo { + @baz + bar() {} +} +--- + +[Content] = +[Removal] = 2:8-2:8 + >< +2| bar() {} + +[Domain] = 1:4-2:12 + >---- +1| @baz +2| bar() {} + ------------< + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty3.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty3.scope new file mode 100644 index 0000000000..286584f082 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty3.scope @@ -0,0 +1,15 @@ +class Foo { + bar = () => {} +} +--- + +[Content] = +[Removal] = 1:11-1:11 + >< +1| bar = () => {} + +[Domain] = 1:4-1:18 + >--------------< +1| bar = () => {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty4.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty4.scope new file mode 100644 index 0000000000..0dfd01f24c --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty4.scope @@ -0,0 +1,18 @@ +class Foo { + @baz + bar = () => {} +} +--- + +[Content] = +[Removal] = 2:11-2:11 + >< +2| bar = () => {} + +[Domain] = 1:4-2:18 + >---- +1| @baz +2| bar = () => {} + ------------------< + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty5.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty5.scope new file mode 100644 index 0000000000..293601dd6d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty5.scope @@ -0,0 +1,15 @@ +const foo = { + bar() {} +} +--- + +[Content] = +[Removal] = 1:8-1:8 + >< +1| bar() {} + +[Domain] = 1:4-1:12 + >--------< +1| bar() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty6.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty6.scope new file mode 100644 index 0000000000..4d4bd8b06a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty6.scope @@ -0,0 +1,15 @@ +const foo = { + bar: function() {} +} +--- + +[Content] = +[Removal] = 1:18-1:18 + >< +1| bar: function() {} + +[Domain] = 1:4-1:22 + >------------------< +1| bar: function() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty7.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty7.scope new file mode 100644 index 0000000000..42ef65052e --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty7.scope @@ -0,0 +1,15 @@ +const foo = { + bar: function *() {} +} +--- + +[Content] = +[Removal] = 1:20-1:20 + >< +1| bar: function *() {} + +[Domain] = 1:4-1:24 + >--------------------< +1| bar: function *() {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty8.scope b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty8.scope new file mode 100644 index 0000000000..50b7ae42b7 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argumentList/argumentList.formal.method.empty8.scope @@ -0,0 +1,15 @@ +const foo = { + bar: () => {} +} +--- + +[Content] = +[Removal] = 1:10-1:10 + >< +1| bar: () => {} + +[Domain] = 1:4-1:17 + >-------------< +1| bar: () => {} + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.constructor.empty.scope b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.constructor.empty.scope new file mode 100644 index 0000000000..2bc555daba --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.constructor.empty.scope @@ -0,0 +1,15 @@ +class Foo { + constructor(); +} +--- + +[Content] = +[Removal] = 1:16-1:16 + >< +1| constructor(); + +[Domain] = 1:4-1:18 + >--------------< +1| constructor(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty.scope b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty.scope new file mode 100644 index 0000000000..df504067a7 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty.scope @@ -0,0 +1,13 @@ +function foo(); +--- + +[Content] = +[Removal] = 0:13-0:13 + >< +0| function foo(); + +[Domain] = 0:0-0:15 + >---------------< +0| function foo(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty2.scope b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty2.scope new file mode 100644 index 0000000000..4493d81a54 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.empty2.scope @@ -0,0 +1,13 @@ +export function foo(); +--- + +[Content] = +[Removal] = 0:20-0:20 + >< +0| export function foo(); + +[Domain] = 0:0-0:22 + >----------------------< +0| export function foo(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty.scope b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty.scope new file mode 100644 index 0000000000..ae51283e97 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty.scope @@ -0,0 +1,15 @@ +class Foo { + bar(); +} +--- + +[Content] = +[Removal] = 1:8-1:8 + >< +1| bar(); + +[Domain] = 1:4-1:10 + >------< +1| bar(); + +[Insertion delimiter] = "" diff --git a/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty2.scope b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty2.scope new file mode 100644 index 0000000000..e3434c3aeb --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argumentList/argumentList.formal.method.empty2.scope @@ -0,0 +1,15 @@ +class Foo { + abstract bar(); +} +--- + +[Content] = +[Removal] = 1:17-1:17 + >< +1| abstract bar(); + +[Domain] = 1:4-1:19 + >---------------< +1| abstract bar(); + +[Insertion delimiter] = "" diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 3542c89eac..aeb386c826 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -807,17 +807,6 @@ (#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n") ) -;;!! function foo(aaa, bbb) {} -;;! ^^^^^^^^ -(_ - (formal_parameters - "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf - ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf - ) @argumentList - (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") - (#child-range! @argumentList 1 -2) -) @argumentList.domain @argumentOrParameter.iteration.domain - (formal_parameters "(" @name.iteration.start.endOf @value.iteration.start.endOf @type.iteration.start.endOf ")" @name.iteration.end.startOf @value.iteration.end.startOf @type.iteration.end.startOf diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index c65a56475f..f686519e0e 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -4,13 +4,14 @@ ;; see javascript.scm. ;; Anonymous functions + [ - ;;!! function() {} + ;;!! function () {} (function_expression !name ) - ;;!! function *() {} + ;;!! function* () {} (generator_function !name ) @@ -19,126 +20,428 @@ (arrow_function) ] @anonymousFunction +;; -------------------------------------------------------------------------- + +;; Anonymous functions argument lists + +;;!! function () {} +( + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @argumentList.domain export_statement variable_declarator assignment_expression pair field_definition public_field_definition) +) + +;;!! function* () {} +( + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @argumentList.domain export_statement variable_declarator assignment_expression pair field_definition public_field_definition) +) + +;;!! () => {} +( + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @argumentList.domain export_statement variable_declarator assignment_expression pair field_definition public_field_definition) +) + +;; -------------------------------------------------------------------------- + ;; If we export an anonymous function as default, it semantically feels like a ;; named function. + +;;!! export default function() {} (export_statement - [ - ;;!! export default function() {} - (function_expression - !name + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export default function* () {} +(export_statement + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export default () => {} +(export_statement + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;; -------------------------------------------------------------------------- + +;; Named functions without export + +;;!! function foo() {} +( + (function_declaration + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) + +;;!! function* foo() {} +( + (generator_function_declaration + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) + +;;!! (let | const) foo = () => {} +( + (lexical_declaration + (variable_declarator + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) - ;;!! export default function *() {} - (generator_function - !name +;;!! (let | const) foo = function () {} +( + (lexical_declaration + (variable_declarator + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) - ;;!! export default () => {} - (arrow_function) - ] -) @namedFunction +;;!! (let | const) foo = function* () {} +( + (lexical_declaration + (variable_declarator + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) -;; Named functions without export +;;!! (let | const) foo = () => {} +( + (lexical_declaration + (variable_declarator + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) + +;; Note that we can't merge this with the variable declaration above because +;; of https://github.com/tree-sitter/tree-sitter/issues/1442#issuecomment-1584628651 + +;;!! var foo = function () {} +( + (variable_declaration + (variable_declarator + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) + +;;!! var foo = function* () {} ( - [ - ;;!! function foo() {} - (function_declaration) - - ;;!! function *foo() {} - (generator_function_declaration) - - ;;!! (let | const) foo = () => {} - ;;!! (let | const) foo = function() {} - ;;!! (let | const) foo = function *() {} - (lexical_declaration - (variable_declarator - value: [ - (function_expression - !name - ) - (generator_function - !name - ) - (arrow_function) - ] + (variable_declaration + (variable_declarator + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) ) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + (#not-parent-type? @namedFunction export_statement) +) - ;;!! var foo = () => {} - ;;!! var foo = function() {} - ;;!! var foo = function *() {} - ;; Note that we can't merge this with the variable declaration above because - ;; of https://github.com/tree-sitter/tree-sitter/issues/1442#issuecomment-1584628651 - (variable_declaration - (variable_declarator - value: [ - (function_expression - !name - ) - (generator_function - !name - ) - (arrow_function) - ] +;;!! var foo = () => {} +( + (variable_declaration + (variable_declarator + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) ) - ] @namedFunction + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain (#not-parent-type? @namedFunction export_statement) ) +;; -------------------------------------------------------------------------- + ;; Exported named functions + +;;!! export [default] function foo() {} +(export_statement + (function_declaration + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export [default] function* foo() {} +(export_statement + (generator_function_declaration + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export [default] (let | const | var) foo = function() {} +(export_statement + (_ + (variable_declarator + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export [default] (let | const | var) foo = function* () {} (export_statement - [ - ;;!! export [default] function foo() {} - (function_declaration) - - ;;!! export [default] function *foo() {} - (generator_function_declaration) - - ;;!! export [default] (let | const | var) foo = function() {} - ;;!! export [default] (let | const | var) foo = function *() {} - ;;!! export [default] (let | const | var) foo = () => {} - (_ - (variable_declarator - value: [ - (function_expression - !name - ) - (generator_function - !name - ) - (arrow_function) - ] + (_ + (variable_declarator + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) ) - ] -) @namedFunction + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! export [default] (let | const | var) foo = () => {} +(export_statement + (_ + (variable_declarator + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;; -------------------------------------------------------------------------- ;;!! (function foo() {}) -;;!! (function *foo() {}) -[ +(function_expression + name: (_) + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! (function* foo() {}) +(generator_function + name: (_) + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! foo = function() {}; +(assignment_expression (function_expression - name: (_) + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! foo = function* () {}; +(assignment_expression (generator_function - name: (_) + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) -] @namedFunction +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain -;;!! foo = function() {}; -;;!! foo = function *() {}; ;;!! foo = () => {}; (assignment_expression - right: [ - (function_expression - !name - ) - (generator_function - !name - ) - (arrow_function) - ] -) @namedFunction + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! { foo: function() {} } +(pair + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! { foo: *() {} } +(pair + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain + +;;!! { foo: () => {} } +(pair + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain ;;!! { foo: function() {} } ;;!! { foo: *() {} } @@ -154,10 +457,9 @@ ) (arrow_function) ] @name.trailing.startOf -) @namedFunction @name.domain +) @name.domain ;;!! class Foo { @bar foo() {} } -;;! ^^^^^^^^^^^^^ ( (decorator)? @namedFunction.start @statement.start @name.domain.start . @@ -166,6 +468,20 @@ ) @namedFunction.end @statement.end @name.domain.end ) +;;!! class Foo { @bar foo() {} } +( + (decorator)? @argumentList.domain.start @argumentOrParameter.iteration.domain.start + . + (method_definition + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @argumentList.domain.end @argumentOrParameter.iteration.domain.end +) + ( (program) @namedFunction.iteration (#document-range! @namedFunction.iteration) diff --git a/queries/javascript.scm b/queries/javascript.scm index 08c1cda195..857c6c8b4a 100644 --- a/queries/javascript.scm +++ b/queries/javascript.scm @@ -6,14 +6,62 @@ ;; Define this here because the `field_definition` node type doesn't exist ;; in typescript. + +;;!! class Foo { bar = function () {}; } +( + (field_definition + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) @argumentList.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @argumentList.domain.end @argumentOrParameter.iteration.domain.end +) + +;;!! class Foo { bar = function* () {}; } +( + (field_definition + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) @argumentList.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @argumentList.domain.end @argumentOrParameter.iteration.domain.end +) + +;;!! class Foo { bar = () => {}; } +( + (field_definition + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) + ) @argumentList.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @argumentList.domain.end @argumentOrParameter.iteration.domain.end +) + (_ ;;!! class Foo { - ;;!! foo = () => {}; - ;;! ^^^^^^^^^^^^^^^ - ;;!! foo = function() {}; - ;;! ^^^^^^^^^^^^^^^^^^^^ - ;;!! foo = function *() {}; - ;;! ^^^^^^^^^^^^^^^^^^^^^^ + ;;!! bar = function() {}; + ;;!! bar = function* () {}; + ;;!! bar = () => {}; ;;!! } (field_definition value: [ diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index e58003a4b1..d918bcbf3c 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -78,56 +78,112 @@ ) ) @_.domain +;; Define these here because these node types don't exist in javascript. + +;;!! function foo(); ( - ;;!! function foo(); - ;;! ^^^^^^^^^^^^^^^ - (function_signature) @namedFunction + (function_signature + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain (#not-parent-type? @namedFunction export_statement) ) +;;!! export function foo(); (export_statement - (function_signature) -) @namedFunction + (function_signature + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) +) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain -;; Define these here because these node types don't exist in javascript. +;;!! class Foo { foo(): void; } +;;!! interface Foo { foo(): void; } (_ - [ - ;;!! class Foo { foo() {} } - ;;! ^^^^^^^^ - ;;!! interface Foo { foo(): void; } - ;;! ^^^^^^^^^^^^ - (method_signature - name: (_) @name + (method_signature + name: (_) @name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end +) + +;;!! class Foo { abstract foo(): void; } +(class_body + (abstract_method_signature + name: (_) @name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end +) + +;;!! class Foo { public foo = function () {}; } +(class_body + (public_field_definition + (function_expression + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end +) - ;;!! class Foo { abstract foo(): void; } - ;;! ^^^^^^^^^^^^^^^^^^^^^ - (abstract_method_signature - name: (_) @name +;;!! class Foo { public foo = function* () {}; } +(class_body + (public_field_definition + (generator_function + !name + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + . + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end +) - ;;!! class Foo { - ;;!! (public | private | protected) foo = () => {}; - ;;! ^^^^^^^^^^^^^^^ - ;;!! (public | private | protected) foo = function() {}; - ;;! ^^^^^^^^^^^^^^^^^^^^ - ;;!! (public | private | protected) foo = function *() {}; - ;;! ^^^^^^^^^^^^^^^^^^^^^^ - ;;!! } - (public_field_definition - value: [ - (function_expression - !name - ) - (generator_function - !name - ) - (arrow_function) - ] +;;!! class Foo { public foo = () => {}; } +(class_body + (public_field_definition + (arrow_function + (formal_parameters + "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf + ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf + ) @argumentList + (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") + (#child-range! @argumentList 1 -2) ) - ] @namedFunction.start @name.domain.start + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @name.domain.end + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end ) (_ From 1b163679d6d2fba5804f3fe694c3d091e6b8d2cd Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 13:03:19 +0100 Subject: [PATCH 2/6] Clean up --- queries/javascript.function.scm | 126 ++++++++++++++------------------ 1 file changed, 54 insertions(+), 72 deletions(-) diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index f686519e0e..bc6b99c5d2 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -138,27 +138,9 @@ (#not-parent-type? @namedFunction export_statement) ) -;;!! (let | const) foo = () => {} -( - (lexical_declaration - (variable_declarator - (function_expression - !name - (formal_parameters - "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf - ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf - ) @argumentList - (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") - (#child-range! @argumentList 1 -2) - ) - ) - ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain - (#not-parent-type? @namedFunction export_statement) -) - ;;!! (let | const) foo = function () {} ( - (lexical_declaration + (_ (variable_declarator (function_expression !name @@ -176,7 +158,7 @@ ;;!! (let | const) foo = function* () {} ( - (lexical_declaration + (_ (variable_declarator (generator_function !name @@ -194,7 +176,7 @@ ;;!! (let | const) foo = () => {} ( - (lexical_declaration + (_ (variable_declarator (arrow_function (formal_parameters @@ -213,57 +195,57 @@ ;; of https://github.com/tree-sitter/tree-sitter/issues/1442#issuecomment-1584628651 ;;!! var foo = function () {} -( - (variable_declaration - (variable_declarator - (function_expression - !name - (formal_parameters - "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf - ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf - ) @argumentList - (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") - (#child-range! @argumentList 1 -2) - ) - ) - ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain - (#not-parent-type? @namedFunction export_statement) -) - -;;!! var foo = function* () {} -( - (variable_declaration - (variable_declarator - (generator_function - !name - (formal_parameters - "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf - ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf - ) @argumentList - (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") - (#child-range! @argumentList 1 -2) - ) - ) - ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain - (#not-parent-type? @namedFunction export_statement) -) - -;;!! var foo = () => {} -( - (variable_declaration - (variable_declarator - (arrow_function - (formal_parameters - "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf - ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf - ) @argumentList - (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") - (#child-range! @argumentList 1 -2) - ) - ) - ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain - (#not-parent-type? @namedFunction export_statement) -) +;; ( +;; (variable_declaration +;; (variable_declarator +;; (function_expression +;; !name +;; (formal_parameters +;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf +;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf +;; ) @argumentList +;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") +;; (#child-range! @argumentList 1 -2) +;; ) +;; ) +;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain +;; (#not-parent-type? @namedFunction export_statement) +;; ) + +;; ;;!! var foo = function* () {} +;; ( +;; (variable_declaration +;; (variable_declarator +;; (generator_function +;; !name +;; (formal_parameters +;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf +;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf +;; ) @argumentList +;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") +;; (#child-range! @argumentList 1 -2) +;; ) +;; ) +;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain +;; (#not-parent-type? @namedFunction export_statement) +;; ) + +;; ;;!! var foo = () => {} +;; ( +;; (variable_declaration +;; (variable_declarator +;; (arrow_function +;; (formal_parameters +;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf +;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf +;; ) @argumentList +;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") +;; (#child-range! @argumentList 1 -2) +;; ) +;; ) +;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain +;; (#not-parent-type? @namedFunction export_statement) +;; ) ;; -------------------------------------------------------------------------- From a1eeb59b2ef34fa24cc4faba8238f13e92af6f70 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 13:04:06 +0100 Subject: [PATCH 3/6] More cleanup --- queries/javascript.function.scm | 62 ++------------------------------- 1 file changed, 3 insertions(+), 59 deletions(-) diff --git a/queries/javascript.function.scm b/queries/javascript.function.scm index bc6b99c5d2..951d90f247 100644 --- a/queries/javascript.function.scm +++ b/queries/javascript.function.scm @@ -138,7 +138,7 @@ (#not-parent-type? @namedFunction export_statement) ) -;;!! (let | const) foo = function () {} +;;!! (let | const | var) foo = function () {} ( (_ (variable_declarator @@ -156,7 +156,7 @@ (#not-parent-type? @namedFunction export_statement) ) -;;!! (let | const) foo = function* () {} +;;!! (let | const | var) foo = function* () {} ( (_ (variable_declarator @@ -174,7 +174,7 @@ (#not-parent-type? @namedFunction export_statement) ) -;;!! (let | const) foo = () => {} +;;!! (let | const | var) foo = () => {} ( (_ (variable_declarator @@ -191,62 +191,6 @@ (#not-parent-type? @namedFunction export_statement) ) -;; Note that we can't merge this with the variable declaration above because -;; of https://github.com/tree-sitter/tree-sitter/issues/1442#issuecomment-1584628651 - -;;!! var foo = function () {} -;; ( -;; (variable_declaration -;; (variable_declarator -;; (function_expression -;; !name -;; (formal_parameters -;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf -;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf -;; ) @argumentList -;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") -;; (#child-range! @argumentList 1 -2) -;; ) -;; ) -;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain -;; (#not-parent-type? @namedFunction export_statement) -;; ) - -;; ;;!! var foo = function* () {} -;; ( -;; (variable_declaration -;; (variable_declarator -;; (generator_function -;; !name -;; (formal_parameters -;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf -;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf -;; ) @argumentList -;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") -;; (#child-range! @argumentList 1 -2) -;; ) -;; ) -;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain -;; (#not-parent-type? @namedFunction export_statement) -;; ) - -;; ;;!! var foo = () => {} -;; ( -;; (variable_declaration -;; (variable_declarator -;; (arrow_function -;; (formal_parameters -;; "(" @argumentList.removal.start.endOf @argumentOrParameter.iteration.start.endOf -;; ")" @argumentList.removal.end.startOf @argumentOrParameter.iteration.end.startOf -;; ) @argumentList -;; (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") -;; (#child-range! @argumentList 1 -2) -;; ) -;; ) -;; ) @namedFunction @argumentList.domain @argumentOrParameter.iteration.domain -;; (#not-parent-type? @namedFunction export_statement) -;; ) - ;; -------------------------------------------------------------------------- ;; Exported named functions From 81bb28c0a3692dfae877ccb12dbd049d03d1794a Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 13:09:26 +0100 Subject: [PATCH 4/6] More cleanup --- queries/typescript.core.scm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index d918bcbf3c..34365b7f14 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -116,9 +116,9 @@ ) @argumentList (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) - ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { abstract foo(): void; } @@ -131,9 +131,9 @@ ) @argumentList (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) - ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { public foo = function () {}; } @@ -148,9 +148,9 @@ (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) ) - ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { public foo = function* () {}; } @@ -165,9 +165,9 @@ (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) ) - ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { public foo = () => {}; } @@ -181,9 +181,9 @@ (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) ) - ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end ) (_ From 5e20ee4e6495b688233eb9f26b261fc8209eda47 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 13:28:48 +0100 Subject: [PATCH 5/6] Small fix --- queries/typescript.core.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 34365b7f14..c07fb24af0 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -116,9 +116,9 @@ ) @argumentList (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) - ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { abstract foo(): void; } @@ -131,9 +131,9 @@ ) @argumentList (#empty-single-multi-delimiter! @argumentList @argumentList "" ", " ",\n") (#child-range! @argumentList 1 -2) - ) @namedFunction.start @argumentList.domain.start @argumentOrParameter.iteration.domain.start + ) @namedFunction.start @_.domain.start @argumentOrParameter.iteration.domain.start . - ";"? @namedFunction.end @argumentList.domain.end @argumentOrParameter.iteration.domain.end + ";"? @namedFunction.end @_.domain.end @argumentOrParameter.iteration.domain.end ) ;;!! class Foo { public foo = function () {}; } From 68e144e0c210667e7b7f6a737949e07440ec731f Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 21 Dec 2025 15:39:37 +0100 Subject: [PATCH 6/6] Added argument iteration scope tests --- .../argument/argument.formal.iteration10.scope | 10 ++++++++++ .../argument/argument.formal.iteration11.scope | 10 ++++++++++ .../argument/argument.formal.iteration12.scope | 10 ++++++++++ .../argument/argument.formal.iteration13.scope | 10 ++++++++++ .../argument/argument.formal.iteration14.scope | 10 ++++++++++ .../argument/argument.formal.iteration15.scope | 10 ++++++++++ .../argument/argument.formal.iteration2.scope | 10 ++++++++++ .../argument/argument.formal.iteration3.scope | 10 ++++++++++ .../argument/argument.formal.iteration4.scope | 10 ++++++++++ .../argument/argument.formal.iteration5.scope | 10 ++++++++++ .../argument/argument.formal.iteration6.scope | 10 ++++++++++ .../argument/argument.formal.iteration7.scope | 10 ++++++++++ .../argument/argument.formal.iteration8.scope | 10 ++++++++++ .../argument/argument.formal.iteration9.scope | 10 ++++++++++ .../argument.formal.method.iteration2.scope | 15 +++++++++++++++ .../argument.formal.method.iteration3.scope | 12 ++++++++++++ .../argument.formal.method.iteration4.scope | 15 +++++++++++++++ .../argument.formal.method.iteration5.scope | 12 ++++++++++++ .../argument.formal.method.iteration6.scope | 12 ++++++++++++ .../argument.formal.method.iteration7.scope | 12 ++++++++++++ .../argument.formal.method.iteration8.scope | 12 ++++++++++++ .../argument.formal.constructor.iteration.scope | 12 ++++++++++++ 22 files changed, 242 insertions(+) create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration10.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration11.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration12.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration13.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration14.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration15.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration2.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration3.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration4.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration5.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration6.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration7.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration8.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.iteration9.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration2.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration3.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration4.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration5.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration6.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration7.scope create mode 100644 data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration8.scope create mode 100644 data/fixtures/scopes/typescript.core/argument.formal.constructor.iteration.scope diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration10.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration10.scope new file mode 100644 index 0000000000..f5416d4429 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration10.scope @@ -0,0 +1,10 @@ +export const foo = (aaa, bbb) => {}; +--- + +[Content] = 0:20-0:28 + >--------< +0| export const foo = (aaa, bbb) => {}; + +[Domain] = 0:0-0:36 + >------------------------------------< +0| export const foo = (aaa, bbb) => {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration11.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration11.scope new file mode 100644 index 0000000000..e33f101917 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration11.scope @@ -0,0 +1,10 @@ +export default function(aaa, bbb) {} +--- + +[Content] = 0:24-0:32 + >--------< +0| export default function(aaa, bbb) {} + +[Domain] = 0:0-0:36 + >------------------------------------< +0| export default function(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration12.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration12.scope new file mode 100644 index 0000000000..1f7481c8f4 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration12.scope @@ -0,0 +1,10 @@ +export default function *(aaa, bbb) {} +--- + +[Content] = 0:26-0:34 + >--------< +0| export default function *(aaa, bbb) {} + +[Domain] = 0:0-0:38 + >--------------------------------------< +0| export default function *(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration13.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration13.scope new file mode 100644 index 0000000000..1d593a984f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration13.scope @@ -0,0 +1,10 @@ +export default (aaa, bbb) => {}; +--- + +[Content] = 0:16-0:24 + >--------< +0| export default (aaa, bbb) => {}; + +[Domain] = 0:0-0:32 + >--------------------------------< +0| export default (aaa, bbb) => {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration14.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration14.scope new file mode 100644 index 0000000000..158e9f365c --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration14.scope @@ -0,0 +1,10 @@ +const foo = function bar(aaa, bbb) {}; +--- + +[Content] = 0:25-0:33 + >--------< +0| const foo = function bar(aaa, bbb) {}; + +[Domain] = 0:12-0:37 + >-------------------------< +0| const foo = function bar(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration15.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration15.scope new file mode 100644 index 0000000000..41543abd38 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration15.scope @@ -0,0 +1,10 @@ +const foo = function *bar(aaa, bbb) {}; +--- + +[Content] = 0:26-0:34 + >--------< +0| const foo = function *bar(aaa, bbb) {}; + +[Domain] = 0:12-0:38 + >--------------------------< +0| const foo = function *bar(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration2.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration2.scope new file mode 100644 index 0000000000..484d5a6295 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration2.scope @@ -0,0 +1,10 @@ +function *foo(aaa, bbb) {} +--- + +[Content] = 0:14-0:22 + >--------< +0| function *foo(aaa, bbb) {} + +[Domain] = 0:0-0:26 + >--------------------------< +0| function *foo(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration3.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration3.scope new file mode 100644 index 0000000000..cd757c32fc --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration3.scope @@ -0,0 +1,10 @@ +const foo = function(aaa, bbb) {}; +--- + +[Content] = 0:21-0:29 + >--------< +0| const foo = function(aaa, bbb) {}; + +[Domain] = 0:0-0:34 + >----------------------------------< +0| const foo = function(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration4.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration4.scope new file mode 100644 index 0000000000..c844653315 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration4.scope @@ -0,0 +1,10 @@ +const foo = function *(aaa, bbb) {}; +--- + +[Content] = 0:23-0:31 + >--------< +0| const foo = function *(aaa, bbb) {}; + +[Domain] = 0:0-0:36 + >------------------------------------< +0| const foo = function *(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration5.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration5.scope new file mode 100644 index 0000000000..e21e32c838 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration5.scope @@ -0,0 +1,10 @@ +const foo = (aaa, bbb) => {}; +--- + +[Content] = 0:13-0:21 + >--------< +0| const foo = (aaa, bbb) => {}; + +[Domain] = 0:0-0:29 + >-----------------------------< +0| const foo = (aaa, bbb) => {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration6.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration6.scope new file mode 100644 index 0000000000..c76fc9608f --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration6.scope @@ -0,0 +1,10 @@ +export function foo(aaa, bbb) {} +--- + +[Content] = 0:20-0:28 + >--------< +0| export function foo(aaa, bbb) {} + +[Domain] = 0:0-0:32 + >--------------------------------< +0| export function foo(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration7.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration7.scope new file mode 100644 index 0000000000..9372e4d22a --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration7.scope @@ -0,0 +1,10 @@ +export function *foo(aaa, bbb) {} +--- + +[Content] = 0:21-0:29 + >--------< +0| export function *foo(aaa, bbb) {} + +[Domain] = 0:0-0:33 + >---------------------------------< +0| export function *foo(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration8.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration8.scope new file mode 100644 index 0000000000..bd6a12f139 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration8.scope @@ -0,0 +1,10 @@ +export const foo = function(aaa, bbb) {}; +--- + +[Content] = 0:28-0:36 + >--------< +0| export const foo = function(aaa, bbb) {}; + +[Domain] = 0:0-0:41 + >-----------------------------------------< +0| export const foo = function(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration9.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration9.scope new file mode 100644 index 0000000000..d37d27180d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.iteration9.scope @@ -0,0 +1,10 @@ +export const foo = function *(aaa, bbb) {}; +--- + +[Content] = 0:30-0:38 + >--------< +0| export const foo = function *(aaa, bbb) {}; + +[Domain] = 0:0-0:43 + >-------------------------------------------< +0| export const foo = function *(aaa, bbb) {}; diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration2.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration2.scope new file mode 100644 index 0000000000..b201c9bfcc --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration2.scope @@ -0,0 +1,15 @@ +class Foo { + @baz + bar(aaa, bbb) {} +} +--- + +[Content] = 2:8-2:16 + >--------< +2| bar(aaa, bbb) {} + +[Domain] = 1:4-2:20 + >---- +1| @baz +2| bar(aaa, bbb) {} + --------------------< diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration3.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration3.scope new file mode 100644 index 0000000000..0955acedb1 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration3.scope @@ -0,0 +1,12 @@ +class Foo { + bar = (aaa, bbb) => {} +} +--- + +[Content] = 1:11-1:19 + >--------< +1| bar = (aaa, bbb) => {} + +[Domain] = 1:4-1:26 + >----------------------< +1| bar = (aaa, bbb) => {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration4.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration4.scope new file mode 100644 index 0000000000..fb6944fe96 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration4.scope @@ -0,0 +1,15 @@ +class Foo { + @baz + bar = (aaa, bbb) => {} +} +--- + +[Content] = 2:11-2:19 + >--------< +2| bar = (aaa, bbb) => {} + +[Domain] = 1:4-2:26 + >---- +1| @baz +2| bar = (aaa, bbb) => {} + --------------------------< diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration5.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration5.scope new file mode 100644 index 0000000000..86fe4c59be --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration5.scope @@ -0,0 +1,12 @@ +const foo = { + bar(aaa, bbb) {} +} +--- + +[Content] = 1:8-1:16 + >--------< +1| bar(aaa, bbb) {} + +[Domain] = 1:4-1:20 + >----------------< +1| bar(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration6.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration6.scope new file mode 100644 index 0000000000..7e7bd0c15d --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration6.scope @@ -0,0 +1,12 @@ +const foo = { + bar: function(aaa, bbb) {} +} +--- + +[Content] = 1:18-1:26 + >--------< +1| bar: function(aaa, bbb) {} + +[Domain] = 1:4-1:30 + >--------------------------< +1| bar: function(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration7.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration7.scope new file mode 100644 index 0000000000..1362243d1b --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration7.scope @@ -0,0 +1,12 @@ +const foo = { + bar: function *(aaa, bbb) {} +} +--- + +[Content] = 1:20-1:28 + >--------< +1| bar: function *(aaa, bbb) {} + +[Domain] = 1:4-1:32 + >----------------------------< +1| bar: function *(aaa, bbb) {} diff --git a/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration8.scope b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration8.scope new file mode 100644 index 0000000000..f5760e92c0 --- /dev/null +++ b/data/fixtures/scopes/javascript.core/argument/argument.formal.method.iteration8.scope @@ -0,0 +1,12 @@ +const foo = { + bar: (aaa, bbb) => {} +} +--- + +[Content] = 1:10-1:18 + >--------< +1| bar: (aaa, bbb) => {} + +[Domain] = 1:4-1:25 + >---------------------< +1| bar: (aaa, bbb) => {} diff --git a/data/fixtures/scopes/typescript.core/argument.formal.constructor.iteration.scope b/data/fixtures/scopes/typescript.core/argument.formal.constructor.iteration.scope new file mode 100644 index 0000000000..2496fe0b60 --- /dev/null +++ b/data/fixtures/scopes/typescript.core/argument.formal.constructor.iteration.scope @@ -0,0 +1,12 @@ +class Foo { + constructor(aaa: number); +} +--- + +[Content] = 1:16-1:27 + >-----------< +1| constructor(aaa: number); + +[Domain] = 1:4-1:29 + >-------------------------< +1| constructor(aaa: number);