Skip to content
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: Make the offsets into the names array absolute #83

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions proposals/scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,10 @@ Note: Each DATA represents one VLQ number.
* 0x1 has name
* name: (only exists if `has name` flag is set)
* DATA offset into `names` field
Copy link
Member

Choose a reason for hiding this comment

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

Should we clarify that these are absolute offsets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's clear enough that offsets are absolute if they're not explicitly specified to be relative. Anyway this will most likely change when we decide on #70 .

* Note: This offset is relative to the offset of the last scope name or absolute if this is the first name
* Note: This name should be shown as function name in the stack trace for function scopes.
* variables:
* for each variable:
* DATA relative offset into `names` field for the original symbol name defined in this scope
* DATA offset into `names` field for the original symbol name defined in this scope

#### End Original Scope

Expand Down Expand Up @@ -246,8 +245,9 @@ Note: Each DATA represents one VLQ number.
* Note: the number of bindings must match the number of variables in the definition scope
* for each binding:
* Let M be the number of sub-ranges for the current variable in this generated range (where the expression differs on how to obtain the current variable’s value)
* DATA relative offset into `names` field
* DATA offset into `names` field or -1
* Note: The value expression for the current variable either for the whole generated range (if M == 1), or for the sub-range that starts at the beginning of this generated range.
* Note: Use -1 to indicate that the current variable is unavailable (e.g. due to shadowing) in this range.
* If M > 1, then
* DATA negative number of sub-ranges (-M)
* (M - 1) times
Expand All @@ -256,7 +256,7 @@ Note: Each DATA represents one VLQ number.
* Note: This is the point (exclusive) in the generated code until the previous expression must be used to obtain the current variable’s value.
* Note: The line is relative to the previous sub-range line or the start of the current generated range item if it’s the first.
* Note: The column is relative to the column of the previous sub-range if it’s on the same line or absolute if it’s on a new line.
* DATA relative offset into `names` field
* DATA offset into `names` field or -1
* Note: The expression to obtain the current variable’s value in the sub-range that starts at line/column and ends at either the next sub-range start or this generated range’s end.
* Note: Use -1 to indicate that the current variable is unavailable (e.g. due to shadowing) in this sub-range.

Expand Down
Loading