When parsing the parameter list of an arrow function that is nested
inside an outer arrow function, the inner arrow function's
DeclarationScope does not exist yet, so `scope()->GetClosureScope()`
returns the outer arrow function's scope (`closure_scope !=
receiver_scope`).
Previously, `ParserBase::UseThis()` only called
`expression_scope()->RecordThisUse()` when `closure_scope ==
receiver_scope`. As a result, referencing `this` in a default parameter
of a nested arrow function failed to mark the inner
`ArrowHeadParsingScope` as using `this`, leaving `has_this_reference()`
false on the inner arrow function's `DeclarationScope` and causing
debug-evaluate to resolve `this` to `undefined`.
Call `expression_scope()->RecordThisUse()` unconditionally in
`UseThis()` so that any enclosing `ArrowHeadParsingScope` records the
`this` reference.
TAG=agy
CONV=905f9f91-322f-467a-9f81-1f78a365b0d8
Change-Id: Ia4ab7176549719d1c8e73351cafb92069f883d03
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8553279
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110816}