This CL changes the scope source map variable resolving mechanism
to use the full scope tree of the underlying compiled script.
Currently we look for the surrounding function scope and try to turn
it into a valid script that Acorn understands.
This can fail in some instances. E.g. if we pause in
a class method that uses private fields, then Acorn expects a
surrounding class scope that actually declares these private fields.
Using the full scope tree fixes this issue. It also prevents
unnecessary re-parses since we cache the full scope tree for each
script. Currently we only cache based on call frames. This means
we currently re-parse for each pause during stepping.
Moreover, the full scope tree is a pre-requisite for source mapped
variables in breakpoint conditions.
R=jarin@chormium.org
Bug: 1457874
Change-Id: I4e1e3de47920db6c72cebd4c2ff3fd988461b6c1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4650348
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
This CL adds cache for scope trees keyed on scripts. We use
SDK.Script for the key, which boils down to model + script ID.
The cache is necessary since we want to switch over to use the full
scope tree of scripts, and not just parse single functions.
A follow-up CL will hook the cache up to NameResolver.ts.
Bug: 1457874
Change-Id: If79ff59f2cd1fdbce8b7a6a048a9e5ef876583b8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4647594
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>