Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Adds remapScopes utility function.#780

Merged
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
yurydelendik:remapScopes
Nov 6, 2017
Merged

Adds remapScopes utility function.#780
jasonLaster merged 1 commit into
firefox-devtools:masterfrom
yurydelendik:remapScopes

Conversation

@yurydelendik

Copy link
Copy Markdown
Contributor

Associated Issue: firefox-devtools/debugger#4521

Summary of Changes

  • Adds remapScopes utility function to the devtools-map-bindings package.

// Moving to the function bounary (in generated scopes).
while (
foundInMax + 1 < searchIn.length &&
searchIn[foundInMax].type !== "function"

@yurydelendik yurydelendik Nov 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runtime Scope.type property is not reliable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to fall back on block as well while we fix this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

property reliable after all

({ isLast, result }, scope) => {
if (isLast) {
result.push([]);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chunk is a pretty strange term...

I think i would prefer functionScopes, perhaps we move this into a small helper function:

const functionScopes = rollupFunctionScopes(scopes)

const names = summarizedScopes.reduce(
(acc, { bindingsNames }) => acc.concat(bindingsNames),
[]
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have a small helper function: getBindingNames that can take our function scopes and return a list of names...

const names = getBindingNames(scopeChunk)

// Moving to the function bounary (in generated scopes).
while (
foundInMax + 1 < searchIn.length &&
searchIn[foundInMax].type !== "function"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to fall back on block as well while we fix this?

}

// We found chunk of the function(s) that matches the scopeChunk names.
result.push({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm a bit lost here

@jasonLaster jasonLaster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jasonLaster jasonLaster merged commit b2909f2 into firefox-devtools:master Nov 6, 2017
nchevobbe pushed a commit that referenced this pull request Nov 21, 2017
nchevobbe pushed a commit that referenced this pull request Nov 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants