-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scopes: Encode original scope trees and use live ranges for bindings #62
Conversation
Some initial thoughts:
Agreed. |
Thanks for the feedback :)
I forgot to spell this out explicitly. But
Agreed. I came up with a similar change when I prototyped this PR in DevTools:
In Typescript terms: For the conceptual TypeScript style definition should we stick closer to the the encoding (with e.g. scope start/end markers), or rather on a higher level as proposed here? I can open a separate PR to add the .d.ts for the current proposal. |
I have updated my implementation using a scopes format similar to this PR. The main differences are:
I prefer this format over what I had implemented previously for several reasons:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge this PR to clarify that this is the current state of the scopes proposal. Details can be discussed in follow-up PRs.
|
||
interface BindingRange { | ||
from: GeneratedPosition; | ||
to: GeneratedPosition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any definition for what the from
and to
in the BindingRange is intended to encompass, clarification may be useful. "the expression for the bindings value in this range" implies but doesn't state that it's the generated range where the binding is applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eager to use this :)
Would it be sensible to rename GeneratedScope to GeneratedRange to make it more obvious that it does not refer to a lexical scope? |
This PR is intended to kick-off discussion on how to fix the spec to properly support the scenarios pointed out in here and here.
The two large changes are:
sources
entry.definition
was changed to point back to the corresponding original scope instead. This fixes the missing outer scope information for inlined function of the current proposal.The PR also proposes an additional ("conceptual") specification of the scope information. What information to include is somewhat orthogonal to how to encode it. A TypeScript definition style format should facilitate better discussion on the former.
There are also a couple of smaller changes:
isFunction
flag was removed in favor of a "scope kind". Together with aname
for non-function scopes (such as classes) would give debuggers the opportunity to build a complete scope view without having to look at anything other than the sourcemap.inherit parent bindings
is no longer necessary as binding live ranges spell this out explicitly.skip when stepping
andcollapse
is also not really necessary: If a generated scope has a corresponding original scope we should step through it and show it in a stack trace. I'm not sure if we need "per scope" decision for this outside ofignoreList
. Maybe someone has an example?Note that for
originalScopes
I opted not to group the scope items by line given that original source files are normally not minified and spelling out the line numbers might be more efficient. But encoding (as the rest) is very much up for debate.