You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/scopes.md
+6-9
Original file line number
Diff line number
Diff line change
@@ -293,10 +293,10 @@ To reduce the number of bytes required to encode the "scopes" information, we us
293
293
*`sKIND` in `original_scope_start` is relative to the previous occurrence of `sKIND` (or absolute for the first).
294
294
*`uLINE` in `original_scope_start` and `original_scope_end` are relative to the previous occurrence (or absolute for the first).
295
295
This means a `uLINE` of a `original_scope_start` is relative to either its parents' start line or its preceding siblings' end line.
296
+
*`uCOLUMN` in `original_scope_start` and `original_scope_end` are relative to the previous occurrence if (and only if) the `uLINE` of this item is 0. That is, columns are encoded relative to each other if the pervious `original_scope_*` item is on the same line, absolute otherwise.
296
297
*`sVARIABLE` in `original_scope_variables` is relative to the previous occurrence of `sVARIABLE` (or absolute for the first).
297
298
298
-
Each top-level `original_scope_tree` resets the "relative state". That is, each top-level `original_scope_tree` is decoded as if its the first.
299
-
299
+
Each top-level `original_scope_tree` resets the "relative state" of `uLINE` and `uCOLUMN`. That is, each top-level `original_scope_start` decodes `uLINE` and `uCOLUMN` as if the previous occurrence was (0, 0). In contrast, `sNAME`, `sKIND` and `sVARIABLE` are relative to each other even across top-level `original_scope_tree`s.
300
300
301
301
#### Generated Range Trees
302
302
@@ -352,16 +352,13 @@ be found with the pseudo code `const scopeStart = scopes.filter(item => item.tag
352
352
```
353
353
generated_range_callsite :=
354
354
'I' // Tag: 0x8 unsigned
355
-
sSOURCE_IDX
356
-
sLINE
357
-
sCOLUMN
355
+
uSOURCE_IDX
356
+
uLINE
357
+
uCOLUMN
358
358
```
359
359
360
360
If a "generated range" contains a callsite, then the range describes an inlined function body. The inlined function was called at the original position described by this `generated_range_callsite`.
361
-
362
-
*`sSOURCE_IDX` in `generated_range_callsite` is relative to the previous occurrence (or absolute for the first).
363
-
*`sLINE` in `generated_range_callsite` is relative to the previous occurrence, if the previous `generated_range_callsite` was in the same source file. Absolute otherwise.
364
-
*`SCOLUMN` in `generated_range_callsite` is relative to the previous occurrence, if the previous `generated_range_callsite` was on the same line in the same file. Absolute otherwise.
361
+
`uSOURCE_IDX`, `uLINE` and `uCOLUMN` of the `generated_range_callsite` are always encoded absolute.
0 commit comments