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