forked from kannanvijayan-zz/binjs-ts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
es6.webidl
911 lines (755 loc) · 23.8 KB
/
es6.webidl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
// Type aliases and enums.
typedef FrozenArray<(SpreadElement or Expression)> Arguments;
typedef DOMString string;
typedef string Identifier;
typedef string IdentifierName;
typedef string Label;
enum VariableDeclarationKind {
"var",
"let",
"const"
};
enum CompoundAssignmentOperator {
"+=",
"-=",
"*=",
"/=",
"%=",
"**=",
"<<=",
">>=",
">>>=",
"|=",
"^=",
"&="
};
enum BinaryOperator {
",",
"||",
"&&",
"|",
"^",
"&",
"==",
"!=",
"===",
"!==",
"<",
"<=",
">",
">=",
"in",
"instanceof",
"<<",
">>",
">>>",
"+",
"-",
"*",
"/",
"%",
"**",
};
enum UnaryOperator {
"+",
"-",
"!",
"~",
"typeof",
"void",
"delete"
};
enum UpdateOperator {
"++",
"--"
};
// deferred assertions
interface AssertedBlockScope {
// checked eagerly during transformation
attribute FrozenArray<IdentifierName> lexicallyDeclaredNames;
// checked lazily as inner functions are invoked
attribute FrozenArray<IdentifierName> capturedNames;
attribute boolean hasDirectEval;
};
interface AssertedVarScope {
// checked eagerly during transformation
attribute FrozenArray<IdentifierName> lexicallyDeclaredNames;
attribute FrozenArray<IdentifierName> varDeclaredNames;
// checked lazily as inner functions are invoked
attribute FrozenArray<IdentifierName> capturedNames;
attribute boolean hasDirectEval;
};
interface AssertedParameterScope {
// checked eagerly during transformation
attribute FrozenArray<IdentifierName> parameterNames;
// checked lazily as inner functions are invoked
attribute FrozenArray<IdentifierName> capturedNames;
attribute boolean hasDirectEval;
};
// nodes
interface Node {
[TypeIndicator] readonly attribute Type type;
};
typedef (Script or Module) Program;
typedef (DoWhileStatement or
ForInStatement or
ForOfStatement or
ForStatement or
WhileStatement)
IterationStatement;
typedef (Block or
BreakStatement or
ContinueStatement or
ClassDeclaration or
DebuggerStatement or
EmptyStatement or
ExpressionStatement or
FunctionDeclaration or
IfStatement or
IterationStatement or
LabelledStatement or
ReturnStatement or
SwitchStatement or
SwitchStatementWithDefault or
ThrowStatement or
TryCatchStatement or
TryFinallyStatement or
VariableDeclaration or
WithStatement)
Statement;
typedef (LiteralBooleanExpression or
LiteralInfinityExpression or
LiteralNullExpression or
LiteralNumericExpression or
LiteralStringExpression)
Literal;
typedef (Literal or
LiteralRegExpExpression or
ArrayExpression or
ArrowExpression or
AssignmentExpression or
BinaryExpression or
CallExpression or
CompoundAssignmentExpression or
ComputedMemberExpression or
ConditionalExpression or
ClassExpression or
FunctionExpression or
IdentifierExpression or
NewExpression or
NewTargetExpression or
ObjectExpression or
UnaryExpression or
StaticMemberExpression or
TemplateExpression or
ThisExpression or
UpdateExpression or
YieldExpression or
YieldStarExpression or
AwaitExpression)
Expression;
typedef (ComputedPropertyName or
LiteralPropertyName)
PropertyName;
typedef (Method or Getter or Setter) MethodDefinition;
typedef (MethodDefinition or
DataProperty or
ShorthandProperty)
ObjectProperty;
typedef (ExportAllFrom or
ExportFrom or
ExportLocals or
ExportDefault or
Export)
ExportDeclaration;
typedef (ImportNamespace or Import) ImportDeclaration;
typedef (EagerFunctionDeclaration or SkippableFunctionDeclaration) FunctionDeclaration;
typedef (EagerFunctionExpression or SkippableFunctionExpression) FunctionExpression;
typedef (EagerMethod or SkippableMethod) Method;
typedef (EagerGetter or SkippableGetter) Getter;
typedef (EagerSetter or SkippableSetter) Setter;
typedef (EagerArrowExpression or SkippableArrowExpression) ArrowExpression;
// bindings
interface BindingIdentifier : Node {
attribute Identifier name;
};
typedef (ObjectBinding or
ArrayBinding)
BindingPattern;
typedef (BindingPattern or
BindingIdentifier)
Binding;
typedef (AssignmentTargetIdentifier or
ComputedMemberAssignmentTarget or
StaticMemberAssignmentTarget)
SimpleAssignmentTarget;
typedef (ObjectAssignmentTarget or
ArrayAssignmentTarget)
AssignmentTargetPattern;
// `DestructuringAssignmentTarget`
typedef (AssignmentTargetPattern or
SimpleAssignmentTarget)
AssignmentTarget;
// `FormalParameter`
typedef (Binding or
BindingWithInitializer)
Parameter;
interface BindingWithInitializer : Node {
attribute Binding binding;
attribute Expression init;
};
interface AssignmentTargetIdentifier : Node {
attribute Identifier name;
};
interface ComputedMemberAssignmentTarget : Node {
// The object whose property is being assigned.
attribute (Expression or Super) _object;
// The expression resolving to the name of the property to be accessed.
attribute Expression expression;
};
interface StaticMemberAssignmentTarget : Node {
// The object whose property is being assigned.
attribute (Expression or Super) _object;
// The name of the property to be accessed.
attribute IdentifierName property;
};
// `ArrayBindingPattern`
interface ArrayBinding : Node {
// The elements of the array pattern; a null value represents an elision.
attribute FrozenArray<(Binding or BindingWithInitializer)?> elements;
attribute Binding? rest;
};
// `SingleNameBinding`
interface BindingPropertyIdentifier : Node {
attribute BindingIdentifier binding;
attribute Expression? init;
};
// `BindingProperty :: PropertyName : BindingElement`
interface BindingPropertyProperty : Node {
attribute PropertyName name;
attribute (Binding or BindingWithInitializer) binding;
};
typedef (BindingPropertyIdentifier or
BindingPropertyProperty)
BindingProperty;
interface ObjectBinding : Node {
attribute FrozenArray<BindingProperty> properties;
};
// This interface represents the case where the initializer is present in
// `AssignmentElement :: DestructuringAssignmentTarget Initializer_opt`.
interface AssignmentTargetWithInitializer : Node {
attribute AssignmentTarget binding;
attribute Expression init;
};
// `ArrayAssignmentPattern`
interface ArrayAssignmentTarget : Node {
// The elements of the array pattern; a null value represents an elision.
attribute FrozenArray<(AssignmentTarget or AssignmentTargetWithInitializer?)> elements;
attribute AssignmentTarget? rest;
};
// `AssignmentProperty :: IdentifierReference Initializer_opt`
interface AssignmentTargetPropertyIdentifier : Node {
attribute AssignmentTargetIdentifier binding;
attribute Expression? init;
};
// `AssignmentProperty :: PropertyName : Node`
interface AssignmentTargetPropertyProperty : Node {
attribute PropertyName name;
attribute (AssignmentTarget or AssignmentTargetWithInitializer) binding;
};
typedef (AssignmentTargetPropertyIdentifier or
AssignmentTargetPropertyProperty)
AssignmentTargetProperty;
// `ObjectAssignmentPattern`
interface ObjectAssignmentTarget : Node {
attribute FrozenArray<AssignmentTargetProperty> properties;
};
// classes
interface ClassExpression : Node {
attribute BindingIdentifier? name;
attribute Expression? super;
attribute FrozenArray<ClassElement> elements;
};
interface ClassDeclaration : Node {
attribute BindingIdentifier name;
attribute Expression? super;
attribute FrozenArray<ClassElement> elements;
};
interface ClassElement : Node {
// True iff `IsStatic` of ClassElement is true.
attribute boolean isStatic;
attribute MethodDefinition method;
};
// modules
interface Module : Node {
attribute AssertedVarScope? scope;
attribute FrozenArray<Directive> directives;
attribute FrozenArray<(ImportDeclaration or ExportDeclaration or Statement)> items;
};
// An `ImportDeclaration` not including a namespace import.
interface Import : Node {
attribute string moduleSpecifier;
// `ImportedDefaultBinding`, if present.
attribute BindingIdentifier? defaultBinding;
attribute FrozenArray<ImportSpecifier> namedImports;
};
// An `ImportDeclaration` including a namespace import.
interface ImportNamespace : Node {
attribute string moduleSpecifier;
// `ImportedDefaultBinding`, if present.
attribute BindingIdentifier? defaultBinding;
attribute BindingIdentifier namespaceBinding;
};
interface ImportSpecifier : Node {
// The `IdentifierName` in the production `ImportSpecifier :: IdentifierName as ImportedBinding`;
// absent if this specifier represents the production `ImportSpecifier :: ImportedBinding`.
attribute IdentifierName? name;
attribute BindingIdentifier binding;
};
// `export * FromClause;`
interface ExportAllFrom : Node {
attribute string moduleSpecifier;
};
// `export ExportClause FromClause;`
interface ExportFrom : Node {
attribute FrozenArray<ExportFromSpecifier> namedExports;
attribute string moduleSpecifier;
};
// `export ExportClause;`
interface ExportLocals : Node {
attribute FrozenArray<ExportLocalSpecifier> namedExports;
};
// `export VariableStatement`, `export Declaration`
interface Export : Node {
attribute (FunctionDeclaration or ClassDeclaration or VariableDeclaration) declaration;
};
// `export default HoistableDeclaration`,
// `export default ClassDeclaration`,
// `export default AssignmentExpression`
interface ExportDefault : Node {
attribute (FunctionDeclaration or ClassDeclaration or Expression) body;
};
// `ExportSpecifier`, as part of an `ExportFrom`.
interface ExportFromSpecifier : Node {
// The only `IdentifierName in `ExportSpecifier :: IdentifierName`,
// or the first in `ExportSpecifier :: IdentifierName as IdentifierName`.
attribute IdentifierName name;
// The second `IdentifierName` in `ExportSpecifier :: IdentifierName as IdentifierName`,
// if that is the production represented.
attribute IdentifierName? exportedName;
};
// `ExportSpecifier`, as part of an `ExportLocals`.
interface ExportLocalSpecifier : Node {
// The only `IdentifierName in `ExportSpecifier :: IdentifierName`,
// or the first in `ExportSpecifier :: IdentifierName as IdentifierName`.
attribute IdentifierExpression name;
// The second `IdentifierName` in `ExportSpecifier :: IdentifierName as IdentifierName`, if present.
attribute IdentifierName? exportedName;
};
// property definition
// `MethodDefinition :: PropertyName ( UniqueFormalParameters ) { FunctionBody }`,
// `GeneratorMethod :: * PropertyName ( UniqueFormalParameters ) { GeneratorBody }`,
// `AsyncMethod :: async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }`
interface EagerMethod : Node {
// True for `AsyncMethod`, false otherwise.
attribute boolean isAsync;
// True for `GeneratorMethod`, false otherwise.
attribute boolean isGenerator;
attribute PropertyName name;
attribute AssertedParameterScope? parameterScope;
attribute AssertedVarScope? bodyScope;
// The `UniqueFormalParameters`.
attribute FormalParameters params;
attribute FunctionBody body;
};
[Skippable] interface SkippableMethod : Node {
attribute EagerMethod skipped;
};
// `get PropertyName ( ) { FunctionBody }`
interface EagerGetter : Node {
attribute PropertyName name;
attribute AssertedVarScope? bodyScope;
attribute FunctionBody body;
};
[Skippable] interface SkippableGetter : Node {
attribute EagerGetter skipped;
};
// `set PropertyName ( PropertySetParameterList ) { FunctionBody }`
interface EagerSetter : Node {
attribute PropertyName name;
attribute AssertedParameterScope? parameterScope;
attribute AssertedVarScope? bodyScope;
// The `PropertySetParameterList`.
attribute Parameter param;
attribute FunctionBody body;
};
[Skippable] interface SkippableSetter : Node {
attribute EagerSetter skipped;
};
// `PropertyDefinition :: PropertyName : AssignmentExpression`
interface DataProperty : Node {
attribute PropertyName name;
// The `AssignmentExpression`.
attribute Expression expression;
};
// `PropertyDefinition :: IdentifierReference`
interface ShorthandProperty : Node {
// The `IdentifierReference`.
attribute IdentifierExpression name;
};
interface ComputedPropertyName : Node {
attribute Expression expression;
};
// `LiteralPropertyName`
interface LiteralPropertyName : Node {
attribute string value;
};
// literals
// `BooleanLiteral`
interface LiteralBooleanExpression : Node {
attribute boolean value;
};
// A `NumericLiteral` for which the Number value of its MV is positive infinity.
interface LiteralInfinityExpression : Node { };
// `NullLiteral`
interface LiteralNullExpression : Node { };
// `NumericLiteral`
interface LiteralNumericExpression : Node {
attribute double value;
};
// `RegularExpressionLiteral`
interface LiteralRegExpExpression : Node {
attribute string pattern;
attribute string flags;
};
// `StringLiteral`
interface LiteralStringExpression : Node {
attribute string value;
};
// other expressions
// `ArrayLiteral`
interface ArrayExpression : Node {
// The elements of the array literal; a null value represents an elision.
attribute FrozenArray<(SpreadElement or Expression)?> elements;
};
// `ArrowFunction`,
// `AsyncArrowFunction`
interface EagerArrowExpression : Node {
// True for `AsyncArrowFunction`, false otherwise.
attribute boolean isAsync;
attribute AssertedParameterScope? parameterScope;
attribute AssertedVarScope? bodyScope;
attribute FormalParameters params;
attribute (FunctionBody or Expression) body;
};
[Skippable] interface SkippableArrowExpression : Node {
attribute EagerArrowExpression skipped;
};
// `AssignmentExpression :: LeftHandSideExpression = AssignmentExpression`
interface AssignmentExpression : Node {
// The `LeftHandSideExpression`.
attribute AssignmentTarget binding;
// The `AssignmentExpression` following the `=`.
attribute Expression expression;
};
// `ExponentiationExpression`,
// `MultiplicativeExpression`,
// `AdditiveExpression`,
// `ShiftExpression`,
// `RelationalExpression`,
// `EqualityExpression`,
// `BitwiseANDExpression`,
// `BitwiseXORExpression`,
// `BitwiseORExpression`,
// `LogicalANDExpression`,
// `LogicalORExpression`
interface BinaryExpression : Node {
attribute BinaryOperator operator;
// The expression before the operator.
attribute Expression left;
// The expression after the operator.
attribute Expression right;
};
interface CallExpression : Node {
attribute (Expression or Super) callee;
attribute Arguments arguments;
};
// `AssignmentExpression :: LeftHandSideExpression AssignmentOperator AssignmentExpression`
interface CompoundAssignmentExpression : Node {
attribute CompoundAssignmentOperator operator;
// The `LeftHandSideExpression`.
attribute SimpleAssignmentTarget binding;
// The `AssignmentExpression`.
attribute Expression expression;
};
interface ComputedMemberExpression : Node {
// The object whose property is being accessed.
attribute (Expression or Super) _object;
// The expression resolving to the name of the property to be accessed.
attribute Expression expression;
};
// `ConditionalExpression :: LogicalORExpression ? AssignmentExpression : AssignmentExpression`
interface ConditionalExpression : Node {
// The `LogicalORExpression`.
attribute Expression test;
// The first `AssignmentExpression`.
attribute Expression consequent;
// The second `AssignmentExpression`.
attribute Expression alternate;
};
// `FunctionExpression`,
// `GeneratorExpression`,
// `AsyncFunctionExpression`,
interface EagerFunctionExpression : Node {
attribute boolean isAsync;
attribute boolean isGenerator;
attribute BindingIdentifier? name;
attribute AssertedParameterScope? parameterScope;
attribute AssertedVarScope? bodyScope;
attribute FormalParameters params;
attribute FunctionBody body;
};
[Skippable] interface SkippableFunctionExpression : Node {
attribute EagerFunctionExpression skipped;
};
// `IdentifierReference`
interface IdentifierExpression : Node {
attribute Identifier name;
};
interface NewExpression : Node {
attribute Expression callee;
attribute Arguments arguments;
};
interface NewTargetExpression : Node { };
interface ObjectExpression : Node {
attribute FrozenArray<ObjectProperty> properties;
};
interface UnaryExpression : Node {
attribute UnaryOperator operator;
attribute Expression operand;
};
interface StaticMemberExpression : Node {
// The object whose property is being accessed.
attribute (Expression or Super) _object;
// The name of the property to be accessed.
attribute IdentifierName property;
};
// `TemplateLiteral`,
// `MemberExpression :: MemberExpression TemplateLiteral`,
// `CallExpression : CallExpression TemplateLiteral`
interface TemplateExpression : Node {
// The second `MemberExpression` or `CallExpression`, if present.
attribute Expression? tag;
// The contents of the template. This list must be alternating
// TemplateElements and Expressions, beginning and ending with
// TemplateElement.
attribute FrozenArray<(Expression or TemplateElement)> elements;
};
// `PrimaryExpression :: this`
interface ThisExpression : Node { };
// `UpdateExpression :: LeftHandSideExpression ++`,
// `UpdateExpression :: LeftHandSideExpression --`,
// `UpdateExpression :: ++ LeftHandSideExpression`,
// `UpdateExpression :: -- LeftHandSideExpression`
interface UpdateExpression : Node {
// True for `UpdateExpression :: ++ LeftHandSideExpression` and
// `UpdateExpression :: -- LeftHandSideExpression`, false otherwise.
attribute boolean isPrefix;
attribute UpdateOperator operator;
attribute SimpleAssignmentTarget operand;
};
// `YieldExpression :: yield`,
// `YieldExpression :: yield AssignmentExpression`
interface YieldExpression : Node {
// The `AssignmentExpression`, if present.
attribute Expression? expression;
};
// `YieldExpression :: yield * AssignmentExpression`
interface YieldStarExpression : Node {
attribute Expression expression;
};
interface AwaitExpression : Node {
attribute Expression expression;
};
// other statements
interface BreakStatement : Node {
attribute Label? label;
};
interface ContinueStatement : Node {
attribute Label? label;
};
interface DebuggerStatement : Node { };
interface DoWhileStatement : Node {
attribute Expression test;
attribute Statement body;
};
interface EmptyStatement : Node { };
interface ExpressionStatement : Node {
attribute Expression expression;
};
interface ForInOfBinding : Node {
attribute VariableDeclarationKind kind;
attribute Binding binding;
};
// `for ( LeftHandSideExpression in Expression ) Statement`,
// `for ( var ForBinding in Expression ) Statement`,
// `for ( ForDeclaration in Expression ) Statement`,
// `for ( var BindingIdentifier Initializer in Expression ) Statement`
interface ForInStatement : Node {
// The expression or declaration before `in`.
attribute (ForInOfBinding or AssignmentTarget) left;
// The expression after `in`.
attribute Expression right;
attribute Statement body;
};
// `for ( LeftHandSideExpression of Expression ) Statement`,
// `for ( var ForBinding of Expression ) Statement`,
// `for ( ForDeclaration of Expression ) Statement`
interface ForOfStatement : Node {
// The expression or declaration before `of`.
attribute (ForInOfBinding or AssignmentTarget) left;
// The expression after `of`.
attribute Expression right;
attribute Statement body;
};
// `for ( Expression ; Expression ; Expression ) Statement`,
// `for ( var VariableDeclarationList ; Expression ; Expression ) Statement`
interface ForStatement : Node {
// The expression or declaration before the first `;`, if present.
attribute (VariableDeclaration or Expression)? init;
// The expression before the second `;`, if present
attribute Expression? test;
// The expression after the second `;`, if present
attribute Expression? update;
attribute Statement body;
};
// `if ( Expression ) Statement`,
// `if ( Expression ) Statement else Statement`,
interface IfStatement : Node {
attribute Expression test;
// The first `Statement`.
attribute Statement consequent;
// The second `Statement`, if present.
attribute Statement? alternate;
};
interface LabelledStatement : Node {
attribute Label label;
attribute Statement body;
};
interface ReturnStatement : Node {
attribute Expression? expression;
};
// A `SwitchStatement` whose `CaseBlock` is
// `CaseBlock :: { CaseClauses }`.
interface SwitchStatement : Node {
attribute Expression discriminant;
attribute FrozenArray<SwitchCase> cases;
};
// A `SwitchStatement` whose `CaseBlock` is
// `CaseBlock :: { CaseClauses DefaultClause CaseClauses }`.
interface SwitchStatementWithDefault : Node {
attribute Expression discriminant;
// The `CaseClauses` before the `DefaultClause`.
attribute FrozenArray<SwitchCase> preDefaultCases;
// The `DefaultClause`.
attribute SwitchDefault defaultCase;
// The `CaseClauses` after the `DefaultClause`.
attribute FrozenArray<SwitchCase> postDefaultCases;
};
interface ThrowStatement : Node {
attribute Expression expression;
};
// `TryStatement :: try Block Catch`
interface TryCatchStatement : Node {
attribute Block body;
attribute CatchClause catchClause;
};
// `TryStatement :: try Block Finally`,
// `TryStatement :: try Block Catch Finally`
interface TryFinallyStatement : Node {
// The `Block`.
attribute Block body;
// The `Catch`, if present.
attribute CatchClause? catchClause;
// The `Finally`.
attribute Block finalizer;
};
interface WhileStatement : Node {
attribute Expression test;
attribute Statement body;
};
interface WithStatement : Node {
attribute Expression _object;
attribute Statement body;
};
// other nodes
interface Block : Node {
attribute AssertedBlockScope? scope;
attribute FrozenArray<Statement> statements;
};
// `Catch`
interface CatchClause : Node {
// `AssertedParameterScope` is used for catch bindings so the declared names
// are checked using BoundNames.
attribute AssertedParameterScope? bindingScope;
attribute Binding binding;
attribute Block body;
};
// An item in a `DirectivePrologue`
interface Directive : Node {
attribute string rawValue;
};
interface FormalParameters : Node {
attribute FrozenArray<Parameter> items;
attribute Binding? rest;
};
interface FunctionBody : Node {
attribute FrozenArray<Directive> directives;
attribute FrozenArray<Statement> statements;
};
// `FunctionDeclaration`,
// `GeneratorDeclaration`,
// `AsyncFunctionDeclaration`
interface EagerFunctionDeclaration : Node {
attribute boolean isAsync;
attribute boolean isGenerator;
attribute BindingIdentifier name;
attribute AssertedParameterScope? parameterScope;
attribute AssertedVarScope? bodyScope;
attribute FormalParameters params;
attribute FunctionBody body;
};
[Skippable] interface SkippableFunctionDeclaration : Node {
attribute EagerFunctionDeclaration skipped;
};
interface Script : Node {
attribute AssertedVarScope? scope;
attribute FrozenArray<Directive> directives;
attribute FrozenArray<Statement> statements;
};
interface SpreadElement : Node {
attribute Expression expression;
};
// `super`
interface Super : Node { };
// `CaseClause`
interface SwitchCase : Node {
attribute Expression test;
attribute FrozenArray<Statement> consequent;
};
// `DefaultClause`
interface SwitchDefault : Node {
attribute FrozenArray<Statement> consequent;
};
// `TemplateCharacters`
interface TemplateElement : Node {
attribute string rawValue;
};
interface VariableDeclaration : Node {
attribute VariableDeclarationKind kind;
[NonEmpty] attribute FrozenArray<VariableDeclarator> declarators;
};
interface VariableDeclarator : Node {
attribute Binding binding;
attribute Expression? init;
};