Commit Graph
16 Commits
Author SHA1 Message Date
Simon Zünd 05ebec3eb9 [test] Use options bag for OriginalScopeBuilder
... and add a test for decoding OriginalScope.isStackFrame.

R=leese@chromium.org

Fixed: 378854966
Change-Id: I50ae8f57cb1324cbe61fc084701eb7f6414e3e68
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6023038
Reviewed-by: Eric Leese <leese@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-11-15 12:11:32 +00:00
Simon Zünd 149f6decb6 [sdk] Align Scopes proposal flags with latest draft
This CL aligns the DevTools prototype with the rest of the changes
in https://github.com/tc39/source-map/pull/147. In particular:

  - Rename GeneratedRange.isFunctionScope to isStackFrame
  - Add OriginalScope.isStackFrame
  - Add GeneratedRanged.isHidden

Tests for OriginalScope.isStackFrame will be added in a follow-up
since we'll also change the scopes builder.

R=leese@chromium.org

Bug: 378854966
Change-Id: If800136b4cd5c5303b7ad5de614110e1fc6275f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6022848
Reviewed-by: Eric Leese <leese@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-11-15 11:53:29 +00:00
Simon Zünd 2a98b7c382 [sdk] Make OriginalScope.kind optional
The https://github.com/tc39/source-map/pull/147 PR to the "Scopes"
proposal made "kind" optional. This CL implements the proposal
change in the DevTools implementation.

R=leese@chromium.org

Bug: 378854966
Change-Id: I3dd06ac3171ae4882ec43bb673feaaf9bc7dbd63
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6022847
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Eric Leese <leese@chromium.org>
2024-11-15 10:57:11 +00:00
Simon Zünd 523ce9b925 [scopes] Rename isScope to isFunctionScope
This CL aligns DevTools with an in-flight (but approved) spec PR:
https://github.com/tc39/source-map/pull/114. We need the flag to
properly hide stack frames from stack traces that got inserted
by transpilers and don't have a corresponding function in authored
code.

The flag also helps when dealing with inlining.

R=kimanh@chromium.org

Bug: 40277685
Change-Id: Iafef35e6ccdb0acf56b2fa91aafbdb44f03c6bce
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5836934
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2024-09-06 04:35:15 +00:00
Benedikt Meurer b7d85047a3 [eslint] Migrate front_end/core/ to CONSTANT_CASE enum values.
Note that this only migrates the code, but doesn't yet change the
ESLint configuration, since other folders are still pending.

Bug: 361720369
Change-Id: Ia248c58a67680ff2ed8f81af0e0c04d6b6de1c7c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5807576
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2024-08-23 14:18:27 +00:00
Simon Zünd f01aee2eb9 [scopes] Replace original scope kind with index into 'names' array
The spec PR https://github.com/tc39/source-map/pull/107 changed the
original scope kind to be an index into the names array given that
'global', 'function', etc. might not be applicable to every authored
language.

This CL aligns the DevTools implementation with the latest spec.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: Id4b9915aaab6138fbf2dae5eaf48c6e52b999b40
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5724710
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-07-22 06:43:56 +00:00
Simon Zünd 600d74b0a4 Make scope/range builder easier to use
This CL changes the test helpers that encode the source map scopes
proposal. Rathern than passing indices into the "names" array, we now
pass the "names" array to the builder constructor and the builders
handle resolving indices internally themselves.

This makes builder code slightly more readable for original scope
names, original variable names and binding expressions.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: I810dd81b22c4223d4585a7ca3c8db48160b1b52c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5713234
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2024-07-17 07:53:44 +00:00
Simon Zünd a61ae8246a [sdk] Always decode original variable names
The PR https://github.com/tc39/source-map/pull/68 removed the
'has variables' flag. This CL aligns the DevTools decoding logic with
that PR.

R=kimanh@chromium.org

