AST class reference

Statement classes

This table lists subclasses of Stmt representing ECMAScript and TypeScript statements.

Statement syntax QL class Superclasses Remarks
Expr ; ExprStmt    
Label : Stmt LabeledStmt    
; EmptyStmt    
break Label ; BreakStmt JumpStmt, BreakOrContinueStmt  
case Expr : Stmt... Case   can only occur as child of a SwitchStmt
catch( Identifier ) { Stmt... } CatchClause ControlStmt can only occur as child of a TryStmt
class Identifier extends Expr { MemberDeclaration... } ClassDeclStmt ClassDefinition, ClassOrInterface, TypeParameterized  
const Identifier = Expr ; ConstDeclStmt DeclStmt  
continue Label ; ContinueStmt JumpStmt, BreakOrContinueStmt  
debugger; DebuggerStmt    
declare global { Stmt... } GlobalAugmentationDeclaration    
declare module StringLiteral { Stmt... } ExternalModuleDeclaration    
default: Stmt... Case   can only occur as child of a SwitchStmt; use isDefault to distinguish default from case
do Stmt while ( Expr ) DoWhileStmt ControlStmt, LoopStmt  
enum Identifier { MemberDeclaration... } EnumDeclaration NamespaceDefinition  
export * from StringLiteral BulkReExportDeclaration ReExportDeclaration, ExportDeclaration  
export default ClassDeclStmt ExportDefaultDeclaration ExportDeclaration  
export default Expr ; ExportDefaultDeclaration ExportDeclaration  
export default FunctionDeclStmt ExportDefaultDeclaration ExportDeclaration  
export { ExportSpecifier... }; ExportNamedDeclaration ExportDeclaration  
export DeclStmt ExportNamedDeclaration ExportDeclaration  
export = Expr ; ExportAssignDeclaration    
export as namespace Identifier ; ExportAsNamespaceDeclaration    
for ( Expr ; Expr ; Expr ) Stmt ForStmt ControlStmt, LoopStmt  
for ( VarAccess in Expr ) Stmt ForInStmt ControlStmt, LoopStmt, EnhancedForLoop  
for ( VarAccess of Expr ) Stmt ForOfStmt ControlStmt, LoopStmt, EnhancedForLoop  
function Identifier ( Parameter... ) { Stmt... } FunctionDeclStmt Function  
if ( Expr ) Stmt else Stmt IfStmt ControlStmt  
import { ImportSpecifier... from StringLiteral ImportDeclaration Import  
import Identifier = Expr ; ImportEqualsDeclaration    
interface Identifier { MemberDeclaration... } InterfaceDeclaration InterfaceDefinition, ClassOrInterface, TypeParameterized  
let Identifier = Expr ; LetStmt DeclStmt  
namespace Identifier { Stmt... } NamespaceDeclaration NamespaceDefinition  
return Expr ; ReturnStmt JumpStmt  
switch ( Expr ) { Case... } SwitchStmt ControlStmt  
throw Expr ; ThrowStmt JumpStmt  
try { Stmt... } CatchClause... finally { Stmt... } TryStmt ControlStmt  
type Identifier = TypeExpr ; TypeAliasDeclaration TypeParameterized  
var Identifier = Expr ; VarDeclStmt DeclStmt  
while ( Expr ) Stmt WhileStmt ControlStmt, LoopStmt  
with ( Expr ) Stmt WithStmt ControlStmt  
{ Stmt... } BlockStmt    

Expression classes

There is a large number of expression classes, so we present them by category. All classes in this section are subclasses of Expr, except where noted otherwise.

Literals

All classes in this subsection are subclasses of Literal.

Expression syntax QL class
true BooleanLiteral
23 NumberLiteral
4.2 NumberLiteral
"Hello" StringLiteral
/ab*c?/ RegExpLiteral
null NullLiteral

Identifiers

All identifiers are represented by the QL class Identifier, which has subclasses to represent specific kinds of identifiers:

  • VarAccess: an identifier that refers to a variable
  • VarDecl: an identifier that declares a variable, for example x in var x = "hi" or in function(x) { }
  • VarRef: a VarAccess or a VarDecl
  • Label: an identifier that refers to a statement label or a property, not a variable; in the following examples, l and p are labels:
    • break l;
    • l: for(;;) {}
    • x.p
    • { p: 42 }

Primary expressions

All classes in this subsection are subclasses of Expr.

Expression syntax QL class Superclasses Remarks
this ThisExpr    
[ Expr... ] ArrayExpr    
{ Property... } ObjectExpr    
function ( Parameter... ) { Stmt... } FunctionExpr Function  
( Parameter... ) => Expr ArrowFunctionExpr Function  
( Expr ) ParExpr    
` ... ` TemplateLiteral   an element in a TemplateLiteral is either a TemplateElement representing a constant template element, or some other expression representing an interpolated expression of the form ${ Expr }
Expr ` ... ` TaggedTemplateExpr   an element in a TaggedTemplateExpr is either a TemplateElement representing a constant template element, or some other expression representing an interpolated expression of the form ${ Expr }

Properties

All classes in this subsection are subclasses of Property. Note that Property is not a subclass of Expr.

Property syntax QL class Superclasses
Identifier : Expr ValueProperty  
get Identifier () { Stmt... } PropertyGetter PropertyAccessor
set Identifier ( Identifier ) { Stmt... } PropertySetter PropertyAccessor

Property accesses

All classes in this subsection are subclasses of PropAccess.

Expression syntax QL class
Expr . Identifier DotExpr
Expr [ Expr ] IndexExpr

Function calls and new

All classes in this subsection are subclasses of InvokeExpr.

Expression syntax QL class Remarks
Expr ( Expr... ) CallExpr  
Expr . Identifier ( Expr... ) MethodCallExpr this also includes calls of the form Expr [ Expr ] ( Expr... )
new Expr ( Expr... ) NewExpr  

Unary expressions

All classes in this subsection are subclasses of UnaryExpr.

Expression syntax QL class
~ Expr BitNotExpr
- Expr NegExpr
+ Expr PlusExpr
! Expr LogNotExpr
typeof Expr TypeofExpr
void Expr VoidExpr
delete Expr DeleteExpr
... Expr SpreadElement

Update expressions

All classes in this table are subclasses of UpdateExpr.

Expression syntax QL class
Expr ++ PostIncExpr
Expr -- PostDecExpr
++ Expr PreIncExpr
-- Expr PreDecExpr

Miscellaneous

All classes in this table are subclasses of Expr.

Expression syntax QL class
Expr ? Expr : Expr ConditionalExpr
Expr , ... , Expr SeqExpr
await Expr AwaitExpr
yield Expr YieldExpr