Skip to content

Commit 8fe4aec

Browse files
committed
Redo binding types
1 parent 86da1af commit 8fe4aec

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/scopes.d.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,25 +80,30 @@ export interface GeneratedRange {
8080
/**
8181
* Expressions that compute the values of the variables of this OriginalScope. The length
8282
* of `values` matches the length of `originalScope.variables`.
83-
*
84-
* For each variable this can either be a single expression (valid for the full `GeneratedRange`),
85-
* or an array of `BindingRange`s, e.g. if computing the value requires different expressions
86-
* throughout the range or if the variable is only available in parts of the `GeneratedRange`.
87-
*
88-
* When a value uses `BindingRange[]`, then the "from" of the first `BindingRange` and the
89-
* "to" of the last `BindingRange` are equal to the GeneratedRange's "start" and "end" position
90-
* respectively.
91-
*
92-
* `undefined` denotes that the value of a variable is unavailable in the whole range.
93-
* This can happen e.g. if the variable was optimized out and can't be recomputed.
9483
*/
95-
values: (string | undefined | BindingRange[])[];
84+
values: Binding[];
9685

9786
children: GeneratedRange[];
9887
parent?: GeneratedRange;
9988
}
10089

101-
export interface BindingRange {
90+
/**
91+
* For each variable, this can either be:
92+
*
93+
* 1) A single expression (valid for a full `GeneratedRange`).
94+
*
95+
* 2) `undefined` if this variable is unavailable in the whole range. This can
96+
* happen e.g. when the variable was optimized out and can't be recomputed.
97+
*
98+
* 3) A list of `SubRangeBinding`s. Used when computing the value requires different
99+
* expressions throughout the `GeneratedRange` or if the variable is unavailable in
100+
* parts of the `GeneratedRange`.
101+
* The "from" of the first `SubRangeBinding` and the "to" of the last `SubRangeBinding`
102+
* are qual to the `GeneratedRange`s "start" and "end" position respectively.
103+
*/
104+
export type Binding = string | undefined | SubRangeBinding[];
105+
106+
export interface SubRangeBinding {
102107
value?: string;
103108
from: Position;
104109
to: Position;

0 commit comments

Comments
 (0)