import type { Expression } from "./expression"; import type { VariableIdentifier } from "./identifier"; import type { Pattern, RestablePattern } from "./pattern"; import type { BlockStatement } from "./statement"; export type FunctionExpression = X & { type: "FunctionExpression"; id: VariableIdentifier | null; async: boolean; generator: boolean; params: RestablePattern[]; body: BlockStatement; }; export type ConstructorFunctionExpression = FunctionExpression & { id: null; async: false; generator: false; }; export type MethodFunctionExpression = FunctionExpression & { id: null; }; export type GetterFunctionExpression = FunctionExpression & { id: null; async: false; generator: false; params: []; }; export type SetterFunctionExpression = FunctionExpression & { id: null; async: false; generator: false; params: [Pattern]; }; export type ArrowFunctionExpression = | ExpressionArrowFunctionExpression | BlockArrowFunctionExpression; export type ExpressionArrowFunctionExpression = X & { type: "ArrowFunctionExpression"; id: null; async: boolean; generator: false; params: RestablePattern[]; expression: true; body: Expression; }; export type BlockArrowFunctionExpression = X & { type: "ArrowFunctionExpression"; id: null; async: boolean; generator: false; params: RestablePattern[]; expression: false; body: BlockStatement; }; export type FunctionDeclaration = X & { type: "FunctionDeclaration"; params: RestablePattern[]; id: VariableIdentifier; generator: boolean; async: boolean; body: BlockStatement; }; export type AnonymousFunctionDeclaration = X & { type: "FunctionDeclaration"; params: RestablePattern[]; id: null; generator: boolean; async: boolean; body: BlockStatement; };