@oseo/compiler 0.0.0-stage → 0.1.0-canary.368
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +59 -2
- package/dist/agent-programs.d.ts +28 -0
- package/dist/agent-programs.d.ts.map +1 -0
- package/dist/agent-programs.js +134 -0
- package/dist/agent-programs.js.map +1 -0
- package/dist/agent-templates.d.ts +33 -0
- package/dist/agent-templates.d.ts.map +1 -0
- package/dist/agent-templates.js +45 -0
- package/dist/agent-templates.js.map +1 -0
- package/dist/compile.d.ts +20 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +75 -0
- package/dist/compile.js.map +1 -0
- package/dist/fragments.d.ts +72 -0
- package/dist/fragments.d.ts.map +1 -0
- package/dist/fragments.js +158 -0
- package/dist/fragments.js.map +1 -0
- package/dist/hir-build.d.ts +80 -0
- package/dist/hir-build.d.ts.map +1 -0
- package/dist/hir-build.js +3077 -0
- package/dist/hir-build.js.map +1 -0
- package/dist/hir-print.d.ts +10 -0
- package/dist/hir-print.d.ts.map +1 -0
- package/dist/hir-print.js +271 -0
- package/dist/hir-print.js.map +1 -0
- package/dist/hir.d.ts +1246 -0
- package/dist/hir.d.ts.map +1 -0
- package/dist/hir.js +147 -0
- package/dist/hir.js.map +1 -0
- package/dist/host-scripts.d.ts +14 -0
- package/dist/host-scripts.d.ts.map +1 -0
- package/dist/host-scripts.js +204 -0
- package/dist/host-scripts.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/mir-build.d.ts +8 -0
- package/dist/mir-build.d.ts.map +1 -0
- package/dist/mir-build.js +5113 -0
- package/dist/mir-build.js.map +1 -0
- package/dist/mir-print.d.ts +7 -0
- package/dist/mir-print.d.ts.map +1 -0
- package/dist/mir-print.js +65 -0
- package/dist/mir-print.js.map +1 -0
- package/dist/mir-specialize.d.ts +7 -0
- package/dist/mir-specialize.d.ts.map +1 -0
- package/dist/mir-specialize.js +182 -0
- package/dist/mir-specialize.js.map +1 -0
- package/dist/mir.d.ts +571 -0
- package/dist/mir.d.ts.map +1 -0
- package/dist/mir.js +1 -0
- package/dist/module-builtin.d.ts +20 -0
- package/dist/module-builtin.d.ts.map +1 -0
- package/dist/module-builtin.js +57 -0
- package/dist/module-builtin.js.map +1 -0
- package/dist/module-compile.d.ts +64 -0
- package/dist/module-compile.d.ts.map +1 -0
- package/dist/module-compile.js +690 -0
- package/dist/module-compile.js.map +1 -0
- package/dist/module-json.d.ts +7 -0
- package/dist/module-json.d.ts.map +1 -0
- package/dist/module-json.js +88 -0
- package/dist/module-json.js.map +1 -0
- package/dist/modules.d.ts +87 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +734 -0
- package/dist/modules.js.map +1 -0
- package/dist/native-fragments.d.ts +36 -0
- package/dist/native-fragments.d.ts.map +1 -0
- package/dist/native-fragments.js +110 -0
- package/dist/native-fragments.js.map +1 -0
- package/dist/native.d.ts +282 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +47 -0
- package/dist/native.js.map +1 -0
- package/dist/regexp-execute.d.ts +74 -0
- package/dist/regexp-execute.d.ts.map +1 -0
- package/dist/regexp-execute.js +480 -0
- package/dist/regexp-execute.js.map +1 -0
- package/dist/regexp-matcher.d.ts +279 -0
- package/dist/regexp-matcher.d.ts.map +1 -0
- package/dist/regexp-matcher.js +1098 -0
- package/dist/regexp-matcher.js.map +1 -0
- package/dist/regexp-parse.d.ts +22 -0
- package/dist/regexp-parse.d.ts.map +1 -0
- package/dist/regexp-parse.js +1440 -0
- package/dist/regexp-parse.js.map +1 -0
- package/dist/regexp-print.d.ts +24 -0
- package/dist/regexp-print.d.ts.map +1 -0
- package/dist/regexp-print.js +147 -0
- package/dist/regexp-print.js.map +1 -0
- package/dist/regexp.d.ts +324 -0
- package/dist/regexp.d.ts.map +1 -0
- package/dist/regexp.js +22 -0
- package/dist/regexp.js.map +1 -0
- package/dist/source.d.ts +38 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +10 -0
- package/dist/source.js.map +1 -0
- package/dist/syntax.d.ts +1232 -0
- package/dist/syntax.d.ts.map +1 -0
- package/dist/syntax.js +1 -0
- package/package.json +32 -3
package/dist/hir.d.ts
ADDED
|
@@ -0,0 +1,1246 @@
|
|
|
1
|
+
import { ByteRange, Diagnostic, SourceRange } from "./source.js";
|
|
2
|
+
import { RegExpMatcherProgram } from "./regexp-matcher.js";
|
|
3
|
+
import { AssignmentOperator, BinaryOperator, BindingPatternMode, FunctionKind, Hint, LocatedSyntax, LogicalOperator, SyntaxFunction, SyntaxParameter, SyntaxThisMode, UnaryOperator } from "./syntax.js";
|
|
4
|
+
import { AgentSourceTemplate } from "./agent-templates.js";
|
|
5
|
+
//#region src/hir.d.ts
|
|
6
|
+
/** One resolved identifier leaf with explicit binding identity. */
|
|
7
|
+
interface HirBindingIdentifier extends LocatedSyntax {
|
|
8
|
+
readonly bindingId: number;
|
|
9
|
+
readonly functionNameBinding?: true;
|
|
10
|
+
readonly hints: readonly Hint[];
|
|
11
|
+
readonly importedBinding?: true;
|
|
12
|
+
readonly kind: "binding-identifier";
|
|
13
|
+
readonly mutable: boolean;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Ordered innermost-first object environments consulted before this
|
|
17
|
+
* lexical fallback when the target occurs inside `with`.
|
|
18
|
+
*/
|
|
19
|
+
readonly withObjectBindingIds?: readonly number[];
|
|
20
|
+
/**
|
|
21
|
+
* The realm global-object property an all-miss write leaf reaches
|
|
22
|
+
* instead of the lexical cell, as for a host Script's `var` or
|
|
23
|
+
* function name whose binding is that property.
|
|
24
|
+
*/
|
|
25
|
+
readonly withGlobalFallback?: HirWithGlobalObjectFallback;
|
|
26
|
+
/** Strict SetMutableBinding for a selected with object on a write leaf. */
|
|
27
|
+
readonly globalReference?: HirGlobalReference;
|
|
28
|
+
}
|
|
29
|
+
/** One lexical assignment fallback behind an ordered `with` object chain. */
|
|
30
|
+
interface HirWithBindingReference {
|
|
31
|
+
readonly bindingId: number;
|
|
32
|
+
readonly functionNameBinding?: boolean;
|
|
33
|
+
readonly importedBinding?: boolean;
|
|
34
|
+
readonly mutable: boolean;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The hidden binding name of the realm global-object capture. It cannot
|
|
39
|
+
* collide with a source name, and both HIR construction and MIR lowering
|
|
40
|
+
* spell the same identity through it.
|
|
41
|
+
*/
|
|
42
|
+
declare const intrinsicGlobalObjectName = "*intrinsic global object*";
|
|
43
|
+
/**
|
|
44
|
+
* The hidden binding name of one module's `import.meta` object. Like
|
|
45
|
+
* the global-object capture it cannot collide with a source name.
|
|
46
|
+
*/
|
|
47
|
+
declare const importMetaName = "*import.meta*";
|
|
48
|
+
/**
|
|
49
|
+
* One realm global-object property fallback behind an ordered `with`
|
|
50
|
+
* object chain. An all-miss sloppy or strict write uses this fallback.
|
|
51
|
+
* Sloppy PutValue creates or updates the property. Strict PutValue
|
|
52
|
+
* retains the initial resolution and throws for an unresolved reference
|
|
53
|
+
* or a property lost before the write. The capture and key retain the
|
|
54
|
+
* global property identity instead of storing a value in a hidden cell
|
|
55
|
+
* no later reference would observe.
|
|
56
|
+
*/
|
|
57
|
+
interface HirWithGlobalObjectFallback {
|
|
58
|
+
readonly object?: HirExpression;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
readonly objectBindingId: number;
|
|
61
|
+
/**
|
|
62
|
+
* The GetValue a compound, logical, or update write performs first:
|
|
63
|
+
* the global object's property when it exists, and otherwise the
|
|
64
|
+
* hidden cell that throws the unresolvable reference's ReferenceError.
|
|
65
|
+
* A simple assignment never reads, so it carries none.
|
|
66
|
+
*/
|
|
67
|
+
readonly read?: HirExpression;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The uninitialized cell used when a strict global identifier write loses
|
|
71
|
+
* its object property before PutValue.
|
|
72
|
+
*/
|
|
73
|
+
interface HirStrictGlobalFallback {
|
|
74
|
+
readonly bindingId: number;
|
|
75
|
+
readonly name: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Marks a property reference as an identifier reference that the global
|
|
79
|
+
* Environment Record resolves through the realm global object. Each
|
|
80
|
+
* record operation tests the property with its own HasProperty, which a
|
|
81
|
+
* Proxy on the global object's prototype chain can observe and answer
|
|
82
|
+
* differently every time: ResolveBinding before the right-hand side,
|
|
83
|
+
* GetBindingValue before a compound or update read, and
|
|
84
|
+
* SetMutableBinding before the write. Only strict code turns a missing
|
|
85
|
+
* property into the ReferenceError that `strictFallback` throws; a
|
|
86
|
+
* non-strict GetBindingValue reads `undefined` and a non-strict PutValue
|
|
87
|
+
* still writes.
|
|
88
|
+
*/
|
|
89
|
+
interface HirGlobalReference {
|
|
90
|
+
/** The base is the persistent host Global Environment Record. */
|
|
91
|
+
readonly hostGlobal?: true;
|
|
92
|
+
readonly strictFallback?: HirStrictGlobalFallback;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* GetValue of an identifier reference that the global Environment Record
|
|
96
|
+
* resolves through the realm global object: ResolveBinding's HasProperty,
|
|
97
|
+
* then GetBindingValue's own HasProperty and Get. The three steps share
|
|
98
|
+
* one evaluation of `object` and of the `name` key, because neither can
|
|
99
|
+
* change between them; only the property can, so each test still runs.
|
|
100
|
+
* An absent property at the first test is an unresolvable reference,
|
|
101
|
+
* whose `unresolvable` read throws its ReferenceError.
|
|
102
|
+
*/
|
|
103
|
+
interface HirGlobalRead extends LocatedSyntax {
|
|
104
|
+
readonly globalReference: HirGlobalReference;
|
|
105
|
+
readonly kind: "global-read";
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly object: HirExpression;
|
|
108
|
+
readonly unresolvable: HirExpression;
|
|
109
|
+
}
|
|
110
|
+
/** One resolved identifier read through active `with` environments. */
|
|
111
|
+
interface HirWithReference extends LocatedSyntax {
|
|
112
|
+
readonly fallback: HirExpression;
|
|
113
|
+
/** Object Environment Record checks for the selected object. */
|
|
114
|
+
readonly globalReference: HirGlobalReference;
|
|
115
|
+
readonly name: string;
|
|
116
|
+
readonly objectBindingIds: readonly number[];
|
|
117
|
+
}
|
|
118
|
+
/** One identifier deletion resolved through active object environments. */
|
|
119
|
+
interface HirWithDeleteReference extends LocatedSyntax {
|
|
120
|
+
/** Delete operation used when no active object environment supplies name. */
|
|
121
|
+
readonly fallback: HirExpression;
|
|
122
|
+
readonly kind: "with-delete";
|
|
123
|
+
readonly name: string;
|
|
124
|
+
readonly objectBindingIds: readonly number[];
|
|
125
|
+
}
|
|
126
|
+
/** One resolved member reference used as an assignment-pattern leaf. */
|
|
127
|
+
interface HirAssignmentMemberTarget extends LocatedSyntax {
|
|
128
|
+
readonly key: HirExpression;
|
|
129
|
+
readonly kind: "assignment-member";
|
|
130
|
+
readonly object: HirExpression;
|
|
131
|
+
/** Name used by named evaluation for a synthetic global target. */
|
|
132
|
+
readonly inferredName?: string;
|
|
133
|
+
/** Present when the leaf is an identifier on the global object. */
|
|
134
|
+
readonly globalReference?: HirGlobalReference;
|
|
135
|
+
}
|
|
136
|
+
/** One resolved private reference used as an assignment-pattern leaf. */
|
|
137
|
+
interface HirAssignmentPrivateTarget extends LocatedSyntax {
|
|
138
|
+
readonly kind: "assignment-private";
|
|
139
|
+
readonly object: HirExpression;
|
|
140
|
+
readonly privateName: HirPrivateName;
|
|
141
|
+
}
|
|
142
|
+
/** One resolved initialized element in an array binding pattern. */
|
|
143
|
+
interface HirBindingElement extends LocatedSyntax {
|
|
144
|
+
readonly initializer?: HirExpression;
|
|
145
|
+
readonly pattern: HirBindingPattern;
|
|
146
|
+
}
|
|
147
|
+
/** One resolved array binding pattern. */
|
|
148
|
+
interface HirArrayBindingPattern extends LocatedSyntax {
|
|
149
|
+
readonly elements: readonly (HirBindingElement | undefined)[];
|
|
150
|
+
readonly kind: "array-binding-pattern";
|
|
151
|
+
readonly rest?: HirBindingPattern;
|
|
152
|
+
}
|
|
153
|
+
/** One resolved property in an object binding pattern. */
|
|
154
|
+
interface HirObjectBindingProperty extends LocatedSyntax {
|
|
155
|
+
readonly initializer?: HirExpression;
|
|
156
|
+
readonly key: HirExpression;
|
|
157
|
+
readonly pattern: HirBindingPattern;
|
|
158
|
+
}
|
|
159
|
+
/** One resolved object binding pattern. */
|
|
160
|
+
interface HirObjectBindingPattern extends LocatedSyntax {
|
|
161
|
+
readonly kind: "object-binding-pattern";
|
|
162
|
+
readonly properties: readonly HirObjectBindingProperty[];
|
|
163
|
+
readonly rest?: HirBindingTarget;
|
|
164
|
+
}
|
|
165
|
+
/** One resolved leaf admitted by a declaration or assignment pattern. */
|
|
166
|
+
type HirBindingTarget = HirAssignmentMemberTarget | HirAssignmentPrivateTarget | HirBindingIdentifier;
|
|
167
|
+
/** One recursively resolved binding or assignment pattern. */
|
|
168
|
+
type HirBindingPattern = HirArrayBindingPattern | HirBindingTarget | HirObjectBindingPattern;
|
|
169
|
+
/** One resolved switch clause sharing the case-block scope. */
|
|
170
|
+
interface HirSwitchCase {
|
|
171
|
+
readonly body: readonly HirStatement[];
|
|
172
|
+
readonly range: SourceRange;
|
|
173
|
+
readonly test?: HirExpression;
|
|
174
|
+
}
|
|
175
|
+
/** One resolved identifier binding in a classic for statement head. */
|
|
176
|
+
interface HirForBindingDeclaration {
|
|
177
|
+
readonly bindingId: number;
|
|
178
|
+
readonly declarationKind: "const" | "let" | "var";
|
|
179
|
+
/** Present on a `using` or `await using` head; see the const statement. */
|
|
180
|
+
readonly disposal?: "async" | "sync";
|
|
181
|
+
readonly hint: Hint | undefined;
|
|
182
|
+
readonly initializer: HirExpression;
|
|
183
|
+
readonly kind: "binding";
|
|
184
|
+
readonly name: string;
|
|
185
|
+
readonly range: SourceRange;
|
|
186
|
+
}
|
|
187
|
+
/** One resolved recursive pattern in a classic for statement head. */
|
|
188
|
+
interface HirForPatternDeclaration {
|
|
189
|
+
readonly declarationKind: "const" | "let" | "var";
|
|
190
|
+
readonly initializer: HirExpression;
|
|
191
|
+
readonly kind: "pattern";
|
|
192
|
+
readonly pattern: HirBindingPattern;
|
|
193
|
+
readonly range: SourceRange;
|
|
194
|
+
}
|
|
195
|
+
/** One resolved declaration in a classic for statement head. */
|
|
196
|
+
type HirForDeclaration = HirForBindingDeclaration | HirForPatternDeclaration;
|
|
197
|
+
/** One resolved for-of target with explicit binding identity. */
|
|
198
|
+
type HirForOfTarget = {
|
|
199
|
+
readonly bindingId: number;
|
|
200
|
+
readonly declarationKind: "const" | "let" | "var";
|
|
201
|
+
/** Present on a `using` or `await using` head. */
|
|
202
|
+
readonly disposal?: "async" | "sync";
|
|
203
|
+
readonly hint: Hint | undefined;
|
|
204
|
+
readonly kind: "declaration";
|
|
205
|
+
readonly mutable: boolean;
|
|
206
|
+
readonly name: string;
|
|
207
|
+
readonly range: SourceRange;
|
|
208
|
+
} | {
|
|
209
|
+
readonly declarationKind: "const" | "let" | "var";
|
|
210
|
+
readonly kind: "pattern-declaration";
|
|
211
|
+
readonly pattern: HirBindingPattern;
|
|
212
|
+
readonly range: SourceRange;
|
|
213
|
+
} | {
|
|
214
|
+
readonly kind: "assignment-pattern";
|
|
215
|
+
readonly pattern: HirBindingPattern;
|
|
216
|
+
readonly range: SourceRange;
|
|
217
|
+
} | {
|
|
218
|
+
readonly bindingId: number;
|
|
219
|
+
readonly functionNameBinding?: true;
|
|
220
|
+
readonly importedBinding?: true;
|
|
221
|
+
readonly kind: "binding";
|
|
222
|
+
readonly mutable: boolean;
|
|
223
|
+
readonly name: string;
|
|
224
|
+
readonly range: SourceRange;
|
|
225
|
+
readonly withObjectBindingIds?: readonly number[];
|
|
226
|
+
/** The global-object property an all-miss write reaches instead. */
|
|
227
|
+
readonly withGlobalFallback?: HirWithGlobalObjectFallback;
|
|
228
|
+
/** Strict SetMutableBinding for a selected with object. */
|
|
229
|
+
readonly globalReference?: HirGlobalReference;
|
|
230
|
+
} | {
|
|
231
|
+
readonly key: HirExpression;
|
|
232
|
+
readonly kind: "property";
|
|
233
|
+
readonly object: HirExpression;
|
|
234
|
+
readonly range: SourceRange;
|
|
235
|
+
readonly globalReference?: HirGlobalReference;
|
|
236
|
+
} | {
|
|
237
|
+
readonly kind: "private";
|
|
238
|
+
readonly object: HirExpression;
|
|
239
|
+
readonly privateName: HirPrivateName;
|
|
240
|
+
readonly range: SourceRange;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* One resolved for-in head target with explicit binding identity.
|
|
244
|
+
*
|
|
245
|
+
* The enumerate head stores through the same references an iterate head
|
|
246
|
+
* does, so it shares that resolved shape. Array patterns consume the String
|
|
247
|
+
* key through the realm's String iterator before storing their leaves.
|
|
248
|
+
*/
|
|
249
|
+
type HirForInTarget = HirForOfTarget;
|
|
250
|
+
/**
|
|
251
|
+
* The named error constructors the profile admits as intrinsic values.
|
|
252
|
+
* An unshadowed reference to one of these names resolves to the
|
|
253
|
+
* runtime-owned constructor instead of an unknown-binding diagnostic.
|
|
254
|
+
*/
|
|
255
|
+
type ErrorIntrinsicName = "AggregateError" | "Error" | "EvalError" | "RangeError" | "ReferenceError" | "SyntaxError" | "TypeError" | "URIError";
|
|
256
|
+
declare function errorIntrinsicName(name: string): ErrorIntrinsicName | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* Whether ECMA-262 requires every realm of the pinned edition to bind
|
|
259
|
+
* `name` as a global, ignoring what this profile has admitted so far.
|
|
260
|
+
*/
|
|
261
|
+
declare function isStandardGlobalName(name: string): boolean;
|
|
262
|
+
/** Whether `name` identifies one concrete TypedArray constructor. */
|
|
263
|
+
declare function isTypedArrayIntrinsicName(name: string): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* How ECMA-262's global object already binds one intrinsic global name,
|
|
266
|
+
* which is what decides whether a Script's own top-level declaration of
|
|
267
|
+
* that name creates an ordinary global-object property.
|
|
268
|
+
*
|
|
269
|
+
* `restricted` names the three value properties ECMA-262 defines as
|
|
270
|
+
* non-writable, non-enumerable, and non-configurable, which is what
|
|
271
|
+
* makes HasRestrictedGlobalProperty true for them. `replaceable` names
|
|
272
|
+
* the intrinsic objects, which are writable and configurable, so a
|
|
273
|
+
* function declaration may legally replace them.
|
|
274
|
+
*
|
|
275
|
+
* Only names this profile admits as values belong here. A name it
|
|
276
|
+
* recognizes solely as a call target, such as `Object` or `console`,
|
|
277
|
+
* is not a value in this realm; referring to one by name is already a
|
|
278
|
+
* source-located diagnostic, so no declaration of it can collide with
|
|
279
|
+
* an intrinsic property.
|
|
280
|
+
*/
|
|
281
|
+
type IntrinsicGlobalKind = "replaceable" | "restricted";
|
|
282
|
+
/**
|
|
283
|
+
* How the global object binds `name`, or `undefined` when it is an
|
|
284
|
+
* ordinary name this realm gives no intrinsic value.
|
|
285
|
+
*/
|
|
286
|
+
declare function intrinsicGlobalKind(name: string): IntrinsicGlobalKind | undefined;
|
|
287
|
+
/**
|
|
288
|
+
* True for an anonymous function or class definition, which
|
|
289
|
+
* NamedEvaluation names from the key or binding that stores it. A static
|
|
290
|
+
* key is already resolved during HIR name inference; this decides
|
|
291
|
+
* whether a key must also reach the closure at run time.
|
|
292
|
+
*/
|
|
293
|
+
declare function anonymousDefinition(expression: HirExpression): boolean;
|
|
294
|
+
/** A resolved call target in HIR. */
|
|
295
|
+
type HirCallTarget = {
|
|
296
|
+
readonly kind: "builtin-export";
|
|
297
|
+
} | {
|
|
298
|
+
/** A host Script binding can shadow an otherwise private call target. */
|
|
299
|
+
readonly kind: "host-runtime-intrinsic";
|
|
300
|
+
readonly name: "console" | "setTimeout" | "clearTimeout";
|
|
301
|
+
readonly objectBindingIds: readonly number[];
|
|
302
|
+
readonly reference: HirGlobalRead;
|
|
303
|
+
} | {
|
|
304
|
+
readonly kind: "console-log";
|
|
305
|
+
} | {
|
|
306
|
+
readonly kind: "promise-intrinsic";
|
|
307
|
+
readonly method: "all" | "asyncCall" | "awaitThen" | "resolve" | "then";
|
|
308
|
+
} | {
|
|
309
|
+
readonly kind: "timer-intrinsic";
|
|
310
|
+
readonly method: "clearTimeout" | "setTimeout";
|
|
311
|
+
} | {
|
|
312
|
+
/**
|
|
313
|
+
* Installs the module table and evaluates the entry through the
|
|
314
|
+
* runtime module evaluation driver. Only a module graph's top-level
|
|
315
|
+
* script calls it.
|
|
316
|
+
*/
|
|
317
|
+
readonly kind: "module-evaluate";
|
|
318
|
+
} | {
|
|
319
|
+
/**
|
|
320
|
+
* EvaluateImportCall for one static-specifier `import()`. The only
|
|
321
|
+
* argument is the constant module table index of the build-time
|
|
322
|
+
* target; the call returns a new promise and evaluates nothing
|
|
323
|
+
* before a later job.
|
|
324
|
+
*/
|
|
325
|
+
readonly kind: "module-import";
|
|
326
|
+
} | {
|
|
327
|
+
readonly callee: HirExpression;
|
|
328
|
+
readonly kind: "dynamic";
|
|
329
|
+
} | {
|
|
330
|
+
/**
|
|
331
|
+
* A `super()` call. It constructs the enclosing constructor's
|
|
332
|
+
* [[Prototype]] and binds the result to the derived constructor's
|
|
333
|
+
* `this` binding, which the target names so lowering can reach it
|
|
334
|
+
* without re-resolving the class.
|
|
335
|
+
*/
|
|
336
|
+
readonly kind: "super";
|
|
337
|
+
/** Forward the incoming list without evaluating a source spread. */
|
|
338
|
+
readonly forwardArguments?: true;
|
|
339
|
+
readonly thisBinding: HirClassThisBinding;
|
|
340
|
+
} | {
|
|
341
|
+
readonly key: HirExpression;
|
|
342
|
+
readonly kind: "method";
|
|
343
|
+
readonly object: HirExpression;
|
|
344
|
+
} | {
|
|
345
|
+
/**
|
|
346
|
+
* A private member call. The callee is the private element the
|
|
347
|
+
* object carries, and the object stays the receiver, so no
|
|
348
|
+
* property lookup and no separate receiver expression exist.
|
|
349
|
+
*/
|
|
350
|
+
readonly kind: "private-method";
|
|
351
|
+
readonly object: HirExpression;
|
|
352
|
+
readonly privateName: HirPrivateName;
|
|
353
|
+
};
|
|
354
|
+
/** One resolved spread entry retained inside an HIR array literal. */
|
|
355
|
+
interface HirArraySpreadElement extends LocatedSyntax {
|
|
356
|
+
readonly argument: HirExpression;
|
|
357
|
+
readonly kind: "spread";
|
|
358
|
+
}
|
|
359
|
+
/** One ordinary, spread, or elided HIR array literal entry. */
|
|
360
|
+
type HirArrayElement = HirArraySpreadElement | HirExpression | undefined;
|
|
361
|
+
/**
|
|
362
|
+
* One resolved regular expression literal. The matcher artifact the
|
|
363
|
+
* frontend compiled contains no binding, so resolution preserves the
|
|
364
|
+
* owned frontend data unchanged.
|
|
365
|
+
*/
|
|
366
|
+
interface HirRegExpLiteral extends LocatedSyntax {
|
|
367
|
+
readonly kind: "regexp";
|
|
368
|
+
readonly matcher: RegExpMatcherProgram;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* One resolved template object argument. Its strings contain no bindings,
|
|
372
|
+
* so resolution preserves the owned frontend data unchanged.
|
|
373
|
+
*/
|
|
374
|
+
interface HirTemplateObject extends LocatedSyntax {
|
|
375
|
+
readonly cooked: readonly (string | undefined)[];
|
|
376
|
+
readonly kind: "template-object";
|
|
377
|
+
readonly raw: readonly string[];
|
|
378
|
+
}
|
|
379
|
+
/** One resolved spread entry retained inside an HIR call argument list. */
|
|
380
|
+
interface HirSpreadArgument extends LocatedSyntax {
|
|
381
|
+
readonly argument: HirExpression;
|
|
382
|
+
readonly kind: "spread";
|
|
383
|
+
}
|
|
384
|
+
/** One ordinary or spread HIR call argument. */
|
|
385
|
+
type HirCallArgument = HirExpression | HirSpreadArgument;
|
|
386
|
+
/** One resolved property or call step in an optional chain. */
|
|
387
|
+
type HirOptionalChainLink = (LocatedSyntax & {
|
|
388
|
+
readonly key: HirExpression;
|
|
389
|
+
readonly kind: "member";
|
|
390
|
+
readonly optional: boolean;
|
|
391
|
+
}) | (LocatedSyntax & {
|
|
392
|
+
readonly kind: "private-member";
|
|
393
|
+
readonly optional: boolean;
|
|
394
|
+
readonly privateName: HirPrivateName;
|
|
395
|
+
}) | (LocatedSyntax & {
|
|
396
|
+
readonly arguments: readonly HirCallArgument[];
|
|
397
|
+
readonly chainBoundary?: true;
|
|
398
|
+
readonly kind: "call";
|
|
399
|
+
readonly optional: boolean;
|
|
400
|
+
});
|
|
401
|
+
/** One data, shorthand, method, or accessor HIR object literal entry. */
|
|
402
|
+
interface HirObjectDefinition {
|
|
403
|
+
/** A get or set accessor; absent for a data, shorthand, or method
|
|
404
|
+
* property. */
|
|
405
|
+
readonly accessorKind?: "get" | "set";
|
|
406
|
+
readonly key: HirExpression;
|
|
407
|
+
readonly kind: "definition";
|
|
408
|
+
/**
|
|
409
|
+
* Whether this colon-form definition sets [[Prototype]] instead of an
|
|
410
|
+
* own property. At most one may appear in each object literal.
|
|
411
|
+
*/
|
|
412
|
+
readonly prototypeSetter?: true;
|
|
413
|
+
readonly value: HirExpression;
|
|
414
|
+
}
|
|
415
|
+
/** One resolved spread entry retained inside an HIR object literal. */
|
|
416
|
+
interface HirObjectSpreadProperty extends LocatedSyntax {
|
|
417
|
+
readonly argument: HirExpression;
|
|
418
|
+
readonly kind: "spread";
|
|
419
|
+
}
|
|
420
|
+
/** One defined or spread HIR object literal property. */
|
|
421
|
+
type HirObjectProperty = HirObjectDefinition | HirObjectSpreadProperty;
|
|
422
|
+
/**
|
|
423
|
+
* One resolved private name. The binding holds the private name value
|
|
424
|
+
* the class evaluation created, so every element and reference in the
|
|
425
|
+
* class body reaches the same identity, and a second evaluation of the
|
|
426
|
+
* same class creates a distinct one.
|
|
427
|
+
*/
|
|
428
|
+
interface HirPrivateName {
|
|
429
|
+
readonly bindingId: number;
|
|
430
|
+
/** The declared name, including its leading `#`. */
|
|
431
|
+
readonly name: string;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* A private element name standing where a class element key stands. It
|
|
435
|
+
* is not an expression: it names an element the object carries outside
|
|
436
|
+
* its properties, so lowering never converts it to a property key.
|
|
437
|
+
*/
|
|
438
|
+
interface HirPrivateNameKey extends LocatedSyntax {
|
|
439
|
+
readonly kind: "private-name";
|
|
440
|
+
readonly privateName: HirPrivateName;
|
|
441
|
+
}
|
|
442
|
+
/** One resolved method or accessor definition in an HIR class body. */
|
|
443
|
+
interface HirClassMethod extends LocatedSyntax {
|
|
444
|
+
/** A get or set accessor; absent for an ordinary method definition. */
|
|
445
|
+
readonly accessorKind?: "get" | "set";
|
|
446
|
+
readonly key: HirExpression | HirPrivateNameKey;
|
|
447
|
+
readonly kind: "method";
|
|
448
|
+
/**
|
|
449
|
+
* True for a `static` element, which is defined on the constructor
|
|
450
|
+
* itself instead of on its prototype object.
|
|
451
|
+
*/
|
|
452
|
+
readonly staticPlacement?: true;
|
|
453
|
+
readonly value: HirExpression;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* One resolved field definition in an HIR class body. The initializer
|
|
457
|
+
* is resolved as its own function, so it reads the class scope instead
|
|
458
|
+
* of the constructor's parameters and takes the object the field is
|
|
459
|
+
* defined on as its receiver: the instance under construction for an
|
|
460
|
+
* instance field and the constructor itself for a `static` one.
|
|
461
|
+
*/
|
|
462
|
+
interface HirClassField extends LocatedSyntax {
|
|
463
|
+
/**
|
|
464
|
+
* The closure that produces the field's value, absent for a field
|
|
465
|
+
* declared without an initializer, whose value is `undefined`.
|
|
466
|
+
*/
|
|
467
|
+
readonly initializer?: HirExpression;
|
|
468
|
+
readonly key: HirExpression | HirPrivateNameKey;
|
|
469
|
+
/**
|
|
470
|
+
* Where the evaluated key is stored for the initializer to read,
|
|
471
|
+
* present only when the initializer is an anonymous definition whose
|
|
472
|
+
* key is not a static string. The cell is created and filled where
|
|
473
|
+
* the element appears, so the closure that captures it observes the
|
|
474
|
+
* one key evaluation the class body performs.
|
|
475
|
+
*/
|
|
476
|
+
readonly keyNameBindingId?: number;
|
|
477
|
+
readonly kind: "field";
|
|
478
|
+
/**
|
|
479
|
+
* True for a `static` field, which the class definition defines on the
|
|
480
|
+
* constructor after every element is in place, rather than recording
|
|
481
|
+
* for each instance the constructor builds.
|
|
482
|
+
*/
|
|
483
|
+
readonly staticPlacement?: true;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* One resolved `static { ... }` initialization block. The block body is
|
|
487
|
+
* resolved as its own function, so it reads the class scope and takes
|
|
488
|
+
* the constructor as its receiver, and the class definition calls that
|
|
489
|
+
* closure once and discards whatever it produces.
|
|
490
|
+
*/
|
|
491
|
+
interface HirClassStaticBlock extends LocatedSyntax {
|
|
492
|
+
/** The closure holding the block's statements. */
|
|
493
|
+
readonly body: HirExpression;
|
|
494
|
+
readonly kind: "static-block";
|
|
495
|
+
}
|
|
496
|
+
/** One element admitted by an HIR class body. */
|
|
497
|
+
type HirClassElement = HirClassField | HirClassMethod | HirClassStaticBlock;
|
|
498
|
+
/**
|
|
499
|
+
* The immutable binding a named class holds in its own lexical
|
|
500
|
+
* environment. Only the class body reaches it.
|
|
501
|
+
*/
|
|
502
|
+
interface HirClassNameBinding {
|
|
503
|
+
readonly bindingId: number;
|
|
504
|
+
readonly name: string;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The `this` binding a derived class constructor owns. It starts
|
|
508
|
+
* uninitialized, so reading `this` before `super()` throws a
|
|
509
|
+
* `ReferenceError`, and `super()` initializes it with whatever the parent
|
|
510
|
+
* constructor produced. A base class constructor has no such binding and
|
|
511
|
+
* reads its receiver directly.
|
|
512
|
+
*/
|
|
513
|
+
interface HirClassThisBinding {
|
|
514
|
+
readonly bindingId: number;
|
|
515
|
+
}
|
|
516
|
+
/** A resolved, normalized HIR expression. */
|
|
517
|
+
type HirExpression = (LocatedSyntax & {
|
|
518
|
+
readonly kind: "global-environment";
|
|
519
|
+
readonly name: string;
|
|
520
|
+
}) | (LocatedSyntax & {
|
|
521
|
+
readonly argument: HirExpression;
|
|
522
|
+
readonly kind: "await";
|
|
523
|
+
}) | (LocatedSyntax & {
|
|
524
|
+
/** Absent for a bare `yield`, which sends `undefined` out. */
|
|
525
|
+
readonly argument?: HirExpression;
|
|
526
|
+
/**
|
|
527
|
+
* True for `yield*`, which delegates every resumption to the
|
|
528
|
+
* operand's iterator. The grammar requires an operand, so a
|
|
529
|
+
* delegating expression always carries an `argument`.
|
|
530
|
+
*/
|
|
531
|
+
readonly delegate?: true;
|
|
532
|
+
readonly kind: "yield";
|
|
533
|
+
}) | (LocatedSyntax & {
|
|
534
|
+
readonly bindingId: number;
|
|
535
|
+
readonly functionNameBinding?: boolean;
|
|
536
|
+
readonly importedBinding?: boolean;
|
|
537
|
+
readonly kind: "binding-set";
|
|
538
|
+
readonly mutable: boolean;
|
|
539
|
+
readonly name: string;
|
|
540
|
+
readonly value: HirExpression;
|
|
541
|
+
}) | (LocatedSyntax & {
|
|
542
|
+
readonly bindingId: number;
|
|
543
|
+
readonly functionNameBinding?: boolean;
|
|
544
|
+
readonly importedBinding?: boolean;
|
|
545
|
+
readonly kind: "binding-update";
|
|
546
|
+
readonly mutable: boolean;
|
|
547
|
+
readonly name: string;
|
|
548
|
+
readonly operator: AssignmentOperator;
|
|
549
|
+
readonly value: HirExpression;
|
|
550
|
+
}) | (LocatedSyntax & {
|
|
551
|
+
readonly bindingId: number;
|
|
552
|
+
readonly functionNameBinding?: boolean;
|
|
553
|
+
readonly importedBinding?: boolean;
|
|
554
|
+
readonly kind: "binding-step";
|
|
555
|
+
readonly mutable: boolean;
|
|
556
|
+
readonly name: string;
|
|
557
|
+
readonly operator: "++" | "--";
|
|
558
|
+
readonly prefix: boolean;
|
|
559
|
+
}) | (LocatedSyntax & {
|
|
560
|
+
readonly fallback: HirWithBindingReference | HirWithGlobalObjectFallback;
|
|
561
|
+
/** Object Environment Record checks for the retained reference. */
|
|
562
|
+
readonly globalReference: HirGlobalReference;
|
|
563
|
+
readonly kind: "with-set";
|
|
564
|
+
readonly name: string;
|
|
565
|
+
readonly objectBindingIds: readonly number[];
|
|
566
|
+
readonly value: HirExpression;
|
|
567
|
+
}) | (LocatedSyntax & {
|
|
568
|
+
readonly fallback: HirWithBindingReference | HirWithGlobalObjectFallback;
|
|
569
|
+
/** Object Environment Record checks for the retained reference. */
|
|
570
|
+
readonly globalReference: HirGlobalReference;
|
|
571
|
+
readonly kind: "with-update";
|
|
572
|
+
readonly name: string;
|
|
573
|
+
readonly objectBindingIds: readonly number[];
|
|
574
|
+
readonly operator: AssignmentOperator;
|
|
575
|
+
readonly value: HirExpression;
|
|
576
|
+
}) | (LocatedSyntax & {
|
|
577
|
+
readonly fallback: HirWithBindingReference | HirWithGlobalObjectFallback;
|
|
578
|
+
/** Object Environment Record checks for the retained reference. */
|
|
579
|
+
readonly globalReference: HirGlobalReference;
|
|
580
|
+
readonly kind: "with-step";
|
|
581
|
+
readonly name: string;
|
|
582
|
+
readonly objectBindingIds: readonly number[];
|
|
583
|
+
readonly operator: "++" | "--";
|
|
584
|
+
readonly prefix: boolean;
|
|
585
|
+
}) | (LocatedSyntax & {
|
|
586
|
+
readonly kind: "destructuring-set";
|
|
587
|
+
readonly pattern: HirBindingPattern;
|
|
588
|
+
readonly value: HirExpression;
|
|
589
|
+
}) | (LocatedSyntax & {
|
|
590
|
+
readonly elements: readonly HirArrayElement[];
|
|
591
|
+
readonly kind: "array";
|
|
592
|
+
}) | HirTemplateObject | (LocatedSyntax & {
|
|
593
|
+
readonly kind: "binary";
|
|
594
|
+
readonly left: HirExpression;
|
|
595
|
+
readonly operator: BinaryOperator;
|
|
596
|
+
readonly right: HirExpression;
|
|
597
|
+
}) | (LocatedSyntax & {
|
|
598
|
+
readonly kind: "boolean";
|
|
599
|
+
readonly value: boolean;
|
|
600
|
+
}) | (LocatedSyntax & {
|
|
601
|
+
readonly arguments: readonly HirCallArgument[];
|
|
602
|
+
readonly kind: "call";
|
|
603
|
+
readonly target: HirCallTarget;
|
|
604
|
+
}) | (LocatedSyntax & {
|
|
605
|
+
readonly alternate: HirExpression;
|
|
606
|
+
readonly consequent: HirExpression;
|
|
607
|
+
readonly kind: "conditional";
|
|
608
|
+
readonly test: HirExpression;
|
|
609
|
+
}) | HirGlobalRead | (LocatedSyntax & {
|
|
610
|
+
readonly kind: "logical";
|
|
611
|
+
readonly left: HirExpression;
|
|
612
|
+
readonly operator: LogicalOperator;
|
|
613
|
+
readonly right: HirExpression;
|
|
614
|
+
}) | (LocatedSyntax & {
|
|
615
|
+
readonly expressions: readonly HirExpression[];
|
|
616
|
+
readonly kind: "sequence";
|
|
617
|
+
}) | (LocatedSyntax & {
|
|
618
|
+
readonly functionId: number;
|
|
619
|
+
readonly functionKind: FunctionKind;
|
|
620
|
+
readonly kind: "function";
|
|
621
|
+
readonly name: string;
|
|
622
|
+
readonly functionLength: number;
|
|
623
|
+
readonly sourceText?: string;
|
|
624
|
+
}) | (LocatedSyntax & {
|
|
625
|
+
readonly bindingId: number;
|
|
626
|
+
readonly kind: "binding";
|
|
627
|
+
readonly name: string;
|
|
628
|
+
}) | (HirWithReference & {
|
|
629
|
+
readonly kind: "with-get";
|
|
630
|
+
}) | (LocatedSyntax & {
|
|
631
|
+
readonly errorName: ErrorIntrinsicName;
|
|
632
|
+
readonly kind: "error-intrinsic";
|
|
633
|
+
}) | (LocatedSyntax & {
|
|
634
|
+
/** The call whose result cannot be assigned, evaluated first. */
|
|
635
|
+
readonly call: HirExpression;
|
|
636
|
+
/** The ReferenceError constructed and thrown after the call. */
|
|
637
|
+
readonly error: HirExpression;
|
|
638
|
+
readonly kind: "invalid-assignment-target";
|
|
639
|
+
}) | (LocatedSyntax & {
|
|
640
|
+
readonly kind: "function-intrinsic";
|
|
641
|
+
}) | (LocatedSyntax & {
|
|
642
|
+
readonly kind: "iterator-intrinsic";
|
|
643
|
+
}) | (LocatedSyntax & {
|
|
644
|
+
/**
|
|
645
|
+
* One numeric hole of an agent program compiled from a
|
|
646
|
+
* `$262.agent.start` source template: the Number the started
|
|
647
|
+
* agent's source text carried at this position.
|
|
648
|
+
*/
|
|
649
|
+
readonly index: number;
|
|
650
|
+
readonly kind: "agent-hole";
|
|
651
|
+
}) | (LocatedSyntax & {
|
|
652
|
+
readonly kind: "symbol-intrinsic";
|
|
653
|
+
}) | (LocatedSyntax & {
|
|
654
|
+
readonly kind: "null";
|
|
655
|
+
}) | (LocatedSyntax & {
|
|
656
|
+
readonly entries: readonly {
|
|
657
|
+
readonly bindingId: number;
|
|
658
|
+
readonly name: string;
|
|
659
|
+
}[];
|
|
660
|
+
readonly kind: "module-namespace";
|
|
661
|
+
}) | (LocatedSyntax & {
|
|
662
|
+
readonly arguments: readonly HirCallArgument[];
|
|
663
|
+
readonly callee: HirExpression;
|
|
664
|
+
readonly kind: "new";
|
|
665
|
+
}) | (LocatedSyntax & {
|
|
666
|
+
/**
|
|
667
|
+
* The class constructor closure, whose `name` is the class name and
|
|
668
|
+
* whose value is the class itself.
|
|
669
|
+
*/
|
|
670
|
+
readonly constructorFunction: HirExpression;
|
|
671
|
+
readonly elements: readonly HirClassElement[];
|
|
672
|
+
/**
|
|
673
|
+
* The evaluated `extends` operand, present exactly for a derived
|
|
674
|
+
* class. It is evaluated in the class's own lexical environment,
|
|
675
|
+
* before the constructor closure exists.
|
|
676
|
+
*/
|
|
677
|
+
readonly heritage?: HirExpression;
|
|
678
|
+
readonly kind: "class";
|
|
679
|
+
/**
|
|
680
|
+
* Present only for a named class. It is initialized after every
|
|
681
|
+
* element is defined, so a computed key that reads it observes the
|
|
682
|
+
* temporal dead zone.
|
|
683
|
+
*/
|
|
684
|
+
readonly nameBinding?: HirClassNameBinding;
|
|
685
|
+
/**
|
|
686
|
+
* The private names this class body declares, in declaration
|
|
687
|
+
* order. The class evaluation creates one value per entry before
|
|
688
|
+
* any element is defined, so every element and every reference in
|
|
689
|
+
* the body shares that identity and a second evaluation of the
|
|
690
|
+
* same class produces names no earlier instance carries.
|
|
691
|
+
*/
|
|
692
|
+
readonly privateNames?: readonly HirPrivateName[];
|
|
693
|
+
}) | (LocatedSyntax & {
|
|
694
|
+
readonly kind: "object";
|
|
695
|
+
readonly properties: readonly HirObjectProperty[];
|
|
696
|
+
}) | (LocatedSyntax & {
|
|
697
|
+
readonly base: HirExpression;
|
|
698
|
+
/** Delete the final live reference, or return true on a short path. */
|
|
699
|
+
readonly delete?: true;
|
|
700
|
+
readonly kind: "optional-chain";
|
|
701
|
+
readonly links: readonly HirOptionalChainLink[];
|
|
702
|
+
}) | (LocatedSyntax & {
|
|
703
|
+
/** The evaluated non-reference value is discarded after abrupt checks. */
|
|
704
|
+
readonly argument: HirExpression;
|
|
705
|
+
readonly kind: "delete-value";
|
|
706
|
+
}) | HirWithDeleteReference | (LocatedSyntax & {
|
|
707
|
+
readonly key: HirExpression;
|
|
708
|
+
readonly kind: "property-delete";
|
|
709
|
+
readonly object: HirExpression;
|
|
710
|
+
}) | (LocatedSyntax & {
|
|
711
|
+
readonly key: HirExpression;
|
|
712
|
+
readonly kind: "property-get";
|
|
713
|
+
readonly object: HirExpression;
|
|
714
|
+
}) | (LocatedSyntax & {
|
|
715
|
+
readonly key: HirExpression;
|
|
716
|
+
readonly kind: "property-set";
|
|
717
|
+
readonly object: HirExpression;
|
|
718
|
+
readonly globalReference?: HirGlobalReference;
|
|
719
|
+
readonly value: HirExpression;
|
|
720
|
+
}) | (LocatedSyntax & {
|
|
721
|
+
readonly key: HirExpression;
|
|
722
|
+
readonly kind: "property-update";
|
|
723
|
+
readonly object: HirExpression;
|
|
724
|
+
readonly operator: AssignmentOperator;
|
|
725
|
+
readonly globalReference?: HirGlobalReference;
|
|
726
|
+
readonly value: HirExpression;
|
|
727
|
+
}) | (LocatedSyntax & {
|
|
728
|
+
readonly key: HirExpression;
|
|
729
|
+
readonly kind: "property-step";
|
|
730
|
+
readonly object: HirExpression;
|
|
731
|
+
readonly operator: "++" | "--";
|
|
732
|
+
readonly prefix: boolean;
|
|
733
|
+
readonly globalReference?: HirGlobalReference;
|
|
734
|
+
}) | (LocatedSyntax & {
|
|
735
|
+
/**
|
|
736
|
+
* A private member reference. The name is already resolved to the
|
|
737
|
+
* class body that declared it, so lowering reads the private name
|
|
738
|
+
* value from its binding and asks the object for that element
|
|
739
|
+
* instead of looking a property key up along a prototype chain.
|
|
740
|
+
*/
|
|
741
|
+
readonly kind: "private-get";
|
|
742
|
+
readonly object: HirExpression;
|
|
743
|
+
readonly privateName: HirPrivateName;
|
|
744
|
+
}) | (LocatedSyntax & {
|
|
745
|
+
/**
|
|
746
|
+
* A private brand check. The name is resolved lexically, so
|
|
747
|
+
* lowering only evaluates the selected object and asks whether it
|
|
748
|
+
* carries the corresponding private element.
|
|
749
|
+
*/
|
|
750
|
+
readonly kind: "private-in";
|
|
751
|
+
readonly object: HirExpression;
|
|
752
|
+
readonly privateName: HirPrivateName;
|
|
753
|
+
}) | (LocatedSyntax & {
|
|
754
|
+
readonly kind: "private-set";
|
|
755
|
+
readonly object: HirExpression;
|
|
756
|
+
readonly privateName: HirPrivateName;
|
|
757
|
+
readonly value: HirExpression;
|
|
758
|
+
}) | (LocatedSyntax & {
|
|
759
|
+
readonly kind: "private-update";
|
|
760
|
+
readonly object: HirExpression;
|
|
761
|
+
readonly operator: AssignmentOperator;
|
|
762
|
+
readonly privateName: HirPrivateName;
|
|
763
|
+
readonly value: HirExpression;
|
|
764
|
+
}) | (LocatedSyntax & {
|
|
765
|
+
readonly kind: "private-step";
|
|
766
|
+
readonly object: HirExpression;
|
|
767
|
+
readonly operator: "++" | "--";
|
|
768
|
+
readonly prefix: boolean;
|
|
769
|
+
readonly privateName: HirPrivateName;
|
|
770
|
+
}) | (LocatedSyntax & {
|
|
771
|
+
/** Separator-free source digits, without the radix prefix or `n`. */
|
|
772
|
+
readonly digits: string;
|
|
773
|
+
readonly kind: "bigint";
|
|
774
|
+
readonly radix: 2 | 8 | 10 | 16;
|
|
775
|
+
}) | HirRegExpLiteral | (LocatedSyntax & {
|
|
776
|
+
readonly kind: "number";
|
|
777
|
+
readonly value: number;
|
|
778
|
+
}) | (LocatedSyntax & {
|
|
779
|
+
readonly kind: "string";
|
|
780
|
+
readonly value: string;
|
|
781
|
+
}) | (LocatedSyntax & {
|
|
782
|
+
readonly kind: "this";
|
|
783
|
+
readonly thisMode: SyntaxThisMode;
|
|
784
|
+
}) | (LocatedSyntax & {
|
|
785
|
+
/**
|
|
786
|
+
* The `super` operand of a property reference. It stands only as
|
|
787
|
+
* the `object` of a property get, delete, set, update, or step
|
|
788
|
+
* expression, of a `method` call target, of an
|
|
789
|
+
* `assignment-member` destructuring leaf, or of a `property`
|
|
790
|
+
* for-of or for-in head target. Lowering starts the
|
|
791
|
+
* lookup at the running function's home object prototype and keeps
|
|
792
|
+
* `receiver` as the value a getter, setter, or method call
|
|
793
|
+
* receives as `this`, which is the resolved `this` of the
|
|
794
|
+
* enclosing class element and therefore the derived constructor's
|
|
795
|
+
* binding where one exists. A target position lowers that pair
|
|
796
|
+
* once per stored value and holds it until the value exists,
|
|
797
|
+
* because PutValue runs after the iterator step or property read
|
|
798
|
+
* that produces it. A delete operand reads `receiver` for
|
|
799
|
+
* its temporal dead zone alone: ECMA-262 rejects the evaluated
|
|
800
|
+
* `super` reference before any lookup starts, so no home object
|
|
801
|
+
* prototype is read and no receiver is carried further.
|
|
802
|
+
*/
|
|
803
|
+
readonly kind: "super-base";
|
|
804
|
+
readonly receiver: HirExpression;
|
|
805
|
+
}) | (LocatedSyntax & {
|
|
806
|
+
readonly kind: "new-target";
|
|
807
|
+
}) | (LocatedSyntax & {
|
|
808
|
+
readonly argument: HirExpression;
|
|
809
|
+
readonly kind: "unary";
|
|
810
|
+
readonly operator: UnaryOperator;
|
|
811
|
+
}) | (LocatedSyntax & {
|
|
812
|
+
readonly kind: "undefined";
|
|
813
|
+
});
|
|
814
|
+
/** A resolved HIR statement with explicit binding identity. */
|
|
815
|
+
type HirStatement = (LocatedSyntax & {
|
|
816
|
+
readonly body: readonly HirStatement[];
|
|
817
|
+
readonly kind: "block";
|
|
818
|
+
}) | (LocatedSyntax & {
|
|
819
|
+
readonly kind: "break";
|
|
820
|
+
readonly label?: string;
|
|
821
|
+
}) | (LocatedSyntax & {
|
|
822
|
+
readonly kind: "continue";
|
|
823
|
+
readonly label?: string;
|
|
824
|
+
}) | (LocatedSyntax & {
|
|
825
|
+
readonly body: HirStatement;
|
|
826
|
+
readonly kind: "do-while";
|
|
827
|
+
readonly test: HirExpression;
|
|
828
|
+
}) | (LocatedSyntax & {
|
|
829
|
+
readonly body: HirStatement;
|
|
830
|
+
readonly kind: "labeled";
|
|
831
|
+
readonly label: string;
|
|
832
|
+
}) | (LocatedSyntax & {
|
|
833
|
+
readonly body: HirStatement;
|
|
834
|
+
readonly declarations?: readonly HirForDeclaration[];
|
|
835
|
+
readonly init?: HirExpression;
|
|
836
|
+
readonly kind: "for";
|
|
837
|
+
readonly test?: HirExpression;
|
|
838
|
+
readonly update?: HirExpression;
|
|
839
|
+
}) | (LocatedSyntax & {
|
|
840
|
+
/**
|
|
841
|
+
* The enumerate head. A nullish subject skips the whole statement
|
|
842
|
+
* and no completion ever closes the enumeration, so it lowers
|
|
843
|
+
* separately from the iterate head it shares targets with.
|
|
844
|
+
*/
|
|
845
|
+
readonly body: HirStatement;
|
|
846
|
+
readonly kind: "for-in";
|
|
847
|
+
readonly subject: HirExpression;
|
|
848
|
+
readonly target: HirForInTarget;
|
|
849
|
+
}) | (LocatedSyntax & {
|
|
850
|
+
/** `for await`, which awaits each asynchronous iteration step. */
|
|
851
|
+
readonly awaited?: true;
|
|
852
|
+
readonly body: HirStatement;
|
|
853
|
+
readonly iterable: HirExpression;
|
|
854
|
+
readonly kind: "for-of";
|
|
855
|
+
readonly target: HirForOfTarget;
|
|
856
|
+
}) | (LocatedSyntax & {
|
|
857
|
+
readonly cases: readonly HirSwitchCase[];
|
|
858
|
+
readonly discriminant: HirExpression;
|
|
859
|
+
/**
|
|
860
|
+
* Every clause's function declaration, instantiated once at
|
|
861
|
+
* CaseBlock entry regardless of which clause runs, which is
|
|
862
|
+
* ECMA-262's BlockDeclarationInstantiation for a CaseBlock. Absent
|
|
863
|
+
* when no clause declares a function.
|
|
864
|
+
*/
|
|
865
|
+
readonly functionInits?: readonly HirStatement[];
|
|
866
|
+
readonly kind: "switch";
|
|
867
|
+
}) | (LocatedSyntax & {
|
|
868
|
+
readonly declarationKind: "const" | "let" | "var";
|
|
869
|
+
readonly initializer: HirExpression;
|
|
870
|
+
readonly kind: "binding-pattern";
|
|
871
|
+
readonly mode: BindingPatternMode;
|
|
872
|
+
readonly pattern: HirBindingPattern;
|
|
873
|
+
}) | (LocatedSyntax & {
|
|
874
|
+
readonly bindingId: number;
|
|
875
|
+
readonly hint: Hint | undefined;
|
|
876
|
+
readonly initializer: HirExpression;
|
|
877
|
+
readonly kind: "binding-init";
|
|
878
|
+
readonly name: string;
|
|
879
|
+
}) | (LocatedSyntax & {
|
|
880
|
+
readonly bindingId: number;
|
|
881
|
+
readonly hint: Hint | undefined;
|
|
882
|
+
readonly initializer: HirExpression;
|
|
883
|
+
/**
|
|
884
|
+
* Present on a `using` (`"sync"`) or `await using` (`"async"`)
|
|
885
|
+
* declaration, which binds like `const` and also adds its value to
|
|
886
|
+
* the enclosing scope's DisposeCapability.
|
|
887
|
+
*/
|
|
888
|
+
readonly disposal?: "async" | "sync";
|
|
889
|
+
readonly kind: "const";
|
|
890
|
+
readonly name: string;
|
|
891
|
+
}) | (LocatedSyntax & {
|
|
892
|
+
readonly bindingId: number;
|
|
893
|
+
readonly hint: Hint | undefined;
|
|
894
|
+
readonly initializer: HirExpression;
|
|
895
|
+
readonly kind: "let";
|
|
896
|
+
readonly name: string;
|
|
897
|
+
}) | (LocatedSyntax & {
|
|
898
|
+
readonly expression: HirExpression;
|
|
899
|
+
/** A lowered var initializer has an empty Statement completion. */
|
|
900
|
+
readonly emptyCompletion?: true;
|
|
901
|
+
readonly kind: "expression";
|
|
902
|
+
}) | (LocatedSyntax & {
|
|
903
|
+
/**
|
|
904
|
+
* True when `bindingId` names a parameter or the implicit
|
|
905
|
+
* `arguments` binding that FunctionDeclarationInstantiation already
|
|
906
|
+
* initialized, so this statement writes through that existing
|
|
907
|
+
* binding instead of initializing a fresh one.
|
|
908
|
+
*/
|
|
909
|
+
readonly alreadyInitialized?: true;
|
|
910
|
+
readonly bindingId: number;
|
|
911
|
+
readonly functionId: number;
|
|
912
|
+
readonly functionKind: FunctionKind;
|
|
913
|
+
readonly functionName: string;
|
|
914
|
+
readonly kind: "function-init";
|
|
915
|
+
readonly name: string;
|
|
916
|
+
readonly functionLength: number;
|
|
917
|
+
readonly sourceText?: string;
|
|
918
|
+
}) | (LocatedSyntax & {
|
|
919
|
+
readonly alternate: HirStatement | undefined;
|
|
920
|
+
readonly consequent: HirStatement;
|
|
921
|
+
readonly kind: "if";
|
|
922
|
+
readonly test: HirExpression;
|
|
923
|
+
}) | (LocatedSyntax & {
|
|
924
|
+
readonly expression: HirExpression | undefined;
|
|
925
|
+
readonly kind: "return";
|
|
926
|
+
}) | (LocatedSyntax & {
|
|
927
|
+
readonly expression: HirExpression;
|
|
928
|
+
readonly kind: "throw";
|
|
929
|
+
}) | (LocatedSyntax & {
|
|
930
|
+
readonly block: HirStatement;
|
|
931
|
+
readonly handler: {
|
|
932
|
+
readonly body: HirStatement;
|
|
933
|
+
/**
|
|
934
|
+
* Resolved CatchParameter, or `undefined` for the optional
|
|
935
|
+
* catch binding form, which binds nothing and resolves its
|
|
936
|
+
* body without a catch-parameter scope.
|
|
937
|
+
*/
|
|
938
|
+
readonly pattern: HirBindingPattern | undefined;
|
|
939
|
+
readonly range: SourceRange;
|
|
940
|
+
} | undefined;
|
|
941
|
+
readonly finalizer: HirStatement | undefined;
|
|
942
|
+
readonly kind: "try";
|
|
943
|
+
}) | (LocatedSyntax & {
|
|
944
|
+
readonly body: HirStatement;
|
|
945
|
+
readonly kind: "while";
|
|
946
|
+
readonly test: HirExpression;
|
|
947
|
+
}) | (LocatedSyntax & {
|
|
948
|
+
readonly body: HirStatement;
|
|
949
|
+
/**
|
|
950
|
+
* Hidden uninitialized fallbacks used only when an object property
|
|
951
|
+
* may supply a name that has no statically owned lexical binding.
|
|
952
|
+
*/
|
|
953
|
+
readonly fallbackBindings: readonly {
|
|
954
|
+
readonly bindingId: number;
|
|
955
|
+
readonly name: string;
|
|
956
|
+
}[];
|
|
957
|
+
readonly kind: "with";
|
|
958
|
+
/** Hidden cell containing the evaluated object for this execution. */
|
|
959
|
+
readonly objectBindingId: number;
|
|
960
|
+
readonly object: HirExpression;
|
|
961
|
+
});
|
|
962
|
+
/** A resolved function parameter. */
|
|
963
|
+
interface HirParameter extends SyntaxParameter {
|
|
964
|
+
readonly bindingId: number;
|
|
965
|
+
}
|
|
966
|
+
/** One statically resolved HIR function. */
|
|
967
|
+
interface HirFunction extends LocatedSyntax {
|
|
968
|
+
/**
|
|
969
|
+
* The implicit `arguments` binding initialized from the call arguments
|
|
970
|
+
* before parameter initialization. Every function form except an arrow
|
|
971
|
+
* declares one, so an arrow's own `arguments` reference resolves to the
|
|
972
|
+
* nearest enclosing form's binding instead.
|
|
973
|
+
*/
|
|
974
|
+
readonly argumentsBindingId?: number;
|
|
975
|
+
/**
|
|
976
|
+
* True when `argumentsBindingId`'s object is the mapped arguments
|
|
977
|
+
* exotic object rather than the ordinary unmapped snapshot. ECMA-262
|
|
978
|
+
* admits the mapped form only for a non-strict function whose
|
|
979
|
+
* parameter list is simple; a present `argumentsBindingId` with this
|
|
980
|
+
* absent keeps the existing unmapped object.
|
|
981
|
+
*/
|
|
982
|
+
readonly argumentsMapped?: true;
|
|
983
|
+
readonly body: readonly HirStatement[];
|
|
984
|
+
/**
|
|
985
|
+
* Present exactly on a derived class constructor. Every `return` leaves
|
|
986
|
+
* through this binding, so a constructor that never reached `super()`
|
|
987
|
+
* throws a `ReferenceError` instead of producing an unbound receiver.
|
|
988
|
+
*/
|
|
989
|
+
readonly derivedThisBindingId?: number;
|
|
990
|
+
/**
|
|
991
|
+
* The binding holding the field key that names this class field
|
|
992
|
+
* initializer's anonymous result, which is ECMA-262's
|
|
993
|
+
* [[ClassFieldInitializerName]]. Present only on such an initializer.
|
|
994
|
+
*/
|
|
995
|
+
readonly fieldKeyBindingId?: number;
|
|
996
|
+
/** JavaScript `length`, independent from the call ABI parameter count. */
|
|
997
|
+
readonly functionLength: number;
|
|
998
|
+
readonly functionKind: FunctionKind;
|
|
999
|
+
/**
|
|
1000
|
+
* Number of leading HIR statements that a generator call executes before
|
|
1001
|
+
* returning its suspended generator object.
|
|
1002
|
+
*/
|
|
1003
|
+
readonly generatorCallStatementCount?: number;
|
|
1004
|
+
readonly id: number;
|
|
1005
|
+
/**
|
|
1006
|
+
* True on a class constructor whose class declares instance fields.
|
|
1007
|
+
* The constructor runs them against the instance under construction:
|
|
1008
|
+
* a base constructor before its body, and a derived one where
|
|
1009
|
+
* `super()` returns.
|
|
1010
|
+
*/
|
|
1011
|
+
readonly initializesInstanceElements?: true;
|
|
1012
|
+
readonly kind: "hir-function";
|
|
1013
|
+
readonly localBindingIds: readonly number[];
|
|
1014
|
+
readonly name: string;
|
|
1015
|
+
readonly parameters: readonly HirParameter[];
|
|
1016
|
+
readonly returnHints: readonly Hint[];
|
|
1017
|
+
/** Original ECMAScript source text retained for callable reflection. */
|
|
1018
|
+
readonly sourceText?: string;
|
|
1019
|
+
readonly selfBindingId?: number;
|
|
1020
|
+
readonly strict?: boolean;
|
|
1021
|
+
/**
|
|
1022
|
+
* True when the body is an ECMA-262 FunctionBody or ConciseBody whose
|
|
1023
|
+
* tail position calls are proper tail calls (15.10.1): strict source
|
|
1024
|
+
* code of an ordinary, arrow, method, accessor, or class constructor
|
|
1025
|
+
* function. Generator and async bodies never set it, and neither does
|
|
1026
|
+
* any function the compiler synthesizes, such as a class field
|
|
1027
|
+
* initializer, whose `return` stands for no source ReturnStatement.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly tailCalls?: true;
|
|
1030
|
+
}
|
|
1031
|
+
/** One script environment cell required outside the script statement list. */
|
|
1032
|
+
interface HirGlobalBinding {
|
|
1033
|
+
readonly id: number;
|
|
1034
|
+
readonly name: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* The source name whose unresolvable reference this hidden binding
|
|
1037
|
+
* reports. Present only on a fallback cell no code ever writes, so a
|
|
1038
|
+
* read of it throws the ReferenceError GetValue owes an unresolvable
|
|
1039
|
+
* Reference instead of returning the absent property's `undefined`.
|
|
1040
|
+
*/
|
|
1041
|
+
readonly unresolvableName?: string;
|
|
1042
|
+
}
|
|
1043
|
+
/** One source-located Script lexical name checked against the global object. */
|
|
1044
|
+
interface HirGlobalLexicalName {
|
|
1045
|
+
readonly id?: number;
|
|
1046
|
+
readonly mutable?: boolean;
|
|
1047
|
+
readonly name: string;
|
|
1048
|
+
readonly range: SourceRange;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* One resolved global-object property and the declaration that creates
|
|
1052
|
+
* it. The declaration kind selects between CreateGlobalVarBinding and
|
|
1053
|
+
* CreateGlobalFunctionBinding when the name already has a property.
|
|
1054
|
+
*/
|
|
1055
|
+
interface HirGlobalObjectBinding extends HirGlobalBinding {
|
|
1056
|
+
readonly declaration: "annexb" | "function" | "var";
|
|
1057
|
+
readonly range: SourceRange;
|
|
1058
|
+
}
|
|
1059
|
+
/** A normalized script and its statically callable functions. */
|
|
1060
|
+
interface HirProgram {
|
|
1061
|
+
readonly hostScriptSources?: readonly string[];
|
|
1062
|
+
/**
|
|
1063
|
+
* The distinct `$262.agent.start` source templates of a Script resolved
|
|
1064
|
+
* for the test262 host, in the order resolution met them.
|
|
1065
|
+
*/
|
|
1066
|
+
readonly agentTemplates?: readonly AgentSourceTemplate[];
|
|
1067
|
+
readonly body: readonly HirStatement[];
|
|
1068
|
+
readonly functions: readonly HirFunction[];
|
|
1069
|
+
readonly globalBindings?: readonly HirGlobalBinding[];
|
|
1070
|
+
/** Script lexical names checked against restricted global properties. */
|
|
1071
|
+
readonly globalLexicalNames?: readonly HirGlobalLexicalName[];
|
|
1072
|
+
/**
|
|
1073
|
+
* The hidden global-object capture initialized before any module function
|
|
1074
|
+
* initializer can expose a closure that reads it.
|
|
1075
|
+
*/
|
|
1076
|
+
readonly intrinsicGlobalObjectBindingId?: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* The hidden cell holding this module's `import.meta` object, present
|
|
1079
|
+
* only when the module body reads `import.meta`. The module compiler
|
|
1080
|
+
* initializes it before any module function initializer can expose a
|
|
1081
|
+
* closure that reads it, so every read, including one from a hoisted
|
|
1082
|
+
* function another module calls first, observes the same object.
|
|
1083
|
+
*/
|
|
1084
|
+
readonly importMetaBindingId?: number;
|
|
1085
|
+
/**
|
|
1086
|
+
* The resolved var-scoped top-level bindings a Script's global object
|
|
1087
|
+
* binds as properties, in GlobalDeclarationInstantiation order. Each
|
|
1088
|
+
* entry names the same binding the script statement list writes, so a
|
|
1089
|
+
* property read and a binding read observe one storage location.
|
|
1090
|
+
*/
|
|
1091
|
+
readonly globalObjectBindings?: readonly HirGlobalObjectBinding[];
|
|
1092
|
+
readonly kind: "hir-program";
|
|
1093
|
+
readonly range: SourceRange;
|
|
1094
|
+
readonly sourceId: string;
|
|
1095
|
+
readonly strict?: boolean;
|
|
1096
|
+
}
|
|
1097
|
+
/** Result of profile validation and HIR name resolution. */
|
|
1098
|
+
interface HirResult {
|
|
1099
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
1100
|
+
readonly program?: HirProgram;
|
|
1101
|
+
}
|
|
1102
|
+
interface Binding {
|
|
1103
|
+
/**
|
|
1104
|
+
* True once this name's id names a parameter or the implicit
|
|
1105
|
+
* `arguments` binding that FunctionDeclarationInstantiation already
|
|
1106
|
+
* initialized before a same-name top-level function declaration's own
|
|
1107
|
+
* instantiation step. Set the first time such a declaration reuses the
|
|
1108
|
+
* outer binding, and carried forward by every later redeclaration of
|
|
1109
|
+
* the same name in that scope, since `buildFunctionInits` keeps only
|
|
1110
|
+
* the last one and it still targets that same already-initialized id.
|
|
1111
|
+
*/
|
|
1112
|
+
readonly alreadyInitialized?: true;
|
|
1113
|
+
readonly functionId?: number;
|
|
1114
|
+
readonly functionNameBinding?: boolean;
|
|
1115
|
+
readonly id: number;
|
|
1116
|
+
readonly importedBinding?: boolean;
|
|
1117
|
+
readonly mutable: boolean;
|
|
1118
|
+
readonly name: string;
|
|
1119
|
+
readonly pendingDeclaration?: boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* True for an ordinary, non-async, non-generator function declaration
|
|
1122
|
+
* in non-strict code. Annex B.3.2.4 and B.3.2.5 admit a duplicate name
|
|
1123
|
+
* in one Block or CaseBlock only when every declaration of it is one.
|
|
1124
|
+
*/
|
|
1125
|
+
readonly webLegacyFunction?: true;
|
|
1126
|
+
}
|
|
1127
|
+
interface ResolveState {
|
|
1128
|
+
readonly hostScriptSources?: Set<string> | undefined;
|
|
1129
|
+
/** Immutable lexical aliases initialized from an evalScript property read. */
|
|
1130
|
+
readonly hostScriptAliases?: Set<number> | undefined;
|
|
1131
|
+
readonly hostScriptBindings?: boolean | undefined;
|
|
1132
|
+
/** Optional fragment analysis; absent on the whole-Script path. */
|
|
1133
|
+
readonly globalReferences?: Set<string> | undefined;
|
|
1134
|
+
readonly scriptScope?: ReadonlyMap<string, Binding> | undefined;
|
|
1135
|
+
nextBindingId: number;
|
|
1136
|
+
readonly diagnostics: Diagnostic[];
|
|
1137
|
+
/** Script bindings whose storage is the realm global object's property. */
|
|
1138
|
+
readonly globalObjectBindingIds: Set<number>;
|
|
1139
|
+
readonly functionInfo: Map<SyntaxFunction, {
|
|
1140
|
+
/**
|
|
1141
|
+
* True when `bindingId` names a parameter or the implicit
|
|
1142
|
+
* `arguments` binding that FunctionDeclarationInstantiation already
|
|
1143
|
+
* initialized before this declaration's own instantiation step, so
|
|
1144
|
+
* the function-init statement must write through the existing
|
|
1145
|
+
* binding rather than initialize a fresh one.
|
|
1146
|
+
*/
|
|
1147
|
+
readonly alreadyInitialized?: true;
|
|
1148
|
+
readonly bindingId?: number;
|
|
1149
|
+
readonly id: number;
|
|
1150
|
+
}>;
|
|
1151
|
+
readonly hirFunctions: HirFunction[];
|
|
1152
|
+
/**
|
|
1153
|
+
* The placeholder names an agent program's numeric holes use, mapped to
|
|
1154
|
+
* each hole's index, the byte span of its inserted token, and the number
|
|
1155
|
+
* of identifier reads resolved to it.
|
|
1156
|
+
*/
|
|
1157
|
+
readonly agentHoles?: Map<string, {
|
|
1158
|
+
index: number;
|
|
1159
|
+
reads: number;
|
|
1160
|
+
readonly span: ByteRange;
|
|
1161
|
+
}> | undefined;
|
|
1162
|
+
/**
|
|
1163
|
+
* The `$262.agent.start` templates found so far, keyed by their runs,
|
|
1164
|
+
* when this resolution collects them for the test262 host.
|
|
1165
|
+
*/
|
|
1166
|
+
readonly agentTemplates?: Map<string, AgentSourceTemplate> | undefined;
|
|
1167
|
+
/** The hidden realm global-object cell used by mutable intrinsic reads. */
|
|
1168
|
+
intrinsicGlobalObjectBinding?: Binding | undefined;
|
|
1169
|
+
/**
|
|
1170
|
+
* The hidden cell of this module's `import.meta` object, allocated by
|
|
1171
|
+
* the first read. It stays undefined outside Module code.
|
|
1172
|
+
*/
|
|
1173
|
+
importMetaBinding?: Binding | undefined;
|
|
1174
|
+
/**
|
|
1175
|
+
* Uninitialized cells used only when a mutable intrinsic global no longer
|
|
1176
|
+
* exists. Reading one preserves the ReferenceError of an unresolvable name.
|
|
1177
|
+
*/
|
|
1178
|
+
readonly intrinsicReadFallbacks: Map<string, Binding>;
|
|
1179
|
+
/**
|
|
1180
|
+
* The module table index of each admitted `import()` site in this
|
|
1181
|
+
* source, keyed by the call's start byte. A site absent here keeps the
|
|
1182
|
+
* profile diagnostic.
|
|
1183
|
+
*/
|
|
1184
|
+
readonly importCallTargets?: ReadonlyMap<number, number> | undefined;
|
|
1185
|
+
/** Active labels of the function being resolved; loops accept continue. */
|
|
1186
|
+
readonly labels: {
|
|
1187
|
+
readonly loop: boolean;
|
|
1188
|
+
readonly name: string;
|
|
1189
|
+
}[];
|
|
1190
|
+
/** True while resolving one module's body rather than a Script. */
|
|
1191
|
+
readonly moduleCode: boolean;
|
|
1192
|
+
nextFunctionId: number;
|
|
1193
|
+
readonly sourceId: string;
|
|
1194
|
+
/**
|
|
1195
|
+
* The effective strictness of the code currently being resolved. A
|
|
1196
|
+
* strict all-miss PutValue throws ReferenceError instead of creating
|
|
1197
|
+
* a sloppy global, so with-fallback write classification depends on
|
|
1198
|
+
* it.
|
|
1199
|
+
*/
|
|
1200
|
+
strict: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* Names any non-strict `with` region of this program uses as an
|
|
1203
|
+
* unresolved assignment target whose all-miss path reaches PutValue
|
|
1204
|
+
* without a prior read and still writes a hidden fallback cell: a
|
|
1205
|
+
* simple assignment or a destructuring or loop assignment target
|
|
1206
|
+
* naming a runtime-owned intrinsic or a standard global this profile
|
|
1207
|
+
* has not admitted as a value. Every other such write reaches the
|
|
1208
|
+
* realm global object's property instead. ECMA-262 models the write as
|
|
1209
|
+
* creating a real global binding, which a separately compiled Script
|
|
1210
|
+
* fragment would not observe through the hidden cell, so a fragment
|
|
1211
|
+
* that initializes one falls back to whole-Script compilation. A
|
|
1212
|
+
* compound or logical assignment and an update expression read first
|
|
1213
|
+
* and throw before any write, so they never enter this set.
|
|
1214
|
+
*/
|
|
1215
|
+
readonly withInitializingFallbackNames: Set<string>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Every binding a name reference has resolved to so far, read or
|
|
1218
|
+
* written. A function whose implicit `arguments` binding never appears
|
|
1219
|
+
* here, and that declares no `arguments` of its own, skips creating the
|
|
1220
|
+
* object: the profile rejects direct eval, so no other path reaches it.
|
|
1221
|
+
*/
|
|
1222
|
+
readonly referencedBindingIds: Set<number>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Hidden fallback bindings owned by each currently resolved `with`
|
|
1225
|
+
* statement, ordered outermost first.
|
|
1226
|
+
*/
|
|
1227
|
+
readonly withFallbacks: Map<string, Binding>[];
|
|
1228
|
+
/** Empty scope markers mapped to their hidden object binding identity. */
|
|
1229
|
+
readonly withScopes: Map<Map<string, Binding>, number>;
|
|
1230
|
+
/**
|
|
1231
|
+
* The scope that holds the var-scoped bindings of the function body or
|
|
1232
|
+
* Script being resolved: the body's top-level scope, the synthetic
|
|
1233
|
+
* Block of a body with a parameter environment, or the Script scope.
|
|
1234
|
+
* An Annex B.3.2 copy writes its binding there directly.
|
|
1235
|
+
*/
|
|
1236
|
+
varScope?: ReadonlyMap<string, Binding> | undefined;
|
|
1237
|
+
/**
|
|
1238
|
+
* The derived constructor `this` binding in scope, if any. It reaches
|
|
1239
|
+
* every arrow function nested in that constructor and stops at the next
|
|
1240
|
+
* function that provides its own receiver.
|
|
1241
|
+
*/
|
|
1242
|
+
thisBinding?: HirClassThisBinding | undefined;
|
|
1243
|
+
}
|
|
1244
|
+
//#endregion
|
|
1245
|
+
export { Binding, ErrorIntrinsicName, HirArrayBindingPattern, HirArrayElement, HirArraySpreadElement, HirAssignmentMemberTarget, HirAssignmentPrivateTarget, HirBindingElement, HirBindingIdentifier, HirBindingPattern, HirBindingTarget, HirCallArgument, HirCallTarget, HirClassElement, HirClassField, HirClassMethod, HirClassNameBinding, HirClassStaticBlock, HirClassThisBinding, HirExpression, HirForBindingDeclaration, HirForDeclaration, HirForInTarget, HirForOfTarget, HirForPatternDeclaration, HirFunction, HirGlobalBinding, HirGlobalLexicalName, HirGlobalObjectBinding, HirGlobalRead, HirGlobalReference, HirObjectBindingPattern, HirObjectBindingProperty, HirObjectDefinition, HirObjectProperty, HirObjectSpreadProperty, HirOptionalChainLink, HirParameter, HirPrivateName, HirPrivateNameKey, HirProgram, HirRegExpLiteral, HirResult, HirSpreadArgument, HirStatement, HirStrictGlobalFallback, HirSwitchCase, HirTemplateObject, HirWithBindingReference, HirWithDeleteReference, HirWithGlobalObjectFallback, HirWithReference, IntrinsicGlobalKind, ResolveState, anonymousDefinition, errorIntrinsicName, importMetaName, intrinsicGlobalKind, intrinsicGlobalObjectName, isStandardGlobalName, isTypedArrayIntrinsicName };
|
|
1246
|
+
//# sourceMappingURL=hir.d.ts.map
|