Bug: 40277685
Change-Id: Ifad7190fab3bea017362249e92393f99fa887c07
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5661140
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-07-01 08:34:06 +00:00
Simon Zünd 001fd366e1 [sdk] Update 'bindings' decoding to mirror latest spec text
The PR https://github.com/tc39/source-map/pull/106 changes the
'bindings' encoding of the "Scopes" proposal to encode the number of
sub-ranges first. This way, we don't have to look ahead in the VLQ
stream to decode bindings.

This CL aligns the DevTools implementation with the PR.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: Ice70c87b4176cfbe23a401b2b336fab144ca99ff
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5660062
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-06-27 08:54:15 +00:00
Simon Zünd a3eace8a2e [sdk] Decode 'isScope' flag for generated ranges
The flag was added a while ago to the "Scopes" proposal with the
PR https://github.com/tc39/source-map/pull/69.

We need in DevTools to figure out inlined function scopes.

R=kimanh@chromium.org

Bug: 40277685
Change-Id: I5d25fa2d235256f965bef9d54944876018e44b90
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5639705
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2024-06-19 09:18:29 +00:00
Simon Zünd 25dbec176b [sdk] Decode bindings for 'Scopes' source map proposal
This CL adds the last, and arguably most complicated bit, of the
"Scopes" proposal: bindings. Bindings encode what expression to use
to produce the value of a variable in a given generated range.

Since the expression might not be the same throughout the whole range,
the encoding allows for sub-ranges. This means that a binding for a
given variable could either be a single expression or a list of
sub-ranges with each sub-range having their own expression.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: I879caed0ecf8bc377b600357ffd98989650ebb34
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5598789
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-06-10 11:45:29 +00:00
Simon Zünd d129e908a8 [sdk] Implement inlined callsite decoding for the scopes proposal
R=pfaffe@chromium.org

Bug: 40277685
Change-Id: I2dd9ce55248d03b5eaa199725c1438673449160a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5593773
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-06-04 10:32:27 +00:00
Simon Zünd e5cc9b622d [sdk] Implement decoding of original scope references
This CL adds decoding of "definitions" of generated ranges. A
definition is a source file index plus a scope index where the
scope index references the index of the corresponding "start" item.

For now, we flatten out the resulting scope tree manually and insert
'null' for end items. If this becomes performance critical we can
construct an array or a map (index -> OriginalScope) as
we decode the original scopes themselves.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: I5a86c1fdfc7af330fce3d37f2854c9fa734aac78
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5554234
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-05-24 08:52:04 +00:00
Simon Zünd 58cd41ee05 [sdk] Implement decoding of line/column for generated scopes
This CL implements basic decoding of generated range start/end item.
Currently missing are the additional fields encoded in start items,
namely definition (the corresponding original scope), call site (for
inlining) and binding information.

We'll implement those in follow-up CLs. To keep CLs reasonable.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: Ia6daa1e0248beadb22bd2e71714fb33d5ff80552
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5349141
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-05-22 09:18:36 +00:00
Simon Zünd 3c1aa667cf [sdk] Align source map scopes decoding with latest spec version
The proposal PR https://github.com/tc39/source-map/pull/68 removed the
'length' from variables/bindings since it's not strictly necessary.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: Id06a0b34f60c9ee3e343f0aa312bce719ba2d68a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5557001
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2024-05-22 07:39:30 +00:00
Benedikt Meurer d1f04bfb0f [test] Also move test helpers from test/unittests/.
This moves the helpers to `testing/` subdirectories, consistent with the
TS/JS Style Guide[^1].

[^1]: http://go/tsjs-style#test-file-names

DISABLE_THIRD_PARTY_CHECK=Moving unit tests.

Bug: 325903709
Change-Id: I5b82c1b00f724776e06f1675eae9c19ff1b4ba7c
Doc: http://go/chrome-devtools:move-unit-tests-design
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5317645
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2024-02-26 15:55:38 +00:00