Description
Today, the parse tree code can takeover "item" if it wants, but can't just indicate to ItemStage
the iteration scope and let it do the rest. We'd like to enable that behaviour, so we can have uniformity of implementation of "item"
while still supporting cases where there is no surrounding pair, eg the items foo
and bar
in var foo, bar = ...
.
Approach
It will be a cascading scope type (#1045) combining the following:
One of the constituent scope types will be just be surrounding pair, but where we ask pair for inside
before returning it in getTarget()
; domain is just the surrounding pair
The other constituent scope type is a tree-sitter syntactic scope handler with a tree-sitter pattern that languages can define however they want. For example, Typescript could define it to be foo, bar
in var foo, bar = ...
See also #1046, as this approach is very similar