mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
13293 lines
567 KiB
Go
13293 lines
567 KiB
Go
// Code generated by _scripts/generate-go-ast.ts. DO NOT EDIT.
|
|
|
|
package ast
|
|
|
|
import (
|
|
"sync/atomic"
|
|
"unsafe"
|
|
|
|
"github.com/microsoft/typescript-go/internal/core"
|
|
)
|
|
|
|
var (
|
|
_ = core.Same[string] // prevent unused import
|
|
_ atomic.Uint32 // prevent unused import
|
|
)
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NodeFactory
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NodeFactory struct {
|
|
hooks NodeFactoryHooks
|
|
arrayTypeNodeArena core.Arena[ArrayTypeNode]
|
|
binaryExpressionArena core.Arena[BinaryExpression]
|
|
blockArena core.Arena[Block]
|
|
callExpressionArena core.Arena[CallExpression]
|
|
conditionalExpressionArena core.Arena[ConditionalExpression]
|
|
constructSignatureDeclarationArena core.Arena[ConstructSignatureDeclaration]
|
|
elementAccessExpressionArena core.Arena[ElementAccessExpression]
|
|
expressionStatementArena core.Arena[ExpressionStatement]
|
|
expressionWithTypeArgumentsArena core.Arena[ExpressionWithTypeArguments]
|
|
functionDeclarationArena core.Arena[FunctionDeclaration]
|
|
functionTypeNodeArena core.Arena[FunctionTypeNode]
|
|
heritageClauseArena core.Arena[HeritageClause]
|
|
identifierArena core.Arena[Identifier]
|
|
ifStatementArena core.Arena[IfStatement]
|
|
importSpecifierArena core.Arena[ImportSpecifier]
|
|
indexedAccessTypeNodeArena core.Arena[IndexedAccessTypeNode]
|
|
interfaceDeclarationArena core.Arena[InterfaceDeclaration]
|
|
intersectionTypeNodeArena core.Arena[IntersectionTypeNode]
|
|
jsdocArena core.Arena[JSDoc]
|
|
jsdocDeprecatedTagArena core.Arena[JSDocDeprecatedTag]
|
|
jsdocTextArena core.Arena[JSDocText]
|
|
jsdocUnknownTagArena core.Arena[JSDocUnknownTag]
|
|
keywordExpressionArena core.Arena[KeywordExpression]
|
|
keywordTypeNodeArena core.Arena[KeywordTypeNode]
|
|
literalTypeNodeArena core.Arena[LiteralTypeNode]
|
|
methodSignatureDeclarationArena core.Arena[MethodSignatureDeclaration]
|
|
modifierListArena core.Arena[ModifierList]
|
|
nodeListArena core.Arena[NodeList]
|
|
numericLiteralArena core.Arena[NumericLiteral]
|
|
parameterDeclarationArena core.Arena[ParameterDeclaration]
|
|
parenthesizedExpressionArena core.Arena[ParenthesizedExpression]
|
|
parenthesizedTypeNodeArena core.Arena[ParenthesizedTypeNode]
|
|
prefixUnaryExpressionArena core.Arena[PrefixUnaryExpression]
|
|
propertyAccessExpressionArena core.Arena[PropertyAccessExpression]
|
|
propertyAssignmentArena core.Arena[PropertyAssignment]
|
|
propertySignatureDeclarationArena core.Arena[PropertySignatureDeclaration]
|
|
returnStatementArena core.Arena[ReturnStatement]
|
|
stringLiteralArena core.Arena[StringLiteral]
|
|
tokenArena core.Arena[Token]
|
|
typeAliasDeclarationArena core.Arena[TypeAliasDeclaration]
|
|
typeLiteralNodeArena core.Arena[TypeLiteralNode]
|
|
typeOperatorNodeArena core.Arena[TypeOperatorNode]
|
|
typeParameterDeclarationArena core.Arena[TypeParameterDeclaration]
|
|
typeReferenceNodeArena core.Arena[TypeReferenceNode]
|
|
unionTypeNodeArena core.Arena[UnionTypeNode]
|
|
variableDeclarationArena core.Arena[VariableDeclaration]
|
|
variableDeclarationListArena core.Arena[VariableDeclarationList]
|
|
variableStatementArena core.Arena[VariableStatement]
|
|
|
|
nodeCount int
|
|
textCount int
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Base struct definitions
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type StatementBase struct {
|
|
NodeBase
|
|
FlowNodeBase
|
|
}
|
|
|
|
type IterationStatementBase struct {
|
|
StatementBase
|
|
Statement *Statement
|
|
}
|
|
|
|
type ExpressionBase struct {
|
|
NodeBase
|
|
}
|
|
|
|
type UnaryExpressionBase struct {
|
|
ExpressionBase
|
|
}
|
|
|
|
type UpdateExpressionBase struct {
|
|
UnaryExpressionBase
|
|
}
|
|
|
|
type LeftHandSideExpressionBase struct {
|
|
UpdateExpressionBase
|
|
}
|
|
|
|
type MemberExpressionBase struct {
|
|
LeftHandSideExpressionBase
|
|
}
|
|
|
|
type PrimaryExpressionBase struct {
|
|
MemberExpressionBase
|
|
}
|
|
|
|
type TypeNodeBase struct {
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
}
|
|
|
|
type NodeWithTypeArgumentsBase struct {
|
|
TypeNodeBase
|
|
TypeArguments *TypeList // Optional
|
|
}
|
|
|
|
type JSDocTypeBase struct {
|
|
TypeNodeBase
|
|
}
|
|
|
|
type DeclarationBase struct {
|
|
Symbol *Symbol
|
|
}
|
|
|
|
type ExportableBase struct {
|
|
LocalSymbol *Symbol
|
|
}
|
|
|
|
type ModifiersBase struct {
|
|
modifiers *ModifierList // Optional
|
|
}
|
|
|
|
type LocalsContainerBase struct {
|
|
Locals SymbolTable
|
|
NextContainer *Node
|
|
}
|
|
|
|
type FlowNodeBase struct {
|
|
FlowNode *FlowNode
|
|
}
|
|
|
|
type CompositeBase struct {
|
|
facts atomic.Uint32
|
|
}
|
|
|
|
type TypeSyntaxBase struct{}
|
|
|
|
type FunctionLikeBase struct {
|
|
LocalsContainerBase
|
|
TypeParameters *TypeParameterList // Optional
|
|
Parameters *ParameterList
|
|
Type *TypeNode // Optional
|
|
FullSignature *TypeNode // Optional
|
|
}
|
|
|
|
type BodyBase struct {
|
|
AsteriskToken *AsteriskToken // Optional
|
|
Body *NodeBody // Optional
|
|
EndFlowNode *FlowNode
|
|
}
|
|
|
|
type FunctionLikeWithBodyBase struct {
|
|
FunctionLikeBase
|
|
BodyBase
|
|
}
|
|
|
|
type ClassLikeBase struct {
|
|
ExportableBase
|
|
ModifiersBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
name *IdentifierNode // Optional
|
|
TypeParameters *TypeParameterList // Optional
|
|
HeritageClauses *HeritageClauseList // Optional
|
|
Members *ClassElementList
|
|
}
|
|
|
|
type LiteralLikeNodeBase struct {
|
|
Text string
|
|
TokenFlags TokenFlags
|
|
}
|
|
|
|
type LiteralExpressionBase struct {
|
|
PrimaryExpressionBase
|
|
LiteralLikeNodeBase
|
|
}
|
|
|
|
type TemplateLiteralLikeNodeBase struct {
|
|
LiteralLikeNodeBase
|
|
RawText string
|
|
TemplateFlags TokenFlags
|
|
}
|
|
|
|
type TypeElementBase struct{}
|
|
|
|
type ClassElementBase struct{}
|
|
|
|
type NamedMemberBase struct {
|
|
ModifiersBase
|
|
name *PropertyName
|
|
PostfixToken *TokenNode // Optional
|
|
}
|
|
|
|
type ObjectLiteralElementBase struct{}
|
|
|
|
type AccessorDeclarationBase struct {
|
|
TypeElementBase
|
|
ClassElementBase
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
FunctionLikeWithBodyBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
}
|
|
|
|
type FunctionOrConstructorTypeNodeBase struct {
|
|
TypeNodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
type UnionOrIntersectionTypeNodeBase struct {
|
|
TypeNodeBase
|
|
Types *TypeList
|
|
}
|
|
|
|
type JSDocTagBase struct {
|
|
NodeBase
|
|
TagName *IdentifierNode
|
|
Comment *NodeList // Optional
|
|
}
|
|
|
|
type JSDocCommentBase struct {
|
|
NodeBase
|
|
text []string
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Node type aliases
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type (
|
|
TokenNode = Node
|
|
IdentifierNode = Node
|
|
PrivateIdentifierNode = Node
|
|
QualifiedNameNode = Node
|
|
ComputedPropertyNameNode = Node
|
|
DecoratorNode = Node
|
|
EmptyStatementNode = Node
|
|
IfStatementNode = Node
|
|
DoStatementNode = Node
|
|
WhileStatementNode = Node
|
|
ForStatementNode = Node
|
|
ForInOrOfStatementNode = Node
|
|
BreakStatementNode = Node
|
|
ContinueStatementNode = Node
|
|
ReturnStatementNode = Node
|
|
WithStatementNode = Node
|
|
SwitchStatementNode = Node
|
|
CaseBlockNode = Node
|
|
CaseOrDefaultClauseNode = Node
|
|
ThrowStatementNode = Node
|
|
TryStatementNode = Node
|
|
CatchClauseNode = Node
|
|
DebuggerStatementNode = Node
|
|
LabeledStatementNode = Node
|
|
ExpressionStatementNode = Node
|
|
BlockNode = Node
|
|
VariableStatementNode = Node
|
|
VariableDeclarationNode = Node
|
|
VariableDeclarationListNode = Node
|
|
BindingPatternNode = Node
|
|
ParameterDeclarationNode = Node
|
|
BindingElementNode = Node
|
|
MissingDeclarationNode = Node
|
|
FunctionDeclarationNode = Node
|
|
ClassDeclarationNode = Node
|
|
ClassExpressionNode = Node
|
|
HeritageClauseNode = Node
|
|
InterfaceDeclarationNode = Node
|
|
TypeAliasDeclarationNode = Node
|
|
EnumMemberNode = Node
|
|
EnumDeclarationNode = Node
|
|
ModuleBlockNode = Node
|
|
NotEmittedStatementNode = Node
|
|
NotEmittedTypeElementNode = Node
|
|
ImportDeclarationNode = Node
|
|
ExternalModuleReferenceNode = Node
|
|
NamespaceImportNode = Node
|
|
NamedImportsNode = Node
|
|
ExportAssignmentNode = Node
|
|
NamespaceExportDeclarationNode = Node
|
|
NamespaceExportNode = Node
|
|
NamedExportsNode = Node
|
|
ExportSpecifierNode = Node
|
|
CallSignatureDeclarationNode = Node
|
|
ConstructSignatureDeclarationNode = Node
|
|
ConstructorDeclarationNode = Node
|
|
GetAccessorDeclarationNode = Node
|
|
SetAccessorDeclarationNode = Node
|
|
IndexSignatureDeclarationNode = Node
|
|
MethodSignatureDeclarationNode = Node
|
|
MethodDeclarationNode = Node
|
|
PropertySignatureDeclarationNode = Node
|
|
PropertyDeclarationNode = Node
|
|
SemicolonClassElementNode = Node
|
|
ClassStaticBlockDeclarationNode = Node
|
|
OmittedExpressionNode = Node
|
|
KeywordExpressionNode = Node
|
|
StringLiteralNode = Node
|
|
NumericLiteralNode = Node
|
|
BigIntLiteralNode = Node
|
|
RegularExpressionLiteralNode = Node
|
|
NoSubstitutionTemplateLiteralNode = Node
|
|
BinaryExpressionNode = Node
|
|
PrefixUnaryExpressionNode = Node
|
|
PostfixUnaryExpressionNode = Node
|
|
YieldExpressionNode = Node
|
|
ArrowFunctionNode = Node
|
|
FunctionExpressionNode = Node
|
|
AsExpressionNode = Node
|
|
SatisfiesExpressionNode = Node
|
|
ConditionalExpressionNode = Node
|
|
PropertyAccessExpressionNode = Node
|
|
ElementAccessExpressionNode = Node
|
|
CallExpressionNode = Node
|
|
NewExpressionNode = Node
|
|
MetaPropertyNode = Node
|
|
NonNullExpressionNode = Node
|
|
SpreadElementNode = Node
|
|
TemplateExpressionNode = Node
|
|
TemplateSpanNode = Node
|
|
TaggedTemplateExpressionNode = Node
|
|
ParenthesizedExpressionNode = Node
|
|
ArrayLiteralExpressionNode = Node
|
|
ObjectLiteralExpressionNode = Node
|
|
SpreadAssignmentNode = Node
|
|
PropertyAssignmentNode = Node
|
|
ShorthandPropertyAssignmentNode = Node
|
|
DeleteExpressionNode = Node
|
|
TypeOfExpressionNode = Node
|
|
VoidExpressionNode = Node
|
|
AwaitExpressionNode = Node
|
|
TypeAssertionNode = Node
|
|
KeywordTypeNodeNode = Node
|
|
UnionTypeNodeNode = Node
|
|
IntersectionTypeNodeNode = Node
|
|
ConditionalTypeNodeNode = Node
|
|
TypeOperatorNodeNode = Node
|
|
InferTypeNodeNode = Node
|
|
ArrayTypeNodeNode = Node
|
|
IndexedAccessTypeNodeNode = Node
|
|
TypeReferenceNodeNode = Node
|
|
ExpressionWithTypeArgumentsNode = Node
|
|
LiteralTypeNodeNode = Node
|
|
ThisTypeNodeNode = Node
|
|
TypePredicateNodeNode = Node
|
|
ImportAttributeNode = Node
|
|
ImportAttributesNode = Node
|
|
TypeQueryNodeNode = Node
|
|
MappedTypeNodeNode = Node
|
|
TypeLiteralNodeNode = Node
|
|
TupleTypeNodeNode = Node
|
|
NamedTupleMemberNode = Node
|
|
OptionalTypeNodeNode = Node
|
|
RestTypeNodeNode = Node
|
|
ParenthesizedTypeNodeNode = Node
|
|
FunctionTypeNodeNode = Node
|
|
ConstructorTypeNodeNode = Node
|
|
TemplateHeadNode = Node
|
|
TemplateMiddleNode = Node
|
|
TemplateTailNode = Node
|
|
TemplateLiteralTypeNodeNode = Node
|
|
TemplateLiteralTypeSpanNode = Node
|
|
SyntheticExpressionNode = Node
|
|
PartiallyEmittedExpressionNode = Node
|
|
JsxElementNode = Node
|
|
JsxAttributesNode = Node
|
|
JsxNamespacedNameNode = Node
|
|
JsxOpeningElementNode = Node
|
|
JsxSelfClosingElementNode = Node
|
|
JsxFragmentNode = Node
|
|
JsxOpeningFragmentNode = Node
|
|
JsxClosingFragmentNode = Node
|
|
JsxAttributeNode = Node
|
|
JsxSpreadAttributeNode = Node
|
|
JsxClosingElementNode = Node
|
|
JsxExpressionNode = Node
|
|
JsxTextNode = Node
|
|
SyntaxListNode = Node
|
|
JSDocNode = Node
|
|
JSDocTypeExpressionNode = Node
|
|
JSDocNonNullableTypeNode = Node
|
|
JSDocNullableTypeNode = Node
|
|
JSDocAllTypeNode = Node
|
|
JSDocVariadicTypeNode = Node
|
|
JSDocOptionalTypeNode = Node
|
|
JSDocTypeTagNode = Node
|
|
JSDocUnknownTagNode = Node
|
|
JSDocTemplateTagNode = Node
|
|
JSDocReturnTagNode = Node
|
|
JSDocPublicTagNode = Node
|
|
JSDocPrivateTagNode = Node
|
|
JSDocProtectedTagNode = Node
|
|
JSDocReadonlyTagNode = Node
|
|
JSDocOverrideTagNode = Node
|
|
JSDocDeprecatedTagNode = Node
|
|
JSDocSeeTagNode = Node
|
|
JSDocImplementsTagNode = Node
|
|
JSDocAugmentsTagNode = Node
|
|
JSDocSatisfiesTagNode = Node
|
|
JSDocThrowsTagNode = Node
|
|
JSDocThisTagNode = Node
|
|
JSDocImportTagNode = Node
|
|
JSDocCallbackTagNode = Node
|
|
JSDocOverloadTagNode = Node
|
|
JSDocTypedefTagNode = Node
|
|
JSDocSignatureNode = Node
|
|
JSDocNameReferenceNode = Node
|
|
SourceFileNode = Node
|
|
ModuleDeclarationNode = Node
|
|
ImportEqualsDeclarationNode = Node
|
|
ExportDeclarationNode = Node
|
|
ImportTypeNodeNode = Node
|
|
ImportClauseNode = Node
|
|
ImportSpecifierNode = Node
|
|
JSDocTextNode = Node
|
|
JSDocLinkNode = Node
|
|
JSDocLinkPlainNode = Node
|
|
JSDocLinkCodeNode = Node
|
|
TypeParameterDeclarationNode = Node
|
|
SyntheticReferenceExpressionNode = Node
|
|
JSDocTypeLiteralNode = Node
|
|
JSDocParameterOrPropertyTagNode = Node
|
|
EndOfFile = Node
|
|
DotToken = Node
|
|
DotDotDotToken = Node
|
|
QuestionToken = Node
|
|
ExclamationToken = Node
|
|
ColonToken = Node
|
|
EqualsToken = Node
|
|
AsteriskToken = Node
|
|
EqualsGreaterThanToken = Node
|
|
PlusToken = Node
|
|
MinusToken = Node
|
|
QuestionDotToken = Node
|
|
AssertsKeyword = Node
|
|
AssertKeyword = Node
|
|
AwaitKeyword = Node
|
|
CaseKeyword = Node
|
|
AbstractKeyword = Node
|
|
AccessorKeyword = Node
|
|
AsyncKeyword = Node
|
|
ConstKeyword = Node
|
|
DeclareKeyword = Node
|
|
DefaultKeyword = Node
|
|
ExportKeyword = Node
|
|
InKeyword = Node
|
|
PrivateKeyword = Node
|
|
ProtectedKeyword = Node
|
|
PublicKeyword = Node
|
|
ReadonlyKeyword = Node
|
|
OutKeyword = Node
|
|
OverrideKeyword = Node
|
|
StaticKeyword = Node
|
|
BinaryOperatorToken = Node
|
|
AssignmentOperatorToken = Node
|
|
NullLiteral = Node
|
|
TrueLiteral = Node
|
|
FalseLiteral = Node
|
|
ThisExpression = Node
|
|
SuperExpression = Node
|
|
ImportExpression = Node
|
|
)
|
|
|
|
type (
|
|
StatementList = NodeList // NodeList[*Statement]
|
|
CaseClausesList = NodeList // NodeList[*CaseOrDefaultClause]
|
|
VariableDeclarationNodeList = NodeList // NodeList[*VariableDeclaration]
|
|
BindingElementList = NodeList // NodeList[*BindingElement]
|
|
TypeParameterList = NodeList // NodeList[*TypeParameterDeclaration]
|
|
ParameterList = NodeList // NodeList[*ParameterDeclaration]
|
|
HeritageClauseList = NodeList // NodeList[*HeritageClause]
|
|
ClassElementList = NodeList // NodeList[*ClassElement]
|
|
TypeElementList = NodeList // NodeList[*TypeElement]
|
|
ExpressionWithTypeArgumentsList = NodeList // NodeList[*ExpressionWithTypeArguments]
|
|
HeritageClauseElementList = NodeList // NodeList[*HeritageClauseElement]
|
|
EnumMemberList = NodeList // NodeList[*EnumMember]
|
|
ImportSpecifierList = NodeList // NodeList[*ImportSpecifier]
|
|
ExportSpecifierList = NodeList // NodeList[*ExportSpecifier]
|
|
TypeArgumentList = NodeList // NodeList[*TypeNode]
|
|
ArgumentList = NodeList // NodeList[*Expression]
|
|
TemplateSpanList = NodeList // NodeList[*TemplateSpan]
|
|
ElementList = NodeList // NodeList[*Expression]
|
|
PropertyDefinitionList = NodeList // NodeList[*ObjectLiteralElement]
|
|
TypeList = NodeList // NodeList[*TypeNode]
|
|
ImportAttributeList = NodeList // NodeList[*ImportAttribute]
|
|
TemplateLiteralTypeSpanList = NodeList // NodeList[*TemplateLiteralTypeSpan]
|
|
JsxChildList = NodeList // NodeList[*JsxChild]
|
|
JsxAttributeList = NodeList // NodeList[*JsxAttributeLike]
|
|
)
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Node union aliases
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type (
|
|
Expression = Node // Node with ExpressionBase
|
|
Statement = Node // Node with StatementBase
|
|
TypeNode = Node // Node with TypeNodeBase
|
|
HeritageClauseElement = Node // ExpressionWithTypeArguments | TypeReferenceNode
|
|
BlockOrExpression = Node // Block | Expression
|
|
NodeBody = Node // Block | Expression | ModuleBlock | ModuleDeclaration
|
|
AccessExpression = Node // PropertyAccessExpression | ElementAccessExpression
|
|
DeclarationName = Node // Identifier | PrivateIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | NoSubstitutionTemplateLiteral | ComputedPropertyName | BindingPattern | ElementAccessExpression
|
|
ModuleName = Node // Identifier | StringLiteral
|
|
ModuleExportName = Node // Identifier | StringLiteral
|
|
PropertyName = Node // Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | BigIntLiteral
|
|
ModuleBody = Node // ModuleBlock | ModuleDeclaration
|
|
JSDocFullName = Node // Identifier | ModuleDeclaration
|
|
ForInitializer = Node // Expression | MissingDeclaration | VariableDeclarationList
|
|
ModuleReference = Node // Identifier | QualifiedName | ExternalModuleReference
|
|
NamedImportBindings = Node // NamespaceImport | NamedImports
|
|
NamedExportBindings = Node // NamespaceExport | NamedExports
|
|
MemberName = Node // Identifier | PrivateIdentifier
|
|
EntityName = Node // Identifier | QualifiedName
|
|
BindingName = Node // Identifier | BindingPattern
|
|
ModifierLike = Node // Modifier | Decorator
|
|
JsxChild = Node // JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment
|
|
JsxAttributeLike = Node // JsxAttribute | JsxSpreadAttribute
|
|
JsxAttributeName = Node // Identifier | JsxNamespacedName
|
|
JsxAttributeValue = Node // StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment
|
|
JsxTagNameExpression = Node // Identifier | ThisExpression | JsxTagNamePropertyAccess | JsxNamespacedName
|
|
ClassLikeDeclaration = Node // ClassDeclaration | ClassExpression
|
|
AccessorDeclaration = Node // GetAccessorDeclaration | SetAccessorDeclaration
|
|
LiteralLikeNode = Node // StringLiteral | NumericLiteral | BigIntLiteral | RegularExpressionLiteral | TemplateLiteralLikeNode | JsxText
|
|
LiteralExpression = Node // StringLiteral | NumericLiteral | BigIntLiteral | RegularExpressionLiteral | NoSubstitutionTemplateLiteral
|
|
UnionOrIntersectionTypeNode = Node // UnionTypeNode | IntersectionTypeNode
|
|
TemplateLiteralLikeNode = Node // PseudoLiteralSyntaxKind
|
|
TemplateMiddleOrTail = Node // TemplateMiddle | TemplateTail
|
|
TemplateLiteral = Node // TemplateExpression | NoSubstitutionTemplateLiteral
|
|
TypePredicateParameterName = Node // Identifier | ThisTypeNode
|
|
ImportAttributeName = Node // Identifier | StringLiteral
|
|
LeftHandSideExpression = Node // Node with LeftHandSideExpressionBase
|
|
JSDocComment = Node // JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain
|
|
SignatureDeclaration = Node // CallSignatureDeclaration | ConstructSignatureDeclaration | MethodSignatureDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | AccessorDeclaration | FunctionExpression | ArrowFunction
|
|
StringLiteralLikeNode = Node // StringLiteral | NoSubstitutionTemplateLiteral
|
|
NumericOrStringLikeLiteral = Node // StringLiteralLikeNode | NumericLiteral
|
|
ObjectLiteralLikeNode = Node // ObjectLiteralExpression | ObjectBindingPattern
|
|
ObjectTypeDeclaration = Node // ClassLikeDeclaration | InterfaceDeclaration | TypeLiteralNode
|
|
JsxOpeningLikeElement = Node // JsxOpeningElement | JsxSelfClosingElement
|
|
NamedImportsOrExports = Node // NamedImports | NamedExports
|
|
BreakOrContinueStatement = Node // BreakStatement | ContinueStatement
|
|
CallLikeExpression = Node // CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement | BinaryExpression
|
|
FunctionLikeDeclaration = Node // FunctionDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | FunctionExpression | ArrowFunction
|
|
VariableOrParameterDeclaration = Node // VariableDeclaration | ParameterDeclaration
|
|
VariableOrPropertyDeclaration = Node // VariableDeclaration | PropertyDeclaration
|
|
CallOrNewExpression = Node // CallExpression | NewExpression
|
|
ImportClauseOrBindingPattern = Node // ImportClause | BindingPattern
|
|
AnyImportSyntax = Node // ImportDeclaration | ImportEqualsDeclaration
|
|
Declaration = Node // Node with DeclarationBase
|
|
ClassElement = Node // Node with ClassElementBase
|
|
TypeElement = Node // Node with TypeElementBase
|
|
ObjectLiteralElement = Node // Node with ObjectLiteralElementBase
|
|
JSDocTag = Node // Node with JSDocTagBase
|
|
ArrayBindingElement = Node // BindingElement | OmittedExpression
|
|
AssertionExpression = Node // TypeAssertion | AsExpression
|
|
BooleanLiteral = Node // TrueLiteral | FalseLiteral
|
|
ConciseBody = Node // Block | Expression
|
|
DestructuringAssignment = Node // ObjectDestructuringAssignment | ArrayDestructuringAssignment
|
|
LiteralToken = Node // NumericLiteral | BigIntLiteral | StringLiteral | JsxText | RegularExpressionLiteral | NoSubstitutionTemplateLiteral
|
|
Modifier = Node // ModifierSyntaxKind
|
|
ObjectLiteralElementLike = Node // PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration
|
|
PropertyNameLiteral = Node // Identifier | StringLiteral | NumericLiteral
|
|
PseudoLiteralToken = Node // PseudoLiteralSyntaxKind
|
|
TemplateLiteralToken = Node // NoSubstitutionTemplateLiteral | PseudoLiteralToken
|
|
ArrayDestructuringAssignment = Node // BinaryExpression
|
|
ObjectDestructuringAssignment = Node // BinaryExpression
|
|
FunctionBody = Node // Block
|
|
IncrementExpression = Node // UpdateExpressionBase
|
|
)
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Token
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type Token struct {
|
|
NodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewToken(kind TokenSyntaxKind) *Node {
|
|
switch kind {
|
|
case KindNumericLiteral:
|
|
data := f.numericLiteralArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindBigIntLiteral:
|
|
data := &BigIntLiteral{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindStringLiteral:
|
|
data := f.stringLiteralArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindJsxText:
|
|
data := &JsxText{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindRegularExpressionLiteral:
|
|
data := &RegularExpressionLiteral{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindNoSubstitutionTemplateLiteral:
|
|
data := &NoSubstitutionTemplateLiteral{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindTemplateHead:
|
|
data := &TemplateHead{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindTemplateMiddle:
|
|
data := &TemplateMiddle{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindTemplateTail:
|
|
data := &TemplateTail{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindIdentifier:
|
|
data := f.identifierArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindPrivateIdentifier:
|
|
data := &PrivateIdentifier{}
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindFalseKeyword, KindImportKeyword, KindNullKeyword, KindSuperKeyword, KindThisKeyword, KindTrueKeyword:
|
|
data := f.keywordExpressionArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
case KindVoidKeyword, KindAnyKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindBigIntKeyword:
|
|
data := f.keywordTypeNodeArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
default:
|
|
data := f.tokenArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
}
|
|
|
|
func (node *Token) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewToken(node.Kind), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsToken(node *Node) bool {
|
|
switch node.Kind {
|
|
case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindNumericLiteral, KindBigIntLiteral, KindStringLiteral, KindJsxText, KindJsxTextAllWhiteSpaces, KindRegularExpressionLiteral, KindNoSubstitutionTemplateLiteral, KindTemplateHead, KindTemplateMiddle, KindTemplateTail, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindIdentifier, KindPrivateIdentifier, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFalseKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindImportKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindNullKeyword, KindReturnKeyword, KindSuperKeyword, KindSwitchKeyword, KindThisKeyword, KindThrowKeyword, KindTrueKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindVoidKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAnyKeyword, KindAsyncKeyword, KindAwaitKeyword, KindBooleanKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIntrinsicKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindNeverKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindNumberKeyword, KindObjectKeyword, KindSatisfiesKeyword, KindSetKeyword, KindStringKeyword, KindSymbolKeyword, KindTypeKeyword, KindUndefinedKeyword, KindUniqueKeyword, KindUnknownKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindBigIntKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Identifier
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type Identifier struct {
|
|
PrimaryExpressionBase
|
|
FlowNodeBase
|
|
Text string
|
|
}
|
|
|
|
func (f *NodeFactory) NewIdentifier(text string) *Node {
|
|
data := f.identifierArena.New()
|
|
data.Text = text
|
|
f.textCount++
|
|
return f.newNode(KindIdentifier, data.AsNode())
|
|
}
|
|
|
|
func (node *Identifier) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewIdentifier(node.Text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsIdentifier(node *Node) bool {
|
|
return node.Kind == KindIdentifier
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PrivateIdentifier
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PrivateIdentifier struct {
|
|
PrimaryExpressionBase
|
|
Text string
|
|
}
|
|
|
|
func (f *NodeFactory) NewPrivateIdentifier(text string) *Node {
|
|
data := &PrivateIdentifier{}
|
|
data.Text = text
|
|
f.textCount++
|
|
return f.newNode(KindPrivateIdentifier, data.AsNode())
|
|
}
|
|
|
|
func (node *PrivateIdentifier) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPrivateIdentifier(node.Text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsPrivateIdentifier(node *Node) bool {
|
|
return node.Kind == KindPrivateIdentifier
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// QualifiedName
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type QualifiedName struct {
|
|
NodeBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
Left *EntityName
|
|
Right *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewQualifiedName(left *EntityName, right *IdentifierNode) *Node {
|
|
data := &QualifiedName{}
|
|
data.Left = left
|
|
data.Right = right
|
|
return f.newNode(KindQualifiedName, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateQualifiedName(node *QualifiedName, left *EntityName, right *IdentifierNode) *Node {
|
|
if left != node.Left || right != node.Right {
|
|
return updateNode(f.NewQualifiedName(left, right), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *QualifiedName) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Left) || visit(v, node.Right)
|
|
}
|
|
|
|
func (node *QualifiedName) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateQualifiedName(node, v.visitNode(node.Left), v.visitNode(node.Right))
|
|
}
|
|
|
|
func (node *QualifiedName) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewQualifiedName(node.Left, node.Right), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *QualifiedName) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Left) |
|
|
propagateSubtreeFacts(node.Right)
|
|
}
|
|
|
|
func IsQualifiedName(node *Node) bool {
|
|
return node.Kind == KindQualifiedName
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ComputedPropertyName
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ComputedPropertyName struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewComputedPropertyName(expression *Expression) *Node {
|
|
data := &ComputedPropertyName{}
|
|
data.Expression = expression
|
|
return f.newNode(KindComputedPropertyName, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateComputedPropertyName(node *ComputedPropertyName, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewComputedPropertyName(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ComputedPropertyName) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ComputedPropertyName) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateComputedPropertyName(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ComputedPropertyName) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewComputedPropertyName(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ComputedPropertyName) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsComputedPropertyName(node *Node) bool {
|
|
return node.Kind == KindComputedPropertyName
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Decorator
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type Decorator struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Expression *LeftHandSideExpression
|
|
}
|
|
|
|
func (f *NodeFactory) NewDecorator(expression *LeftHandSideExpression) *Node {
|
|
data := &Decorator{}
|
|
data.Expression = expression
|
|
return f.newNode(KindDecorator, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateDecorator(node *Decorator, expression *LeftHandSideExpression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewDecorator(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *Decorator) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *Decorator) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateDecorator(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *Decorator) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewDecorator(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsDecorator(node *Node) bool {
|
|
return node.Kind == KindDecorator
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// EmptyStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type EmptyStatement struct {
|
|
StatementBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewEmptyStatement() *Node {
|
|
data := &EmptyStatement{}
|
|
return f.newNode(KindEmptyStatement, data.AsNode())
|
|
}
|
|
|
|
func (node *EmptyStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewEmptyStatement(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsEmptyStatement(node *Node) bool {
|
|
return node.Kind == KindEmptyStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// IfStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type IfStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
ThenStatement *Statement
|
|
ElseStatement *Statement // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewIfStatement(expression *Expression, thenStatement *Statement, elseStatement *Statement) *Node {
|
|
data := f.ifStatementArena.New()
|
|
data.Expression = expression
|
|
data.ThenStatement = thenStatement
|
|
data.ElseStatement = elseStatement
|
|
return f.newNode(KindIfStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateIfStatement(node *IfStatement, expression *Expression, thenStatement *Statement, elseStatement *Statement) *Node {
|
|
if expression != node.Expression || thenStatement != node.ThenStatement || elseStatement != node.ElseStatement {
|
|
return updateNode(f.NewIfStatement(expression, thenStatement, elseStatement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *IfStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.ThenStatement) || visit(v, node.ElseStatement)
|
|
}
|
|
|
|
func (node *IfStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateIfStatement(node, v.visitNode(node.Expression), v.visitEmbeddedStatement(node.ThenStatement), v.visitEmbeddedStatement(node.ElseStatement))
|
|
}
|
|
|
|
func (node *IfStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewIfStatement(node.Expression, node.ThenStatement, node.ElseStatement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *IfStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.ThenStatement) |
|
|
propagateSubtreeFacts(node.ElseStatement)
|
|
}
|
|
|
|
func IsIfStatement(node *Node) bool {
|
|
return node.Kind == KindIfStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// DoStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type DoStatement struct {
|
|
IterationStatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewDoStatement(statement *Statement, expression *Expression) *Node {
|
|
data := &DoStatement{}
|
|
data.Statement = statement
|
|
data.Expression = expression
|
|
return f.newNode(KindDoStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateDoStatement(node *DoStatement, statement *Statement, expression *Expression) *Node {
|
|
if statement != node.Statement || expression != node.Expression {
|
|
return updateNode(f.NewDoStatement(statement, expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *DoStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Statement) || visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *DoStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateDoStatement(node, v.visitIterationBody(node.Statement), v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *DoStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewDoStatement(node.Statement, node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *DoStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Statement) |
|
|
propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsDoStatement(node *Node) bool {
|
|
return node.Kind == KindDoStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// WhileStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type WhileStatement struct {
|
|
IterationStatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewWhileStatement(expression *Expression, statement *Statement) *Node {
|
|
data := &WhileStatement{}
|
|
data.Expression = expression
|
|
data.Statement = statement
|
|
return f.newNode(KindWhileStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateWhileStatement(node *WhileStatement, expression *Expression, statement *Statement) *Node {
|
|
if expression != node.Expression || statement != node.Statement {
|
|
return updateNode(f.NewWhileStatement(expression, statement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *WhileStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.Statement)
|
|
}
|
|
|
|
func (node *WhileStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateWhileStatement(node, v.visitNode(node.Expression), v.visitIterationBody(node.Statement))
|
|
}
|
|
|
|
func (node *WhileStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewWhileStatement(node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *WhileStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.Statement)
|
|
}
|
|
|
|
func IsWhileStatement(node *Node) bool {
|
|
return node.Kind == KindWhileStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ForStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ForStatement struct {
|
|
IterationStatementBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
Initializer *ForInitializer // Optional
|
|
Condition *Expression // Optional
|
|
Incrementor *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewForStatement(initializer *ForInitializer, condition *Expression, incrementor *Expression, statement *Statement) *Node {
|
|
data := &ForStatement{}
|
|
data.Initializer = initializer
|
|
data.Condition = condition
|
|
data.Incrementor = incrementor
|
|
data.Statement = statement
|
|
return f.newNode(KindForStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateForStatement(node *ForStatement, initializer *ForInitializer, condition *Expression, incrementor *Expression, statement *Statement) *Node {
|
|
if initializer != node.Initializer || condition != node.Condition || incrementor != node.Incrementor || statement != node.Statement {
|
|
return updateNode(f.NewForStatement(initializer, condition, incrementor, statement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ForStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Initializer) ||
|
|
visit(v, node.Condition) ||
|
|
visit(v, node.Incrementor) ||
|
|
visit(v, node.Statement)
|
|
}
|
|
|
|
func (node *ForStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateForStatement(node, v.visitNode(node.Initializer), v.visitNode(node.Condition), v.visitNode(node.Incrementor), v.visitIterationBody(node.Statement))
|
|
}
|
|
|
|
func (node *ForStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewForStatement(node.Initializer, node.Condition, node.Incrementor, node.Statement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ForStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Initializer) |
|
|
propagateSubtreeFacts(node.Condition) |
|
|
propagateSubtreeFacts(node.Incrementor) |
|
|
propagateSubtreeFacts(node.Statement)
|
|
}
|
|
|
|
func IsForStatement(node *Node) bool {
|
|
return node.Kind == KindForStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ForInOrOfStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ForInOrOfStatement struct {
|
|
StatementBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
AwaitModifier *AwaitKeyword // Optional
|
|
Initializer *ForInitializer
|
|
Expression *Expression
|
|
Statement *Statement
|
|
}
|
|
|
|
func (f *NodeFactory) NewForInOrOfStatement(kind Kind, awaitModifier *AwaitKeyword, initializer *ForInitializer, expression *Expression, statement *Statement) *Node {
|
|
data := &ForInOrOfStatement{}
|
|
data.AwaitModifier = awaitModifier
|
|
data.Initializer = initializer
|
|
data.Expression = expression
|
|
data.Statement = statement
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateForInOrOfStatement(node *ForInOrOfStatement, awaitModifier *AwaitKeyword, initializer *ForInitializer, expression *Expression, statement *Statement) *Node {
|
|
if awaitModifier != node.AwaitModifier || initializer != node.Initializer || expression != node.Expression || statement != node.Statement {
|
|
return updateNode(f.NewForInOrOfStatement(node.Kind, awaitModifier, initializer, expression, statement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ForInOrOfStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.AwaitModifier) ||
|
|
visit(v, node.Initializer) ||
|
|
visit(v, node.Expression) ||
|
|
visit(v, node.Statement)
|
|
}
|
|
|
|
func (node *ForInOrOfStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateForInOrOfStatement(node, v.visitNode(node.AwaitModifier), v.visitNode(node.Initializer), v.visitNode(node.Expression), v.visitIterationBody(node.Statement))
|
|
}
|
|
|
|
func (node *ForInOrOfStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewForInOrOfStatement(node.Kind, node.AwaitModifier, node.Initializer, node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsForInStatement(node *Node) bool {
|
|
return node.Kind == KindForInStatement
|
|
}
|
|
|
|
func IsForOfStatement(node *Node) bool {
|
|
return node.Kind == KindForOfStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// BreakStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type BreakStatement struct {
|
|
StatementBase
|
|
Label *IdentifierNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewBreakStatement(label *IdentifierNode) *Node {
|
|
data := &BreakStatement{}
|
|
data.Label = label
|
|
return f.newNode(KindBreakStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateBreakStatement(node *BreakStatement, label *IdentifierNode) *Node {
|
|
if label != node.Label {
|
|
return updateNode(f.NewBreakStatement(label), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *BreakStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Label)
|
|
}
|
|
|
|
func (node *BreakStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateBreakStatement(node, v.visitNode(node.Label))
|
|
}
|
|
|
|
func (node *BreakStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBreakStatement(node.Label), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsBreakStatement(node *Node) bool {
|
|
return node.Kind == KindBreakStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ContinueStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ContinueStatement struct {
|
|
StatementBase
|
|
Label *IdentifierNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewContinueStatement(label *IdentifierNode) *Node {
|
|
data := &ContinueStatement{}
|
|
data.Label = label
|
|
return f.newNode(KindContinueStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateContinueStatement(node *ContinueStatement, label *IdentifierNode) *Node {
|
|
if label != node.Label {
|
|
return updateNode(f.NewContinueStatement(label), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ContinueStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Label)
|
|
}
|
|
|
|
func (node *ContinueStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateContinueStatement(node, v.visitNode(node.Label))
|
|
}
|
|
|
|
func (node *ContinueStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewContinueStatement(node.Label), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsContinueStatement(node *Node) bool {
|
|
return node.Kind == KindContinueStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ReturnStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ReturnStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Expression *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewReturnStatement(expression *Expression) *Node {
|
|
data := f.returnStatementArena.New()
|
|
data.Expression = expression
|
|
return f.newNode(KindReturnStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateReturnStatement(node *ReturnStatement, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewReturnStatement(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ReturnStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ReturnStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateReturnStatement(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ReturnStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewReturnStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsReturnStatement(node *Node) bool {
|
|
return node.Kind == KindReturnStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// WithStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type WithStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
Statement *Statement
|
|
}
|
|
|
|
func (f *NodeFactory) NewWithStatement(expression *Expression, statement *Statement) *Node {
|
|
data := &WithStatement{}
|
|
data.Expression = expression
|
|
data.Statement = statement
|
|
return f.newNode(KindWithStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateWithStatement(node *WithStatement, expression *Expression, statement *Statement) *Node {
|
|
if expression != node.Expression || statement != node.Statement {
|
|
return updateNode(f.NewWithStatement(expression, statement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *WithStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.Statement)
|
|
}
|
|
|
|
func (node *WithStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateWithStatement(node, v.visitNode(node.Expression), v.visitEmbeddedStatement(node.Statement))
|
|
}
|
|
|
|
func (node *WithStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewWithStatement(node.Expression, node.Statement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *WithStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.Statement)
|
|
}
|
|
|
|
func IsWithStatement(node *Node) bool {
|
|
return node.Kind == KindWithStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SwitchStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SwitchStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
CaseBlock *CaseBlockNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewSwitchStatement(expression *Expression, caseBlock *CaseBlockNode) *Node {
|
|
data := &SwitchStatement{}
|
|
data.Expression = expression
|
|
data.CaseBlock = caseBlock
|
|
return f.newNode(KindSwitchStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSwitchStatement(node *SwitchStatement, expression *Expression, caseBlock *CaseBlockNode) *Node {
|
|
if expression != node.Expression || caseBlock != node.CaseBlock {
|
|
return updateNode(f.NewSwitchStatement(expression, caseBlock), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SwitchStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.CaseBlock)
|
|
}
|
|
|
|
func (node *SwitchStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSwitchStatement(node, v.visitNode(node.Expression), v.visitNode(node.CaseBlock))
|
|
}
|
|
|
|
func (node *SwitchStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSwitchStatement(node.Expression, node.CaseBlock), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *SwitchStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.CaseBlock)
|
|
}
|
|
|
|
func IsSwitchStatement(node *Node) bool {
|
|
return node.Kind == KindSwitchStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// CaseBlock
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type CaseBlock struct {
|
|
NodeBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
Clauses *CaseClausesList
|
|
}
|
|
|
|
func (f *NodeFactory) NewCaseBlock(clauses *CaseClausesList) *Node {
|
|
data := &CaseBlock{}
|
|
data.Clauses = clauses
|
|
return f.newNode(KindCaseBlock, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateCaseBlock(node *CaseBlock, clauses *CaseClausesList) *Node {
|
|
if clauses != node.Clauses {
|
|
return updateNode(f.NewCaseBlock(clauses), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *CaseBlock) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Clauses)
|
|
}
|
|
|
|
func (node *CaseBlock) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateCaseBlock(node, v.visitNodes(node.Clauses))
|
|
}
|
|
|
|
func (node *CaseBlock) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewCaseBlock(node.Clauses), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *CaseBlock) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Clauses, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsCaseBlock(node *Node) bool {
|
|
return node.Kind == KindCaseBlock
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// CaseOrDefaultClause
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type CaseOrDefaultClause struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
Statements *StatementList
|
|
FallthroughFlowNode *FlowNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewCaseOrDefaultClause(kind Kind, expression *Expression, statements *StatementList) *Node {
|
|
data := &CaseOrDefaultClause{}
|
|
data.Expression = expression
|
|
data.Statements = statements
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateCaseOrDefaultClause(node *CaseOrDefaultClause, expression *Expression, statements *StatementList) *Node {
|
|
if expression != node.Expression || statements != node.Statements {
|
|
return updateNode(f.NewCaseOrDefaultClause(node.Kind, expression, statements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *CaseOrDefaultClause) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visitNodeList(v, node.Statements)
|
|
}
|
|
|
|
func (node *CaseOrDefaultClause) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateCaseOrDefaultClause(node, v.visitNode(node.Expression), v.visitNodes(node.Statements))
|
|
}
|
|
|
|
func (node *CaseOrDefaultClause) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewCaseOrDefaultClause(node.Kind, node.Expression, node.Statements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *CaseOrDefaultClause) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsCaseClause(node *Node) bool {
|
|
return node.Kind == KindCaseClause
|
|
}
|
|
|
|
func IsDefaultClause(node *Node) bool {
|
|
return node.Kind == KindDefaultClause
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ThrowStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ThrowStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewThrowStatement(expression *Expression) *Node {
|
|
data := &ThrowStatement{}
|
|
data.Expression = expression
|
|
return f.newNode(KindThrowStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateThrowStatement(node *ThrowStatement, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewThrowStatement(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ThrowStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ThrowStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateThrowStatement(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ThrowStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewThrowStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ThrowStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsThrowStatement(node *Node) bool {
|
|
return node.Kind == KindThrowStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TryStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TryStatement struct {
|
|
StatementBase
|
|
CompositeBase
|
|
TryBlock *BlockNode
|
|
CatchClause *CatchClauseNode // Optional
|
|
FinallyBlock *BlockNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewTryStatement(tryBlock *BlockNode, catchClause *CatchClauseNode, finallyBlock *BlockNode) *Node {
|
|
data := &TryStatement{}
|
|
data.TryBlock = tryBlock
|
|
data.CatchClause = catchClause
|
|
data.FinallyBlock = finallyBlock
|
|
return f.newNode(KindTryStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTryStatement(node *TryStatement, tryBlock *BlockNode, catchClause *CatchClauseNode, finallyBlock *BlockNode) *Node {
|
|
if tryBlock != node.TryBlock || catchClause != node.CatchClause || finallyBlock != node.FinallyBlock {
|
|
return updateNode(f.NewTryStatement(tryBlock, catchClause, finallyBlock), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TryStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TryBlock) || visit(v, node.CatchClause) || visit(v, node.FinallyBlock)
|
|
}
|
|
|
|
func (node *TryStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTryStatement(node, v.visitNode(node.TryBlock), v.visitNode(node.CatchClause), v.visitNode(node.FinallyBlock))
|
|
}
|
|
|
|
func (node *TryStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTryStatement(node.TryBlock, node.CatchClause, node.FinallyBlock), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *TryStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.TryBlock) |
|
|
propagateSubtreeFacts(node.CatchClause) |
|
|
propagateSubtreeFacts(node.FinallyBlock)
|
|
}
|
|
|
|
func IsTryStatement(node *Node) bool {
|
|
return node.Kind == KindTryStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// CatchClause
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type CatchClause struct {
|
|
NodeBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
VariableDeclaration *VariableDeclarationNode // Optional
|
|
Block *BlockNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewCatchClause(variableDeclaration *VariableDeclarationNode, block *BlockNode) *Node {
|
|
data := &CatchClause{}
|
|
data.VariableDeclaration = variableDeclaration
|
|
data.Block = block
|
|
return f.newNode(KindCatchClause, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateCatchClause(node *CatchClause, variableDeclaration *VariableDeclarationNode, block *BlockNode) *Node {
|
|
if variableDeclaration != node.VariableDeclaration || block != node.Block {
|
|
return updateNode(f.NewCatchClause(variableDeclaration, block), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *CatchClause) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.VariableDeclaration) || visit(v, node.Block)
|
|
}
|
|
|
|
func (node *CatchClause) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateCatchClause(node, v.visitNode(node.VariableDeclaration), v.visitNode(node.Block))
|
|
}
|
|
|
|
func (node *CatchClause) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewCatchClause(node.VariableDeclaration, node.Block), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsCatchClause(node *Node) bool {
|
|
return node.Kind == KindCatchClause
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// DebuggerStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type DebuggerStatement struct {
|
|
StatementBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewDebuggerStatement() *Node {
|
|
data := &DebuggerStatement{}
|
|
return f.newNode(KindDebuggerStatement, data.AsNode())
|
|
}
|
|
|
|
func (node *DebuggerStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewDebuggerStatement(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsDebuggerStatement(node *Node) bool {
|
|
return node.Kind == KindDebuggerStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// LabeledStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type LabeledStatement struct {
|
|
StatementBase
|
|
Label *IdentifierNode
|
|
Statement *Statement
|
|
}
|
|
|
|
func (f *NodeFactory) NewLabeledStatement(label *IdentifierNode, statement *Statement) *Node {
|
|
data := &LabeledStatement{}
|
|
data.Label = label
|
|
data.Statement = statement
|
|
return f.newNode(KindLabeledStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateLabeledStatement(node *LabeledStatement, label *IdentifierNode, statement *Statement) *Node {
|
|
if label != node.Label || statement != node.Statement {
|
|
return updateNode(f.NewLabeledStatement(label, statement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *LabeledStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Label) || visit(v, node.Statement)
|
|
}
|
|
|
|
func (node *LabeledStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateLabeledStatement(node, v.visitNode(node.Label), v.visitEmbeddedStatement(node.Statement))
|
|
}
|
|
|
|
func (node *LabeledStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewLabeledStatement(node.Label, node.Statement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *LabeledStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Label) |
|
|
propagateSubtreeFacts(node.Statement)
|
|
}
|
|
|
|
func IsLabeledStatement(node *Node) bool {
|
|
return node.Kind == KindLabeledStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExpressionStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExpressionStatement struct {
|
|
StatementBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewExpressionStatement(expression *Expression) *Node {
|
|
data := f.expressionStatementArena.New()
|
|
data.Expression = expression
|
|
return f.newNode(KindExpressionStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExpressionStatement(node *ExpressionStatement, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewExpressionStatement(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExpressionStatement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ExpressionStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExpressionStatement(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ExpressionStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExpressionStatement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ExpressionStatement) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsExpressionStatement(node *Node) bool {
|
|
return node.Kind == KindExpressionStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Block
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type Block struct {
|
|
StatementBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
Statements *StatementList
|
|
MultiLine bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewBlock(statements *StatementList, multiLine bool) *Node {
|
|
data := f.blockArena.New()
|
|
data.Statements = statements
|
|
data.MultiLine = multiLine
|
|
return f.newNode(KindBlock, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateBlock(node *Block, statements *StatementList, multiLine bool) *Node {
|
|
if statements != node.Statements || multiLine != node.MultiLine {
|
|
return updateNode(f.NewBlock(statements, multiLine), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *Block) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Statements)
|
|
}
|
|
|
|
func (node *Block) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateBlock(node, v.visitNodes(node.Statements), node.MultiLine)
|
|
}
|
|
|
|
func (node *Block) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBlock(node.Statements, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *Block) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsBlock(node *Node) bool {
|
|
return node.Kind == KindBlock
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// VariableStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type VariableStatement struct {
|
|
StatementBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
DeclarationList *VariableDeclarationListNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewVariableStatement(modifiers *ModifierList, declarationList *VariableDeclarationListNode) *Node {
|
|
data := f.variableStatementArena.New()
|
|
data.modifiers = modifiers
|
|
data.DeclarationList = declarationList
|
|
return f.newNode(KindVariableStatement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateVariableStatement(node *VariableStatement, modifiers *ModifierList, declarationList *VariableDeclarationListNode) *Node {
|
|
if modifiers != node.modifiers || declarationList != node.DeclarationList {
|
|
return updateNode(f.NewVariableStatement(modifiers, declarationList), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *VariableStatement) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.DeclarationList)
|
|
}
|
|
|
|
func (node *VariableStatement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateVariableStatement(node, v.visitModifiers(node.modifiers), v.visitNode(node.DeclarationList))
|
|
}
|
|
|
|
func (node *VariableStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewVariableStatement(node.Modifiers(), node.DeclarationList), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsVariableStatement(node *Node) bool {
|
|
return node.Kind == KindVariableStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// VariableDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type VariableDeclaration struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
CompositeBase
|
|
name *BindingName
|
|
ExclamationToken *ExclamationToken // Optional
|
|
Type *TypeNode // Optional
|
|
Initializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewVariableDeclaration(name *BindingName, exclamationToken *ExclamationToken, typeNode *TypeNode, initializer *Expression) *Node {
|
|
data := f.variableDeclarationArena.New()
|
|
data.name = name
|
|
data.ExclamationToken = exclamationToken
|
|
data.Type = typeNode
|
|
data.Initializer = initializer
|
|
return f.newNode(KindVariableDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateVariableDeclaration(node *VariableDeclaration, name *BindingName, exclamationToken *ExclamationToken, typeNode *TypeNode, initializer *Expression) *Node {
|
|
if name != node.name || exclamationToken != node.ExclamationToken || typeNode != node.Type || initializer != node.Initializer {
|
|
return updateNode(f.NewVariableDeclaration(name, exclamationToken, typeNode, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *VariableDeclaration) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name) ||
|
|
visit(v, node.ExclamationToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *VariableDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateVariableDeclaration(node, v.visitNode(node.name), v.visitNode(node.ExclamationToken), v.visitNode(node.Type), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *VariableDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewVariableDeclaration(node.name, node.ExclamationToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *VariableDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsVariableDeclaration(node *Node) bool {
|
|
return node.Kind == KindVariableDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// VariableDeclarationList
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type VariableDeclarationList struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Declarations *VariableDeclarationNodeList
|
|
}
|
|
|
|
func (f *NodeFactory) NewVariableDeclarationList(declarations *VariableDeclarationNodeList, flags NodeFlags) *Node {
|
|
data := f.variableDeclarationListArena.New()
|
|
data.Declarations = declarations
|
|
node := f.newNode(KindVariableDeclarationList, data.AsNode())
|
|
node.Flags = flags
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateVariableDeclarationList(node *VariableDeclarationList, declarations *VariableDeclarationNodeList, flags NodeFlags) *Node {
|
|
if declarations != node.Declarations || flags != node.Flags {
|
|
return updateNode(f.NewVariableDeclarationList(declarations, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *VariableDeclarationList) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Declarations)
|
|
}
|
|
|
|
func (node *VariableDeclarationList) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateVariableDeclarationList(node, v.visitNodes(node.Declarations), node.Flags)
|
|
}
|
|
|
|
func (node *VariableDeclarationList) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewVariableDeclarationList(node.Declarations, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsVariableDeclarationList(node *Node) bool {
|
|
return node.Kind == KindVariableDeclarationList
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// BindingPattern
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type BindingPattern struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Elements *BindingElementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewBindingPattern(kind Kind, elements *BindingElementList) *Node {
|
|
data := &BindingPattern{}
|
|
data.Elements = elements
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateBindingPattern(node *BindingPattern, elements *BindingElementList) *Node {
|
|
if elements != node.Elements {
|
|
return updateNode(f.NewBindingPattern(node.Kind, elements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *BindingPattern) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Elements)
|
|
}
|
|
|
|
func (node *BindingPattern) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateBindingPattern(node, v.visitNodes(node.Elements))
|
|
}
|
|
|
|
func (node *BindingPattern) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBindingPattern(node.Kind, node.Elements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsObjectBindingPattern(node *Node) bool {
|
|
return node.Kind == KindObjectBindingPattern
|
|
}
|
|
|
|
func IsArrayBindingPattern(node *Node) bool {
|
|
return node.Kind == KindArrayBindingPattern
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ParameterDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ParameterDeclaration struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
DotDotDotToken *DotDotDotToken // Optional
|
|
name *BindingName
|
|
QuestionToken *QuestionToken // Optional
|
|
Type *TypeNode // Optional
|
|
Initializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewParameterDeclaration(modifiers *ModifierList, dotDotDotToken *DotDotDotToken, name *BindingName, questionToken *QuestionToken, typeNode *TypeNode, initializer *Expression) *Node {
|
|
data := f.parameterDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.DotDotDotToken = dotDotDotToken
|
|
data.name = name
|
|
data.QuestionToken = questionToken
|
|
data.Type = typeNode
|
|
data.Initializer = initializer
|
|
return f.newNode(KindParameter, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateParameterDeclaration(node *ParameterDeclaration, modifiers *ModifierList, dotDotDotToken *DotDotDotToken, name *BindingName, questionToken *QuestionToken, typeNode *TypeNode, initializer *Expression) *Node {
|
|
if modifiers != node.modifiers || dotDotDotToken != node.DotDotDotToken || name != node.name || questionToken != node.QuestionToken || typeNode != node.Type || initializer != node.Initializer {
|
|
return updateNode(f.NewParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, typeNode, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ParameterDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.DotDotDotToken) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.QuestionToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *ParameterDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateParameterDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.DotDotDotToken), v.visitNode(node.name), v.visitNode(node.QuestionToken), v.visitNode(node.Type), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *ParameterDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewParameterDeclaration(node.Modifiers(), node.DotDotDotToken, node.name, node.QuestionToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ParameterDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsParameterDeclaration(node *Node) bool {
|
|
return node.Kind == KindParameter
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// BindingElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type BindingElement struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
DotDotDotToken *DotDotDotToken // Optional
|
|
PropertyName *PropertyName // Optional
|
|
name *BindingName // Optional
|
|
Initializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewBindingElement(dotDotDotToken *DotDotDotToken, propertyName *PropertyName, name *BindingName, initializer *Expression) *Node {
|
|
data := &BindingElement{}
|
|
data.DotDotDotToken = dotDotDotToken
|
|
data.PropertyName = propertyName
|
|
data.name = name
|
|
data.Initializer = initializer
|
|
return f.newNode(KindBindingElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateBindingElement(node *BindingElement, dotDotDotToken *DotDotDotToken, propertyName *PropertyName, name *BindingName, initializer *Expression) *Node {
|
|
if dotDotDotToken != node.DotDotDotToken || propertyName != node.PropertyName || name != node.name || initializer != node.Initializer {
|
|
return updateNode(f.NewBindingElement(dotDotDotToken, propertyName, name, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *BindingElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.DotDotDotToken) ||
|
|
visit(v, node.PropertyName) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *BindingElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateBindingElement(node, v.visitNode(node.DotDotDotToken), v.visitNode(node.PropertyName), v.visitNode(node.name), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *BindingElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBindingElement(node.DotDotDotToken, node.PropertyName, node.name, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *BindingElement) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsBindingElement(node *Node) bool {
|
|
return node.Kind == KindBindingElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// MissingDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type MissingDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewMissingDeclaration(modifiers *ModifierList) *Node {
|
|
data := &MissingDeclaration{}
|
|
data.modifiers = modifiers
|
|
return f.newNode(KindMissingDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateMissingDeclaration(node *MissingDeclaration, modifiers *ModifierList) *Node {
|
|
if modifiers != node.modifiers {
|
|
return updateNode(f.NewMissingDeclaration(modifiers), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *MissingDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers)
|
|
}
|
|
|
|
func (node *MissingDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateMissingDeclaration(node, v.visitModifiers(node.modifiers))
|
|
}
|
|
|
|
func (node *MissingDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewMissingDeclaration(node.Modifiers()), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsMissingDeclaration(node *Node) bool {
|
|
return node.Kind == KindMissingDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// FunctionDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type FunctionDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
FunctionLikeWithBodyBase
|
|
CompositeBase
|
|
name *IdentifierNode // Optional
|
|
ReturnFlowNode *FlowNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewFunctionDeclaration(modifiers *ModifierList, asteriskToken *AsteriskToken, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := f.functionDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.AsteriskToken = asteriskToken
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindFunctionDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateFunctionDeclaration(node *FunctionDeclaration, modifiers *ModifierList, asteriskToken *AsteriskToken, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *FunctionDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.AsteriskToken) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *FunctionDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateFunctionDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.AsteriskToken), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *FunctionDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewFunctionDeclaration(node.Modifiers(), node.AsteriskToken, node.name, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *FunctionDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsFunctionDeclaration(node *Node) bool {
|
|
return node.Kind == KindFunctionDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ClassDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ClassDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ClassLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewClassDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node {
|
|
data := &ClassDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.HeritageClauses = heritageClauses
|
|
data.Members = members
|
|
return f.newNode(KindClassDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateClassDeclaration(node *ClassDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members {
|
|
return updateNode(f.NewClassDeclaration(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ClassDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.HeritageClauses) ||
|
|
visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *ClassDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateClassDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNodes(node.HeritageClauses), v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *ClassDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewClassDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ClassDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsClassDeclaration(node *Node) bool {
|
|
return node.Kind == KindClassDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ClassExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ClassExpression struct {
|
|
PrimaryExpressionBase
|
|
DeclarationBase
|
|
ClassLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewClassExpression(modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node {
|
|
data := &ClassExpression{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.HeritageClauses = heritageClauses
|
|
data.Members = members
|
|
return f.newNode(KindClassExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateClassExpression(node *ClassExpression, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *ClassElementList) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members {
|
|
return updateNode(f.NewClassExpression(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ClassExpression) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.HeritageClauses) ||
|
|
visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *ClassExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateClassExpression(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNodes(node.HeritageClauses), v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *ClassExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewClassExpression(node.Modifiers(), node.name, node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ClassExpression) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsClassExpression(node *Node) bool {
|
|
return node.Kind == KindClassExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// HeritageClause
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type HeritageClause struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Token Kind
|
|
Types *HeritageClauseElementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewHeritageClause(token Kind, types *HeritageClauseElementList) *Node {
|
|
data := f.heritageClauseArena.New()
|
|
data.Token = token
|
|
data.Types = types
|
|
return f.newNode(KindHeritageClause, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateHeritageClause(node *HeritageClause, token Kind, types *HeritageClauseElementList) *Node {
|
|
if token != node.Token || types != node.Types {
|
|
return updateNode(f.NewHeritageClause(token, types), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *HeritageClause) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Types)
|
|
}
|
|
|
|
func (node *HeritageClause) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateHeritageClause(node, node.Token, v.visitNodes(node.Types))
|
|
}
|
|
|
|
func (node *HeritageClause) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewHeritageClause(node.Token, node.Types), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsHeritageClause(node *Node) bool {
|
|
return node.Kind == KindHeritageClause
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// InterfaceDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type InterfaceDeclaration struct {
|
|
TypeSyntaxBase
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
name *IdentifierNode
|
|
TypeParameters *TypeParameterList // Optional
|
|
HeritageClauses *HeritageClauseList // Optional
|
|
Members *TypeElementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewInterfaceDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *TypeElementList) *Node {
|
|
data := f.interfaceDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.HeritageClauses = heritageClauses
|
|
data.Members = members
|
|
return f.newNode(KindInterfaceDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateInterfaceDeclaration(node *InterfaceDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, heritageClauses *HeritageClauseList, members *TypeElementList) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || heritageClauses != node.HeritageClauses || members != node.Members {
|
|
return updateNode(f.NewInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *InterfaceDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.HeritageClauses) ||
|
|
visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *InterfaceDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateInterfaceDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNodes(node.HeritageClauses), v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *InterfaceDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewInterfaceDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.HeritageClauses, node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *InterfaceDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsInterfaceDeclaration(node *Node) bool {
|
|
return node.Kind == KindInterfaceDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeAliasDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeAliasDeclaration struct {
|
|
TypeSyntaxBase
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
LocalsContainerBase
|
|
name *IdentifierNode
|
|
TypeParameters *TypeParameterList // Optional
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node {
|
|
data := f.typeAliasDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindTypeAliasDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSTypeAliasDeclaration(modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node {
|
|
data := f.typeAliasDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSTypeAliasDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeAliasDeclaration(node *TypeAliasDeclaration, modifiers *ModifierList, name *IdentifierNode, typeParameters *TypeParameterList, typeNode *TypeNode) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || typeNode != node.Type {
|
|
switch node.Kind {
|
|
case KindTypeAliasDeclaration:
|
|
return updateNode(f.NewTypeAliasDeclaration(modifiers, name, typeParameters, typeNode), node.AsNode(), f.hooks)
|
|
case KindJSTypeAliasDeclaration:
|
|
return updateNode(f.NewJSTypeAliasDeclaration(modifiers, name, typeParameters, typeNode), node.AsNode(), f.hooks)
|
|
default:
|
|
panic("unexpected kind in UpdateTypeAliasDeclaration: " + node.Kind.String())
|
|
}
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeAliasDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visit(v, node.Type)
|
|
}
|
|
|
|
func (node *TypeAliasDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeAliasDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *TypeAliasDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
switch node.Kind {
|
|
case KindTypeAliasDeclaration:
|
|
return cloneNode(f.AsNodeFactory().NewTypeAliasDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
case KindJSTypeAliasDeclaration:
|
|
return cloneNode(f.AsNodeFactory().NewJSTypeAliasDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
default:
|
|
panic("unexpected kind in TypeAliasDeclaration.Clone: " + node.Kind.String())
|
|
}
|
|
}
|
|
|
|
func (node *TypeAliasDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsTypeAliasDeclaration(node *Node) bool {
|
|
return node.Kind == KindTypeAliasDeclaration
|
|
}
|
|
|
|
func IsJSTypeAliasDeclaration(node *Node) bool {
|
|
return node.Kind == KindJSTypeAliasDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// EnumMember
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type EnumMember struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
CompositeBase
|
|
Initializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewEnumMember(name *PropertyName, initializer *Expression) *Node {
|
|
data := &EnumMember{}
|
|
data.name = name
|
|
data.Initializer = initializer
|
|
return f.newNode(KindEnumMember, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateEnumMember(node *EnumMember, name *PropertyName, initializer *Expression) *Node {
|
|
if name != node.name || initializer != node.Initializer {
|
|
return updateNode(f.NewEnumMember(name, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *EnumMember) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name) || visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *EnumMember) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateEnumMember(node, v.visitNode(node.name), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *EnumMember) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewEnumMember(node.name, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *EnumMember) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsEnumMember(node *Node) bool {
|
|
return node.Kind == KindEnumMember
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// EnumDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type EnumDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
name *IdentifierNode
|
|
Members *EnumMemberList
|
|
}
|
|
|
|
func (f *NodeFactory) NewEnumDeclaration(modifiers *ModifierList, name *IdentifierNode, members *EnumMemberList) *Node {
|
|
data := &EnumDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.Members = members
|
|
return f.newNode(KindEnumDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateEnumDeclaration(node *EnumDeclaration, modifiers *ModifierList, name *IdentifierNode, members *EnumMemberList) *Node {
|
|
if modifiers != node.modifiers || name != node.name || members != node.Members {
|
|
return updateNode(f.NewEnumDeclaration(modifiers, name, members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *EnumDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.name) || visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *EnumDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateEnumDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *EnumDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewEnumDeclaration(node.Modifiers(), node.name, node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *EnumDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsEnumDeclaration(node *Node) bool {
|
|
return node.Kind == KindEnumDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ModuleBlock
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ModuleBlock struct {
|
|
StatementBase
|
|
CompositeBase
|
|
Statements *StatementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewModuleBlock(statements *StatementList) *Node {
|
|
data := &ModuleBlock{}
|
|
data.Statements = statements
|
|
return f.newNode(KindModuleBlock, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateModuleBlock(node *ModuleBlock, statements *StatementList) *Node {
|
|
if statements != node.Statements {
|
|
return updateNode(f.NewModuleBlock(statements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ModuleBlock) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Statements)
|
|
}
|
|
|
|
func (node *ModuleBlock) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateModuleBlock(node, v.visitNodes(node.Statements))
|
|
}
|
|
|
|
func (node *ModuleBlock) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewModuleBlock(node.Statements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ModuleBlock) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Statements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsModuleBlock(node *Node) bool {
|
|
return node.Kind == KindModuleBlock
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NotEmittedStatement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NotEmittedStatement struct {
|
|
StatementBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewNotEmittedStatement() *Node {
|
|
data := &NotEmittedStatement{}
|
|
return f.newNode(KindNotEmittedStatement, data.AsNode())
|
|
}
|
|
|
|
func (node *NotEmittedStatement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNotEmittedStatement(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNotEmittedStatement(node *Node) bool {
|
|
return node.Kind == KindNotEmittedStatement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NotEmittedTypeElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NotEmittedTypeElement struct {
|
|
TypeElementBase
|
|
NodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewNotEmittedTypeElement() *Node {
|
|
data := &NotEmittedTypeElement{}
|
|
return f.newNode(KindNotEmittedTypeElement, data.AsNode())
|
|
}
|
|
|
|
func (node *NotEmittedTypeElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNotEmittedTypeElement(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNotEmittedTypeElement(node *Node) bool {
|
|
return node.Kind == KindNotEmittedTypeElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportDeclaration struct {
|
|
StatementBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
DeclarationBase
|
|
ImportClause *ImportClauseNode // Optional
|
|
ModuleSpecifier *Expression
|
|
Attributes *ImportAttributesNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportDeclaration(modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node {
|
|
data := &ImportDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.ImportClause = importClause
|
|
data.ModuleSpecifier = moduleSpecifier
|
|
data.Attributes = attributes
|
|
return f.newNode(KindImportDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSImportDeclaration(modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node {
|
|
data := &ImportDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.ImportClause = importClause
|
|
data.ModuleSpecifier = moduleSpecifier
|
|
data.Attributes = attributes
|
|
return f.newNode(KindJSImportDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportDeclaration(node *ImportDeclaration, modifiers *ModifierList, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node {
|
|
if modifiers != node.modifiers || importClause != node.ImportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes {
|
|
switch node.Kind {
|
|
case KindImportDeclaration:
|
|
return updateNode(f.NewImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node.AsNode(), f.hooks)
|
|
case KindJSImportDeclaration:
|
|
return updateNode(f.NewJSImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node.AsNode(), f.hooks)
|
|
default:
|
|
panic("unexpected kind in UpdateImportDeclaration: " + node.Kind.String())
|
|
}
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.ImportClause) ||
|
|
visit(v, node.ModuleSpecifier) ||
|
|
visit(v, node.Attributes)
|
|
}
|
|
|
|
func (node *ImportDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.ImportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes))
|
|
}
|
|
|
|
func (node *ImportDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
switch node.Kind {
|
|
case KindImportDeclaration:
|
|
return cloneNode(f.AsNodeFactory().NewImportDeclaration(node.Modifiers(), node.ImportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks)
|
|
case KindJSImportDeclaration:
|
|
return cloneNode(f.AsNodeFactory().NewJSImportDeclaration(node.Modifiers(), node.ImportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks)
|
|
default:
|
|
panic("unexpected kind in ImportDeclaration.Clone: " + node.Kind.String())
|
|
}
|
|
}
|
|
|
|
func (node *ImportDeclaration) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateModifierListSubtreeFacts(node.modifiers) |
|
|
propagateSubtreeFacts(node.ImportClause) |
|
|
propagateSubtreeFacts(node.ModuleSpecifier) |
|
|
propagateSubtreeFacts(node.Attributes)
|
|
}
|
|
|
|
func IsImportDeclaration(node *Node) bool {
|
|
return node.Kind == KindImportDeclaration
|
|
}
|
|
|
|
func IsJSImportDeclaration(node *Node) bool {
|
|
return node.Kind == KindJSImportDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExternalModuleReference
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExternalModuleReference struct {
|
|
NodeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewExternalModuleReference(expression *Expression) *Node {
|
|
data := &ExternalModuleReference{}
|
|
data.Expression = expression
|
|
return f.newNode(KindExternalModuleReference, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExternalModuleReference(node *ExternalModuleReference, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewExternalModuleReference(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExternalModuleReference) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ExternalModuleReference) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExternalModuleReference(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ExternalModuleReference) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExternalModuleReference(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ExternalModuleReference) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsExternalModuleReference(node *Node) bool {
|
|
return node.Kind == KindExternalModuleReference
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamespaceImport
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamespaceImport struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
name *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamespaceImport(name *IdentifierNode) *Node {
|
|
data := &NamespaceImport{}
|
|
data.name = name
|
|
return f.newNode(KindNamespaceImport, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamespaceImport(node *NamespaceImport, name *IdentifierNode) *Node {
|
|
if name != node.name {
|
|
return updateNode(f.NewNamespaceImport(name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamespaceImport) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *NamespaceImport) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamespaceImport(node, v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *NamespaceImport) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamespaceImport(node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamespaceImport) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.name)
|
|
}
|
|
|
|
func (node *NamespaceImport) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsNamespaceImport(node *Node) bool {
|
|
return node.Kind == KindNamespaceImport
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamedImports
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamedImports struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Elements *ImportSpecifierList
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamedImports(elements *ImportSpecifierList) *Node {
|
|
data := &NamedImports{}
|
|
data.Elements = elements
|
|
return f.newNode(KindNamedImports, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamedImports(node *NamedImports, elements *ImportSpecifierList) *Node {
|
|
if elements != node.Elements {
|
|
return updateNode(f.NewNamedImports(elements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamedImports) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Elements)
|
|
}
|
|
|
|
func (node *NamedImports) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamedImports(node, v.visitNodes(node.Elements))
|
|
}
|
|
|
|
func (node *NamedImports) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamedImports(node.Elements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamedImports) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsNamedImports(node *Node) bool {
|
|
return node.Kind == KindNamedImports
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExportAssignment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExportAssignment struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
IsExportEquals bool
|
|
Type *TypeNode
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewExportAssignment(modifiers *ModifierList, isExportEquals bool, typeNode *TypeNode, expression *Expression) *Node {
|
|
data := &ExportAssignment{}
|
|
data.modifiers = modifiers
|
|
data.IsExportEquals = isExportEquals
|
|
data.Type = typeNode
|
|
data.Expression = expression
|
|
return f.newNode(KindExportAssignment, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExportAssignment(node *ExportAssignment, modifiers *ModifierList, isExportEquals bool, typeNode *TypeNode, expression *Expression) *Node {
|
|
if modifiers != node.modifiers || isExportEquals != node.IsExportEquals || typeNode != node.Type || expression != node.Expression {
|
|
return updateNode(f.NewExportAssignment(modifiers, isExportEquals, typeNode, expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExportAssignment) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.Type) || visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ExportAssignment) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExportAssignment(node, v.visitModifiers(node.modifiers), node.IsExportEquals, v.visitNode(node.Type), v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ExportAssignment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExportAssignment(node.Modifiers(), node.IsExportEquals, node.Type, node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsExportAssignment(node *Node) bool {
|
|
return node.Kind == KindExportAssignment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamespaceExportDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamespaceExportDeclaration struct {
|
|
TypeSyntaxBase
|
|
StatementBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
name *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamespaceExportDeclaration(modifiers *ModifierList, name *IdentifierNode) *Node {
|
|
data := &NamespaceExportDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
return f.newNode(KindNamespaceExportDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamespaceExportDeclaration(node *NamespaceExportDeclaration, modifiers *ModifierList, name *IdentifierNode) *Node {
|
|
if modifiers != node.modifiers || name != node.name {
|
|
return updateNode(f.NewNamespaceExportDeclaration(modifiers, name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamespaceExportDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.name)
|
|
}
|
|
|
|
func (node *NamespaceExportDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamespaceExportDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *NamespaceExportDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamespaceExportDeclaration(node.Modifiers(), node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamespaceExportDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsNamespaceExportDeclaration(node *Node) bool {
|
|
return node.Kind == KindNamespaceExportDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamespaceExport
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamespaceExport struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
name *ModuleExportName
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamespaceExport(name *ModuleExportName) *Node {
|
|
data := &NamespaceExport{}
|
|
data.name = name
|
|
return f.newNode(KindNamespaceExport, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamespaceExport(node *NamespaceExport, name *ModuleExportName) *Node {
|
|
if name != node.name {
|
|
return updateNode(f.NewNamespaceExport(name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamespaceExport) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *NamespaceExport) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamespaceExport(node, v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *NamespaceExport) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamespaceExport(node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamespaceExport) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.name)
|
|
}
|
|
|
|
func (node *NamespaceExport) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsNamespaceExport(node *Node) bool {
|
|
return node.Kind == KindNamespaceExport
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamedExports
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamedExports struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Elements *ExportSpecifierList
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamedExports(elements *ExportSpecifierList) *Node {
|
|
data := &NamedExports{}
|
|
data.Elements = elements
|
|
return f.newNode(KindNamedExports, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamedExports(node *NamedExports, elements *ExportSpecifierList) *Node {
|
|
if elements != node.Elements {
|
|
return updateNode(f.NewNamedExports(elements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamedExports) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Elements)
|
|
}
|
|
|
|
func (node *NamedExports) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamedExports(node, v.visitNodes(node.Elements))
|
|
}
|
|
|
|
func (node *NamedExports) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamedExports(node.Elements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamedExports) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsNamedExports(node *Node) bool {
|
|
return node.Kind == KindNamedExports
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExportSpecifier
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExportSpecifier struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
CompositeBase
|
|
IsTypeOnly bool
|
|
PropertyName *ModuleExportName // Optional
|
|
name *ModuleExportName
|
|
}
|
|
|
|
func (f *NodeFactory) NewExportSpecifier(isTypeOnly bool, propertyName *ModuleExportName, name *ModuleExportName) *Node {
|
|
data := &ExportSpecifier{}
|
|
data.IsTypeOnly = isTypeOnly
|
|
data.PropertyName = propertyName
|
|
data.name = name
|
|
return f.newNode(KindExportSpecifier, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExportSpecifier(node *ExportSpecifier, isTypeOnly bool, propertyName *ModuleExportName, name *ModuleExportName) *Node {
|
|
if isTypeOnly != node.IsTypeOnly || propertyName != node.PropertyName || name != node.name {
|
|
return updateNode(f.NewExportSpecifier(isTypeOnly, propertyName, name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExportSpecifier) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.PropertyName) || visit(v, node.name)
|
|
}
|
|
|
|
func (node *ExportSpecifier) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExportSpecifier(node, node.IsTypeOnly, v.visitNode(node.PropertyName), v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *ExportSpecifier) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExportSpecifier(node.IsTypeOnly, node.PropertyName, node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ExportSpecifier) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsExportSpecifier(node *Node) bool {
|
|
return node.Kind == KindExportSpecifier
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// CallSignatureDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type CallSignatureDeclaration struct {
|
|
TypeElementBase
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewCallSignatureDeclaration(typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := &CallSignatureDeclaration{}
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindCallSignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateCallSignatureDeclaration(node *CallSignatureDeclaration, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewCallSignatureDeclaration(typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *CallSignatureDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *CallSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateCallSignatureDeclaration(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *CallSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewCallSignatureDeclaration(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsCallSignatureDeclaration(node *Node) bool {
|
|
return node.Kind == KindCallSignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ConstructSignatureDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ConstructSignatureDeclaration struct {
|
|
TypeElementBase
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewConstructSignatureDeclaration(typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := f.constructSignatureDeclarationArena.New()
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindConstructSignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateConstructSignatureDeclaration(node *ConstructSignatureDeclaration, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewConstructSignatureDeclaration(typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ConstructSignatureDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *ConstructSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateConstructSignatureDeclaration(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *ConstructSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewConstructSignatureDeclaration(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsConstructSignatureDeclaration(node *Node) bool {
|
|
return node.Kind == KindConstructSignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ConstructorDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ConstructorDeclaration struct {
|
|
ClassElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
FunctionLikeWithBodyBase
|
|
CompositeBase
|
|
ReturnFlowNode *FlowNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewConstructorDeclaration(modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := &ConstructorDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindConstructor, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateConstructorDeclaration(node *ConstructorDeclaration, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewConstructorDeclaration(modifiers, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ConstructorDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *ConstructorDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateConstructorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *ConstructorDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewConstructorDeclaration(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsConstructorDeclaration(node *Node) bool {
|
|
return node.Kind == KindConstructor
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// GetAccessorDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type GetAccessorDeclaration struct {
|
|
AccessorDeclarationBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewGetAccessorDeclaration(modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := &GetAccessorDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindGetAccessor, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateGetAccessorDeclaration(node *GetAccessorDeclaration, modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewGetAccessorDeclaration(modifiers, name, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *GetAccessorDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *GetAccessorDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateGetAccessorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *GetAccessorDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewGetAccessorDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *GetAccessorDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsGetAccessorDeclaration(node *Node) bool {
|
|
return node.Kind == KindGetAccessor
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SetAccessorDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SetAccessorDeclaration struct {
|
|
AccessorDeclarationBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewSetAccessorDeclaration(modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := &SetAccessorDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindSetAccessor, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSetAccessorDeclaration(node *SetAccessorDeclaration, modifiers *ModifierList, name *PropertyName, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewSetAccessorDeclaration(modifiers, name, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SetAccessorDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *SetAccessorDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSetAccessorDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *SetAccessorDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSetAccessorDeclaration(node.Modifiers(), node.name, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *SetAccessorDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsSetAccessorDeclaration(node *Node) bool {
|
|
return node.Kind == KindSetAccessor
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// IndexSignatureDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type IndexSignatureDeclaration struct {
|
|
TypeElementBase
|
|
ClassElementBase
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewIndexSignatureDeclaration(modifiers *ModifierList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := &IndexSignatureDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindIndexSignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateIndexSignatureDeclaration(node *IndexSignatureDeclaration, modifiers *ModifierList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if modifiers != node.modifiers || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewIndexSignatureDeclaration(modifiers, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *IndexSignatureDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visitNodeList(v, node.Parameters) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *IndexSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateIndexSignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *IndexSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewIndexSignatureDeclaration(node.Modifiers(), node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsIndexSignatureDeclaration(node *Node) bool {
|
|
return node.Kind == KindIndexSignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// MethodSignatureDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type MethodSignatureDeclaration struct {
|
|
TypeElementBase
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewMethodSignatureDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := f.methodSignatureDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindMethodSignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateMethodSignatureDeclaration(node *MethodSignatureDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewMethodSignatureDeclaration(modifiers, name, postfixToken, typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *MethodSignatureDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type)
|
|
}
|
|
|
|
func (node *MethodSignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateMethodSignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *MethodSignatureDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewMethodSignatureDeclaration(node.Modifiers(), node.name, node.PostfixToken, node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *MethodSignatureDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsMethodSignatureDeclaration(node *Node) bool {
|
|
return node.Kind == KindMethodSignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// MethodDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type MethodDeclaration struct {
|
|
ClassElementBase
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
FunctionLikeWithBodyBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewMethodDeclaration(modifiers *ModifierList, asteriskToken *AsteriskToken, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := &MethodDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.AsteriskToken = asteriskToken
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindMethodDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateMethodDeclaration(node *MethodDeclaration, modifiers *ModifierList, asteriskToken *AsteriskToken, name *PropertyName, postfixToken *TokenNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || postfixToken != node.PostfixToken || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewMethodDeclaration(modifiers, asteriskToken, name, postfixToken, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *MethodDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.AsteriskToken) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *MethodDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateMethodDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.AsteriskToken), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *MethodDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewMethodDeclaration(node.Modifiers(), node.AsteriskToken, node.name, node.PostfixToken, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *MethodDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsMethodDeclaration(node *Node) bool {
|
|
return node.Kind == KindMethodDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PropertySignatureDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PropertySignatureDeclaration struct {
|
|
TypeElementBase
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
Type *TypeNode
|
|
Initializer *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewPropertySignatureDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
data := f.propertySignatureDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.Type = typeNode
|
|
data.Initializer = initializer
|
|
return f.newNode(KindPropertySignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePropertySignatureDeclaration(node *PropertySignatureDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer {
|
|
return updateNode(f.NewPropertySignatureDeclaration(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PropertySignatureDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *PropertySignatureDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePropertySignatureDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *PropertySignatureDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPropertySignatureDeclaration(node.Modifiers(), node.name, node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PropertySignatureDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsPropertySignatureDeclaration(node *Node) bool {
|
|
return node.Kind == KindPropertySignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PropertyDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PropertyDeclaration struct {
|
|
ClassElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
CompositeBase
|
|
Type *TypeNode // Optional
|
|
Initializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewPropertyDeclaration(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
data := &PropertyDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.Type = typeNode
|
|
data.Initializer = initializer
|
|
return f.newNode(KindPropertyDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePropertyDeclaration(node *PropertyDeclaration, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer {
|
|
return updateNode(f.NewPropertyDeclaration(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PropertyDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *PropertyDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePropertyDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *PropertyDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPropertyDeclaration(node.Modifiers(), node.name, node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PropertyDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsPropertyDeclaration(node *Node) bool {
|
|
return node.Kind == KindPropertyDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SemicolonClassElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SemicolonClassElement struct {
|
|
ClassElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewSemicolonClassElement() *Node {
|
|
data := &SemicolonClassElement{}
|
|
return f.newNode(KindSemicolonClassElement, data.AsNode())
|
|
}
|
|
|
|
func (node *SemicolonClassElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSemicolonClassElement(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSemicolonClassElement(node *Node) bool {
|
|
return node.Kind == KindSemicolonClassElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ClassStaticBlockDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ClassStaticBlockDeclaration struct {
|
|
ClassElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
LocalsContainerBase
|
|
CompositeBase
|
|
Body *BlockNode
|
|
ReturnFlowNode *FlowNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewClassStaticBlockDeclaration(modifiers *ModifierList, body *BlockNode) *Node {
|
|
data := &ClassStaticBlockDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.Body = body
|
|
return f.newNode(KindClassStaticBlockDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateClassStaticBlockDeclaration(node *ClassStaticBlockDeclaration, modifiers *ModifierList, body *BlockNode) *Node {
|
|
if modifiers != node.modifiers || body != node.Body {
|
|
return updateNode(f.NewClassStaticBlockDeclaration(modifiers, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ClassStaticBlockDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.Body)
|
|
}
|
|
|
|
func (node *ClassStaticBlockDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateClassStaticBlockDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.Body))
|
|
}
|
|
|
|
func (node *ClassStaticBlockDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewClassStaticBlockDeclaration(node.Modifiers(), node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsClassStaticBlockDeclaration(node *Node) bool {
|
|
return node.Kind == KindClassStaticBlockDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// OmittedExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type OmittedExpression struct {
|
|
ExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewOmittedExpression() *Node {
|
|
data := &OmittedExpression{}
|
|
return f.newNode(KindOmittedExpression, data.AsNode())
|
|
}
|
|
|
|
func (node *OmittedExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewOmittedExpression(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsOmittedExpression(node *Node) bool {
|
|
return node.Kind == KindOmittedExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// KeywordExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type KeywordExpression struct {
|
|
ExpressionBase
|
|
FlowNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewKeywordExpression(kind KeywordExpressionSyntaxKind) *Node {
|
|
data := f.keywordExpressionArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (node *KeywordExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewKeywordExpression(node.Kind), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsKeywordExpression(node *Node) bool {
|
|
switch node.Kind {
|
|
case KindNullKeyword, KindTrueKeyword, KindFalseKeyword, KindThisKeyword, KindSuperKeyword, KindImportKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// StringLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type StringLiteral struct {
|
|
LiteralExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewStringLiteral(text string, tokenFlags TokenFlags) *Node {
|
|
data := f.stringLiteralArena.New()
|
|
data.Text = text
|
|
data.TokenFlags = tokenFlags & TokenFlagsStringLiteralFlags
|
|
f.textCount++
|
|
return f.newNode(KindStringLiteral, data.AsNode())
|
|
}
|
|
|
|
func (node *StringLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewStringLiteral(node.Text, node.TokenFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsStringLiteral(node *Node) bool {
|
|
return node.Kind == KindStringLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NumericLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NumericLiteral struct {
|
|
LiteralExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewNumericLiteral(text string, tokenFlags TokenFlags) *Node {
|
|
data := f.numericLiteralArena.New()
|
|
data.Text = text
|
|
data.TokenFlags = tokenFlags & TokenFlagsNumericLiteralFlags
|
|
f.textCount++
|
|
return f.newNode(KindNumericLiteral, data.AsNode())
|
|
}
|
|
|
|
func (node *NumericLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNumericLiteral(node.Text, node.TokenFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNumericLiteral(node *Node) bool {
|
|
return node.Kind == KindNumericLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// BigIntLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type BigIntLiteral struct {
|
|
LiteralExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewBigIntLiteral(text string, tokenFlags TokenFlags) *Node {
|
|
data := &BigIntLiteral{}
|
|
data.Text = text
|
|
data.TokenFlags = tokenFlags & TokenFlagsNumericLiteralFlags
|
|
f.textCount++
|
|
return f.newNode(KindBigIntLiteral, data.AsNode())
|
|
}
|
|
|
|
func (node *BigIntLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBigIntLiteral(node.Text, node.TokenFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsBigIntLiteral(node *Node) bool {
|
|
return node.Kind == KindBigIntLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// RegularExpressionLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type RegularExpressionLiteral struct {
|
|
LiteralExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewRegularExpressionLiteral(text string, tokenFlags TokenFlags) *Node {
|
|
data := &RegularExpressionLiteral{}
|
|
data.Text = text
|
|
data.TokenFlags = tokenFlags & TokenFlagsRegularExpressionLiteralFlags
|
|
f.textCount++
|
|
return f.newNode(KindRegularExpressionLiteral, data.AsNode())
|
|
}
|
|
|
|
func (node *RegularExpressionLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewRegularExpressionLiteral(node.Text, node.TokenFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsRegularExpressionLiteral(node *Node) bool {
|
|
return node.Kind == KindRegularExpressionLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NoSubstitutionTemplateLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NoSubstitutionTemplateLiteral struct {
|
|
ExpressionBase
|
|
TemplateLiteralLikeNodeBase
|
|
DeclarationBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewNoSubstitutionTemplateLiteral(text string, templateFlags TokenFlags) *Node {
|
|
data := &NoSubstitutionTemplateLiteral{}
|
|
data.Text = text
|
|
data.TemplateFlags = templateFlags & TokenFlagsTemplateLiteralLikeFlags
|
|
f.textCount++
|
|
return f.newNode(KindNoSubstitutionTemplateLiteral, data.AsNode())
|
|
}
|
|
|
|
func (node *NoSubstitutionTemplateLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNoSubstitutionTemplateLiteral(node.Text, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNoSubstitutionTemplateLiteral(node *Node) bool {
|
|
return node.Kind == KindNoSubstitutionTemplateLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// BinaryExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type BinaryExpression struct {
|
|
ExpressionBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
Left *Expression
|
|
Type *TypeNode // Optional
|
|
OperatorToken *BinaryOperatorToken
|
|
Right *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewBinaryExpression(modifiers *ModifierList, left *Expression, typeNode *TypeNode, operatorToken *BinaryOperatorToken, right *Expression) *Node {
|
|
data := f.binaryExpressionArena.New()
|
|
data.modifiers = modifiers
|
|
data.Left = left
|
|
data.Type = typeNode
|
|
data.OperatorToken = operatorToken
|
|
data.Right = right
|
|
return f.newNode(KindBinaryExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateBinaryExpression(node *BinaryExpression, modifiers *ModifierList, left *Expression, typeNode *TypeNode, operatorToken *BinaryOperatorToken, right *Expression) *Node {
|
|
if modifiers != node.modifiers || left != node.Left || typeNode != node.Type || operatorToken != node.OperatorToken || right != node.Right {
|
|
return updateNode(f.NewBinaryExpression(modifiers, left, typeNode, operatorToken, right), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *BinaryExpression) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.Left) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.OperatorToken) ||
|
|
visit(v, node.Right)
|
|
}
|
|
|
|
func (node *BinaryExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateBinaryExpression(node, v.visitModifiers(node.modifiers), v.visitNode(node.Left), v.visitNode(node.Type), v.visitNode(node.OperatorToken), v.visitNode(node.Right))
|
|
}
|
|
|
|
func (node *BinaryExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewBinaryExpression(node.Modifiers(), node.Left, node.Type, node.OperatorToken, node.Right), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsBinaryExpression(node *Node) bool {
|
|
return node.Kind == KindBinaryExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PrefixUnaryExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PrefixUnaryExpression struct {
|
|
UpdateExpressionBase
|
|
Operator Kind
|
|
Operand *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewPrefixUnaryExpression(operator Kind, operand *Expression) *Node {
|
|
data := f.prefixUnaryExpressionArena.New()
|
|
data.Operator = operator
|
|
data.Operand = operand
|
|
return f.newNode(KindPrefixUnaryExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePrefixUnaryExpression(node *PrefixUnaryExpression, operator Kind, operand *Expression) *Node {
|
|
if operator != node.Operator || operand != node.Operand {
|
|
return updateNode(f.NewPrefixUnaryExpression(operator, operand), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PrefixUnaryExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Operand)
|
|
}
|
|
|
|
func (node *PrefixUnaryExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePrefixUnaryExpression(node, node.Operator, v.visitNode(node.Operand))
|
|
}
|
|
|
|
func (node *PrefixUnaryExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPrefixUnaryExpression(node.Operator, node.Operand), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PrefixUnaryExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Operand)
|
|
}
|
|
|
|
func IsPrefixUnaryExpression(node *Node) bool {
|
|
return node.Kind == KindPrefixUnaryExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PostfixUnaryExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PostfixUnaryExpression struct {
|
|
UpdateExpressionBase
|
|
Operand *Expression
|
|
Operator Kind
|
|
}
|
|
|
|
func (f *NodeFactory) NewPostfixUnaryExpression(operand *Expression, operator Kind) *Node {
|
|
data := &PostfixUnaryExpression{}
|
|
data.Operand = operand
|
|
data.Operator = operator
|
|
return f.newNode(KindPostfixUnaryExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePostfixUnaryExpression(node *PostfixUnaryExpression, operand *Expression, operator Kind) *Node {
|
|
if operand != node.Operand || operator != node.Operator {
|
|
return updateNode(f.NewPostfixUnaryExpression(operand, operator), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PostfixUnaryExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Operand)
|
|
}
|
|
|
|
func (node *PostfixUnaryExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePostfixUnaryExpression(node, v.visitNode(node.Operand), node.Operator)
|
|
}
|
|
|
|
func (node *PostfixUnaryExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPostfixUnaryExpression(node.Operand, node.Operator), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PostfixUnaryExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Operand)
|
|
}
|
|
|
|
func IsPostfixUnaryExpression(node *Node) bool {
|
|
return node.Kind == KindPostfixUnaryExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// YieldExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type YieldExpression struct {
|
|
ExpressionBase
|
|
AsteriskToken *AsteriskToken // Optional
|
|
Expression *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewYieldExpression(asteriskToken *AsteriskToken, expression *Expression) *Node {
|
|
data := &YieldExpression{}
|
|
data.AsteriskToken = asteriskToken
|
|
data.Expression = expression
|
|
return f.newNode(KindYieldExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateYieldExpression(node *YieldExpression, asteriskToken *AsteriskToken, expression *Expression) *Node {
|
|
if asteriskToken != node.AsteriskToken || expression != node.Expression {
|
|
return updateNode(f.NewYieldExpression(asteriskToken, expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *YieldExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.AsteriskToken) || visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *YieldExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateYieldExpression(node, v.visitNode(node.AsteriskToken), v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *YieldExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewYieldExpression(node.AsteriskToken, node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsYieldExpression(node *Node) bool {
|
|
return node.Kind == KindYieldExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ArrowFunction
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ArrowFunction struct {
|
|
ExpressionBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
FunctionLikeWithBodyBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
EqualsGreaterThanToken *EqualsGreaterThanToken
|
|
}
|
|
|
|
func (f *NodeFactory) NewArrowFunction(modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, equalsGreaterThanToken *EqualsGreaterThanToken, body *ConciseBody) *Node {
|
|
data := &ArrowFunction{}
|
|
data.modifiers = modifiers
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.EqualsGreaterThanToken = equalsGreaterThanToken
|
|
data.Body = body
|
|
return f.newNode(KindArrowFunction, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateArrowFunction(node *ArrowFunction, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, equalsGreaterThanToken *EqualsGreaterThanToken, body *ConciseBody) *Node {
|
|
if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || equalsGreaterThanToken != node.EqualsGreaterThanToken || body != node.Body {
|
|
return updateNode(f.NewArrowFunction(modifiers, typeParameters, parameters, typeNode, fullSignature, equalsGreaterThanToken, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ArrowFunction) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.EqualsGreaterThanToken) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *ArrowFunction) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateArrowFunction(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitNode(node.EqualsGreaterThanToken), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *ArrowFunction) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewArrowFunction(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.EqualsGreaterThanToken, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsArrowFunction(node *Node) bool {
|
|
return node.Kind == KindArrowFunction
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// FunctionExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type FunctionExpression struct {
|
|
PrimaryExpressionBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
FunctionLikeWithBodyBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
name *IdentifierNode // Optional
|
|
ReturnFlowNode *FlowNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewFunctionExpression(modifiers *ModifierList, asteriskToken *AsteriskToken, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
data := &FunctionExpression{}
|
|
data.modifiers = modifiers
|
|
data.AsteriskToken = asteriskToken
|
|
data.name = name
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
data.FullSignature = fullSignature
|
|
data.Body = body
|
|
return f.newNode(KindFunctionExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateFunctionExpression(node *FunctionExpression, modifiers *ModifierList, asteriskToken *AsteriskToken, name *IdentifierNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode, fullSignature *TypeNode, body *FunctionBody) *Node {
|
|
if modifiers != node.modifiers || asteriskToken != node.AsteriskToken || name != node.name || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type || fullSignature != node.FullSignature || body != node.Body {
|
|
return updateNode(f.NewFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, typeNode, fullSignature, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *FunctionExpression) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.AsteriskToken) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.FullSignature) ||
|
|
visit(v, node.Body)
|
|
}
|
|
|
|
func (node *FunctionExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateFunctionExpression(node, v.visitModifiers(node.modifiers), v.visitNode(node.AsteriskToken), v.visitNode(node.name), v.visitNodes(node.TypeParameters), v.visitParameters(node.Parameters), v.visitNode(node.Type), v.visitNode(node.FullSignature), v.visitFunctionBody(node.Body))
|
|
}
|
|
|
|
func (node *FunctionExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewFunctionExpression(node.Modifiers(), node.AsteriskToken, node.name, node.TypeParameters, node.Parameters, node.Type, node.FullSignature, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *FunctionExpression) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsFunctionExpression(node *Node) bool {
|
|
return node.Kind == KindFunctionExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// AsExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type AsExpression struct {
|
|
ExpressionBase
|
|
Expression *Expression
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewAsExpression(expression *Expression, typeNode *TypeNode) *Node {
|
|
data := &AsExpression{}
|
|
data.Expression = expression
|
|
data.Type = typeNode
|
|
return f.newNode(KindAsExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateAsExpression(node *AsExpression, expression *Expression, typeNode *TypeNode) *Node {
|
|
if expression != node.Expression || typeNode != node.Type {
|
|
return updateNode(f.NewAsExpression(expression, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *AsExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *AsExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateAsExpression(node, v.visitNode(node.Expression), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *AsExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewAsExpression(node.Expression, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsAsExpression(node *Node) bool {
|
|
return node.Kind == KindAsExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SatisfiesExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SatisfiesExpression struct {
|
|
ExpressionBase
|
|
Expression *Expression
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewSatisfiesExpression(expression *Expression, typeNode *TypeNode) *Node {
|
|
data := &SatisfiesExpression{}
|
|
data.Expression = expression
|
|
data.Type = typeNode
|
|
return f.newNode(KindSatisfiesExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSatisfiesExpression(node *SatisfiesExpression, expression *Expression, typeNode *TypeNode) *Node {
|
|
if expression != node.Expression || typeNode != node.Type {
|
|
return updateNode(f.NewSatisfiesExpression(expression, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SatisfiesExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *SatisfiesExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSatisfiesExpression(node, v.visitNode(node.Expression), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *SatisfiesExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSatisfiesExpression(node.Expression, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSatisfiesExpression(node *Node) bool {
|
|
return node.Kind == KindSatisfiesExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ConditionalExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ConditionalExpression struct {
|
|
ExpressionBase
|
|
CompositeBase
|
|
Condition *Expression
|
|
QuestionToken *QuestionToken
|
|
WhenTrue *Expression
|
|
ColonToken *ColonToken
|
|
WhenFalse *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewConditionalExpression(condition *Expression, questionToken *QuestionToken, whenTrue *Expression, colonToken *ColonToken, whenFalse *Expression) *Node {
|
|
data := f.conditionalExpressionArena.New()
|
|
data.Condition = condition
|
|
data.QuestionToken = questionToken
|
|
data.WhenTrue = whenTrue
|
|
data.ColonToken = colonToken
|
|
data.WhenFalse = whenFalse
|
|
return f.newNode(KindConditionalExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateConditionalExpression(node *ConditionalExpression, condition *Expression, questionToken *QuestionToken, whenTrue *Expression, colonToken *ColonToken, whenFalse *Expression) *Node {
|
|
if condition != node.Condition || questionToken != node.QuestionToken || whenTrue != node.WhenTrue || colonToken != node.ColonToken || whenFalse != node.WhenFalse {
|
|
return updateNode(f.NewConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ConditionalExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Condition) ||
|
|
visit(v, node.QuestionToken) ||
|
|
visit(v, node.WhenTrue) ||
|
|
visit(v, node.ColonToken) ||
|
|
visit(v, node.WhenFalse)
|
|
}
|
|
|
|
func (node *ConditionalExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateConditionalExpression(node, v.visitNode(node.Condition), v.visitNode(node.QuestionToken), v.visitNode(node.WhenTrue), v.visitNode(node.ColonToken), v.visitNode(node.WhenFalse))
|
|
}
|
|
|
|
func (node *ConditionalExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewConditionalExpression(node.Condition, node.QuestionToken, node.WhenTrue, node.ColonToken, node.WhenFalse), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ConditionalExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Condition) |
|
|
propagateSubtreeFacts(node.QuestionToken) |
|
|
propagateSubtreeFacts(node.WhenTrue) |
|
|
propagateSubtreeFacts(node.ColonToken) |
|
|
propagateSubtreeFacts(node.WhenFalse)
|
|
}
|
|
|
|
func IsConditionalExpression(node *Node) bool {
|
|
return node.Kind == KindConditionalExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PropertyAccessExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PropertyAccessExpression struct {
|
|
MemberExpressionBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
QuestionDotToken *QuestionDotToken // Optional
|
|
name *MemberName
|
|
}
|
|
|
|
func (f *NodeFactory) NewPropertyAccessExpression(expression *Expression, questionDotToken *QuestionDotToken, name *MemberName, flags NodeFlags) *Node {
|
|
data := f.propertyAccessExpressionArena.New()
|
|
data.Expression = expression
|
|
data.QuestionDotToken = questionDotToken
|
|
data.name = name
|
|
node := f.newNode(KindPropertyAccessExpression, data.AsNode())
|
|
node.Flags |= flags & NodeFlagsOptionalChain
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePropertyAccessExpression(node *PropertyAccessExpression, expression *Expression, questionDotToken *QuestionDotToken, name *MemberName, flags NodeFlags) *Node {
|
|
if expression != node.Expression || questionDotToken != node.QuestionDotToken || name != node.name || flags != node.Flags {
|
|
return updateNode(f.NewPropertyAccessExpression(expression, questionDotToken, name, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PropertyAccessExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.QuestionDotToken) || visit(v, node.name)
|
|
}
|
|
|
|
func (node *PropertyAccessExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePropertyAccessExpression(node, v.visitNode(node.Expression), v.visitNode(node.QuestionDotToken), v.visitNode(node.name), node.Flags)
|
|
}
|
|
|
|
func (node *PropertyAccessExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPropertyAccessExpression(node.Expression, node.QuestionDotToken, node.name, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PropertyAccessExpression) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsPropertyAccessExpression(node *Node) bool {
|
|
return node.Kind == KindPropertyAccessExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ElementAccessExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ElementAccessExpression struct {
|
|
MemberExpressionBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
QuestionDotToken *QuestionDotToken // Optional
|
|
ArgumentExpression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewElementAccessExpression(expression *Expression, questionDotToken *QuestionDotToken, argumentExpression *Expression, flags NodeFlags) *Node {
|
|
data := f.elementAccessExpressionArena.New()
|
|
data.Expression = expression
|
|
data.QuestionDotToken = questionDotToken
|
|
data.ArgumentExpression = argumentExpression
|
|
node := f.newNode(KindElementAccessExpression, data.AsNode())
|
|
node.Flags |= flags & NodeFlagsOptionalChain
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateElementAccessExpression(node *ElementAccessExpression, expression *Expression, questionDotToken *QuestionDotToken, argumentExpression *Expression, flags NodeFlags) *Node {
|
|
if expression != node.Expression || questionDotToken != node.QuestionDotToken || argumentExpression != node.ArgumentExpression || flags != node.Flags {
|
|
return updateNode(f.NewElementAccessExpression(expression, questionDotToken, argumentExpression, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ElementAccessExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.QuestionDotToken) || visit(v, node.ArgumentExpression)
|
|
}
|
|
|
|
func (node *ElementAccessExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateElementAccessExpression(node, v.visitNode(node.Expression), v.visitNode(node.QuestionDotToken), v.visitNode(node.ArgumentExpression), node.Flags)
|
|
}
|
|
|
|
func (node *ElementAccessExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewElementAccessExpression(node.Expression, node.QuestionDotToken, node.ArgumentExpression, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ElementAccessExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.QuestionDotToken) |
|
|
propagateSubtreeFacts(node.ArgumentExpression)
|
|
}
|
|
|
|
func IsElementAccessExpression(node *Node) bool {
|
|
return node.Kind == KindElementAccessExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// CallExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type CallExpression struct {
|
|
LeftHandSideExpressionBase
|
|
DeclarationBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
QuestionDotToken *QuestionDotToken // Optional
|
|
TypeArguments *TypeList // Optional
|
|
Arguments *ElementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewCallExpression(expression *Expression, questionDotToken *QuestionDotToken, typeArguments *TypeList, arguments *ElementList, flags NodeFlags) *Node {
|
|
data := f.callExpressionArena.New()
|
|
data.Expression = expression
|
|
data.QuestionDotToken = questionDotToken
|
|
data.TypeArguments = typeArguments
|
|
data.Arguments = arguments
|
|
node := f.newNode(KindCallExpression, data.AsNode())
|
|
node.Flags |= flags & NodeFlagsOptionalChain
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateCallExpression(node *CallExpression, expression *Expression, questionDotToken *QuestionDotToken, typeArguments *TypeList, arguments *ElementList, flags NodeFlags) *Node {
|
|
if expression != node.Expression || questionDotToken != node.QuestionDotToken || typeArguments != node.TypeArguments || arguments != node.Arguments || flags != node.Flags {
|
|
return updateNode(f.NewCallExpression(expression, questionDotToken, typeArguments, arguments, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *CallExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) ||
|
|
visit(v, node.QuestionDotToken) ||
|
|
visitNodeList(v, node.TypeArguments) ||
|
|
visitNodeList(v, node.Arguments)
|
|
}
|
|
|
|
func (node *CallExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateCallExpression(node, v.visitNode(node.Expression), v.visitNode(node.QuestionDotToken), v.visitNodes(node.TypeArguments), v.visitNodes(node.Arguments), node.Flags)
|
|
}
|
|
|
|
func (node *CallExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewCallExpression(node.Expression, node.QuestionDotToken, node.TypeArguments, node.Arguments, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsCallExpression(node *Node) bool {
|
|
return node.Kind == KindCallExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NewExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NewExpression struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
TypeArguments *TypeList // Optional
|
|
Arguments *ElementList // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewNewExpression(expression *Expression, typeArguments *TypeList, arguments *ElementList) *Node {
|
|
data := &NewExpression{}
|
|
data.Expression = expression
|
|
data.TypeArguments = typeArguments
|
|
data.Arguments = arguments
|
|
return f.newNode(KindNewExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNewExpression(node *NewExpression, expression *Expression, typeArguments *TypeList, arguments *ElementList) *Node {
|
|
if expression != node.Expression || typeArguments != node.TypeArguments || arguments != node.Arguments {
|
|
return updateNode(f.NewNewExpression(expression, typeArguments, arguments), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NewExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visitNodeList(v, node.TypeArguments) || visitNodeList(v, node.Arguments)
|
|
}
|
|
|
|
func (node *NewExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNewExpression(node, v.visitNode(node.Expression), v.visitNodes(node.TypeArguments), v.visitNodes(node.Arguments))
|
|
}
|
|
|
|
func (node *NewExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNewExpression(node.Expression, node.TypeArguments, node.Arguments), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNewExpression(node *Node) bool {
|
|
return node.Kind == KindNewExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// MetaProperty
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type MetaProperty struct {
|
|
PrimaryExpressionBase
|
|
FlowNodeBase
|
|
CompositeBase
|
|
KeywordToken Kind
|
|
name *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewMetaProperty(keywordToken Kind, name *IdentifierNode) *Node {
|
|
data := &MetaProperty{}
|
|
data.KeywordToken = keywordToken
|
|
data.name = name
|
|
return f.newNode(KindMetaProperty, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateMetaProperty(node *MetaProperty, keywordToken Kind, name *IdentifierNode) *Node {
|
|
if keywordToken != node.KeywordToken || name != node.name {
|
|
return updateNode(f.NewMetaProperty(keywordToken, name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *MetaProperty) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *MetaProperty) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateMetaProperty(node, node.KeywordToken, v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *MetaProperty) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewMetaProperty(node.KeywordToken, node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *MetaProperty) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsMetaProperty(node *Node) bool {
|
|
return node.Kind == KindMetaProperty
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NonNullExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NonNullExpression struct {
|
|
LeftHandSideExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewNonNullExpression(expression *Expression, flags NodeFlags) *Node {
|
|
data := &NonNullExpression{}
|
|
data.Expression = expression
|
|
node := f.newNode(KindNonNullExpression, data.AsNode())
|
|
node.Flags |= flags & NodeFlagsOptionalChain
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNonNullExpression(node *NonNullExpression, expression *Expression, flags NodeFlags) *Node {
|
|
if expression != node.Expression || flags != node.Flags {
|
|
return updateNode(f.NewNonNullExpression(expression, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NonNullExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *NonNullExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNonNullExpression(node, v.visitNode(node.Expression), node.Flags)
|
|
}
|
|
|
|
func (node *NonNullExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNonNullExpression(node.Expression, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsNonNullExpression(node *Node) bool {
|
|
return node.Kind == KindNonNullExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SpreadElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SpreadElement struct {
|
|
ExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewSpreadElement(expression *Expression) *Node {
|
|
data := &SpreadElement{}
|
|
data.Expression = expression
|
|
return f.newNode(KindSpreadElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSpreadElement(node *SpreadElement, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewSpreadElement(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SpreadElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *SpreadElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSpreadElement(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *SpreadElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSpreadElement(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSpreadElement(node *Node) bool {
|
|
return node.Kind == KindSpreadElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateExpression struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
Head *TemplateHeadNode
|
|
TemplateSpans *TemplateSpanList
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateExpression(head *TemplateHeadNode, templateSpans *TemplateSpanList) *Node {
|
|
data := &TemplateExpression{}
|
|
data.Head = head
|
|
data.TemplateSpans = templateSpans
|
|
return f.newNode(KindTemplateExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTemplateExpression(node *TemplateExpression, head *TemplateHeadNode, templateSpans *TemplateSpanList) *Node {
|
|
if head != node.Head || templateSpans != node.TemplateSpans {
|
|
return updateNode(f.NewTemplateExpression(head, templateSpans), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TemplateExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Head) || visitNodeList(v, node.TemplateSpans)
|
|
}
|
|
|
|
func (node *TemplateExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTemplateExpression(node, v.visitNode(node.Head), v.visitNodes(node.TemplateSpans))
|
|
}
|
|
|
|
func (node *TemplateExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateExpression(node.Head, node.TemplateSpans), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *TemplateExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Head) |
|
|
propagateNodeListSubtreeFacts(node.TemplateSpans, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsTemplateExpression(node *Node) bool {
|
|
return node.Kind == KindTemplateExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateSpan
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateSpan struct {
|
|
NodeBase
|
|
Expression *Expression
|
|
Literal *TemplateMiddleOrTail
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateSpan(expression *Expression, literal *TemplateMiddleOrTail) *Node {
|
|
data := &TemplateSpan{}
|
|
data.Expression = expression
|
|
data.Literal = literal
|
|
return f.newNode(KindTemplateSpan, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTemplateSpan(node *TemplateSpan, expression *Expression, literal *TemplateMiddleOrTail) *Node {
|
|
if expression != node.Expression || literal != node.Literal {
|
|
return updateNode(f.NewTemplateSpan(expression, literal), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TemplateSpan) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.Literal)
|
|
}
|
|
|
|
func (node *TemplateSpan) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTemplateSpan(node, v.visitNode(node.Expression), v.visitNode(node.Literal))
|
|
}
|
|
|
|
func (node *TemplateSpan) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateSpan(node.Expression, node.Literal), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *TemplateSpan) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.Literal)
|
|
}
|
|
|
|
func IsTemplateSpan(node *Node) bool {
|
|
return node.Kind == KindTemplateSpan
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TaggedTemplateExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TaggedTemplateExpression struct {
|
|
MemberExpressionBase
|
|
CompositeBase
|
|
Tag *Expression
|
|
QuestionDotToken *QuestionDotToken
|
|
TypeArguments *TypeList // Optional
|
|
Template *TemplateLiteral
|
|
}
|
|
|
|
func (f *NodeFactory) NewTaggedTemplateExpression(tag *Expression, questionDotToken *QuestionDotToken, typeArguments *TypeList, template *TemplateLiteral, flags NodeFlags) *Node {
|
|
data := &TaggedTemplateExpression{}
|
|
data.Tag = tag
|
|
data.QuestionDotToken = questionDotToken
|
|
data.TypeArguments = typeArguments
|
|
data.Template = template
|
|
node := f.newNode(KindTaggedTemplateExpression, data.AsNode())
|
|
node.Flags |= flags & NodeFlagsOptionalChain
|
|
return node
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTaggedTemplateExpression(node *TaggedTemplateExpression, tag *Expression, questionDotToken *QuestionDotToken, typeArguments *TypeList, template *TemplateLiteral, flags NodeFlags) *Node {
|
|
if tag != node.Tag || questionDotToken != node.QuestionDotToken || typeArguments != node.TypeArguments || template != node.Template || flags != node.Flags {
|
|
return updateNode(f.NewTaggedTemplateExpression(tag, questionDotToken, typeArguments, template, flags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TaggedTemplateExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Tag) ||
|
|
visit(v, node.QuestionDotToken) ||
|
|
visitNodeList(v, node.TypeArguments) ||
|
|
visit(v, node.Template)
|
|
}
|
|
|
|
func (node *TaggedTemplateExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTaggedTemplateExpression(node, v.visitNode(node.Tag), v.visitNode(node.QuestionDotToken), v.visitNodes(node.TypeArguments), v.visitNode(node.Template), node.Flags)
|
|
}
|
|
|
|
func (node *TaggedTemplateExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTaggedTemplateExpression(node.Tag, node.QuestionDotToken, node.TypeArguments, node.Template, node.Flags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTaggedTemplateExpression(node *Node) bool {
|
|
return node.Kind == KindTaggedTemplateExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ParenthesizedExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ParenthesizedExpression struct {
|
|
PrimaryExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewParenthesizedExpression(expression *Expression) *Node {
|
|
data := f.parenthesizedExpressionArena.New()
|
|
data.Expression = expression
|
|
return f.newNode(KindParenthesizedExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateParenthesizedExpression(node *ParenthesizedExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewParenthesizedExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ParenthesizedExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *ParenthesizedExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateParenthesizedExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *ParenthesizedExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewParenthesizedExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ParenthesizedExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsParenthesizedExpression(node *Node) bool {
|
|
return node.Kind == KindParenthesizedExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ArrayLiteralExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ArrayLiteralExpression struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
Elements *ElementList
|
|
MultiLine bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewArrayLiteralExpression(elements *ElementList, multiLine bool) *Node {
|
|
data := &ArrayLiteralExpression{}
|
|
data.Elements = elements
|
|
data.MultiLine = multiLine
|
|
return f.newNode(KindArrayLiteralExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateArrayLiteralExpression(node *ArrayLiteralExpression, elements *ElementList, multiLine bool) *Node {
|
|
if elements != node.Elements || multiLine != node.MultiLine {
|
|
return updateNode(f.NewArrayLiteralExpression(elements, multiLine), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ArrayLiteralExpression) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Elements)
|
|
}
|
|
|
|
func (node *ArrayLiteralExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateArrayLiteralExpression(node, v.visitNodes(node.Elements), node.MultiLine)
|
|
}
|
|
|
|
func (node *ArrayLiteralExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewArrayLiteralExpression(node.Elements, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ArrayLiteralExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Elements, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsArrayLiteralExpression(node *Node) bool {
|
|
return node.Kind == KindArrayLiteralExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ObjectLiteralExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ObjectLiteralExpression struct {
|
|
PrimaryExpressionBase
|
|
DeclarationBase
|
|
CompositeBase
|
|
Properties *NodeList
|
|
MultiLine bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewObjectLiteralExpression(properties *NodeList, multiLine bool) *Node {
|
|
data := &ObjectLiteralExpression{}
|
|
data.Properties = properties
|
|
data.MultiLine = multiLine
|
|
return f.newNode(KindObjectLiteralExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateObjectLiteralExpression(node *ObjectLiteralExpression, properties *NodeList, multiLine bool) *Node {
|
|
if properties != node.Properties || multiLine != node.MultiLine {
|
|
return updateNode(f.NewObjectLiteralExpression(properties, multiLine), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ObjectLiteralExpression) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Properties)
|
|
}
|
|
|
|
func (node *ObjectLiteralExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateObjectLiteralExpression(node, v.visitNodes(node.Properties), node.MultiLine)
|
|
}
|
|
|
|
func (node *ObjectLiteralExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewObjectLiteralExpression(node.Properties, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ObjectLiteralExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Properties, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsObjectLiteralExpression(node *Node) bool {
|
|
return node.Kind == KindObjectLiteralExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SpreadAssignment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SpreadAssignment struct {
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewSpreadAssignment(expression *Expression) *Node {
|
|
data := &SpreadAssignment{}
|
|
data.Expression = expression
|
|
return f.newNode(KindSpreadAssignment, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSpreadAssignment(node *SpreadAssignment, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewSpreadAssignment(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SpreadAssignment) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *SpreadAssignment) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSpreadAssignment(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *SpreadAssignment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSpreadAssignment(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSpreadAssignment(node *Node) bool {
|
|
return node.Kind == KindSpreadAssignment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PropertyAssignment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PropertyAssignment struct {
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
CompositeBase
|
|
Type *TypeNode
|
|
Initializer *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewPropertyAssignment(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
data := f.propertyAssignmentArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.Type = typeNode
|
|
data.Initializer = initializer
|
|
return f.newNode(KindPropertyAssignment, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePropertyAssignment(node *PropertyAssignment, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, initializer *Expression) *Node {
|
|
if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || initializer != node.Initializer {
|
|
return updateNode(f.NewPropertyAssignment(modifiers, name, postfixToken, typeNode, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PropertyAssignment) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *PropertyAssignment) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePropertyAssignment(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *PropertyAssignment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPropertyAssignment(node.Modifiers(), node.name, node.PostfixToken, node.Type, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PropertyAssignment) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsPropertyAssignment(node *Node) bool {
|
|
return node.Kind == KindPropertyAssignment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ShorthandPropertyAssignment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ShorthandPropertyAssignment struct {
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
DeclarationBase
|
|
NamedMemberBase
|
|
CompositeBase
|
|
Type *TypeNode
|
|
EqualsToken *EqualsToken // Optional
|
|
ObjectAssignmentInitializer *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewShorthandPropertyAssignment(modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, equalsToken *EqualsToken, objectAssignmentInitializer *Expression) *Node {
|
|
data := &ShorthandPropertyAssignment{}
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.PostfixToken = postfixToken
|
|
data.Type = typeNode
|
|
data.EqualsToken = equalsToken
|
|
data.ObjectAssignmentInitializer = objectAssignmentInitializer
|
|
return f.newNode(KindShorthandPropertyAssignment, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateShorthandPropertyAssignment(node *ShorthandPropertyAssignment, modifiers *ModifierList, name *PropertyName, postfixToken *TokenNode, typeNode *TypeNode, equalsToken *EqualsToken, objectAssignmentInitializer *Expression) *Node {
|
|
if modifiers != node.modifiers || name != node.name || postfixToken != node.PostfixToken || typeNode != node.Type || equalsToken != node.EqualsToken || objectAssignmentInitializer != node.ObjectAssignmentInitializer {
|
|
return updateNode(f.NewShorthandPropertyAssignment(modifiers, name, postfixToken, typeNode, equalsToken, objectAssignmentInitializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ShorthandPropertyAssignment) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.PostfixToken) ||
|
|
visit(v, node.Type) ||
|
|
visit(v, node.EqualsToken) ||
|
|
visit(v, node.ObjectAssignmentInitializer)
|
|
}
|
|
|
|
func (node *ShorthandPropertyAssignment) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateShorthandPropertyAssignment(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.PostfixToken), v.visitNode(node.Type), v.visitNode(node.EqualsToken), v.visitNode(node.ObjectAssignmentInitializer))
|
|
}
|
|
|
|
func (node *ShorthandPropertyAssignment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewShorthandPropertyAssignment(node.Modifiers(), node.name, node.PostfixToken, node.Type, node.EqualsToken, node.ObjectAssignmentInitializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ShorthandPropertyAssignment) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsShorthandPropertyAssignment(node *Node) bool {
|
|
return node.Kind == KindShorthandPropertyAssignment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// DeleteExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type DeleteExpression struct {
|
|
UnaryExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewDeleteExpression(expression *Expression) *Node {
|
|
data := &DeleteExpression{}
|
|
data.Expression = expression
|
|
return f.newNode(KindDeleteExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateDeleteExpression(node *DeleteExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewDeleteExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *DeleteExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *DeleteExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateDeleteExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *DeleteExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewDeleteExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *DeleteExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsDeleteExpression(node *Node) bool {
|
|
return node.Kind == KindDeleteExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeOfExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeOfExpression struct {
|
|
UnaryExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeOfExpression(expression *Expression) *Node {
|
|
data := &TypeOfExpression{}
|
|
data.Expression = expression
|
|
return f.newNode(KindTypeOfExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeOfExpression(node *TypeOfExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewTypeOfExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeOfExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *TypeOfExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeOfExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *TypeOfExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeOfExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *TypeOfExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsTypeOfExpression(node *Node) bool {
|
|
return node.Kind == KindTypeOfExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// VoidExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type VoidExpression struct {
|
|
UnaryExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewVoidExpression(expression *Expression) *Node {
|
|
data := &VoidExpression{}
|
|
data.Expression = expression
|
|
return f.newNode(KindVoidExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateVoidExpression(node *VoidExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewVoidExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *VoidExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *VoidExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateVoidExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *VoidExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewVoidExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *VoidExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsVoidExpression(node *Node) bool {
|
|
return node.Kind == KindVoidExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// AwaitExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type AwaitExpression struct {
|
|
UnaryExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewAwaitExpression(expression *Expression) *Node {
|
|
data := &AwaitExpression{}
|
|
data.Expression = expression
|
|
return f.newNode(KindAwaitExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateAwaitExpression(node *AwaitExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewAwaitExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *AwaitExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *AwaitExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateAwaitExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *AwaitExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewAwaitExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsAwaitExpression(node *Node) bool {
|
|
return node.Kind == KindAwaitExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeAssertion
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeAssertion struct {
|
|
UnaryExpressionBase
|
|
Type *TypeNode
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeAssertion(typeNode *TypeNode, expression *Expression) *Node {
|
|
data := &TypeAssertion{}
|
|
data.Type = typeNode
|
|
data.Expression = expression
|
|
return f.newNode(KindTypeAssertionExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeAssertion(node *TypeAssertion, typeNode *TypeNode, expression *Expression) *Node {
|
|
if typeNode != node.Type || expression != node.Expression {
|
|
return updateNode(f.NewTypeAssertion(typeNode, expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeAssertion) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type) || visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *TypeAssertion) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeAssertion(node, v.visitNode(node.Type), v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *TypeAssertion) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeAssertion(node.Type, node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypeAssertion(node *Node) bool {
|
|
return node.Kind == KindTypeAssertionExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// KeywordTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type KeywordTypeNode struct {
|
|
TypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewKeywordTypeNode(kind KeywordTypeSyntaxKind) *Node {
|
|
data := f.keywordTypeNodeArena.New()
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (node *KeywordTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewKeywordTypeNode(node.Kind), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsKeywordTypeNode(node *Node) bool {
|
|
switch node.Kind {
|
|
case KindAnyKeyword, KindBigIntKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindVoidKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// UnionTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type UnionTypeNode struct {
|
|
UnionOrIntersectionTypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewUnionTypeNode(types *TypeList) *Node {
|
|
data := f.unionTypeNodeArena.New()
|
|
data.Types = types
|
|
return f.newNode(KindUnionType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateUnionTypeNode(node *UnionTypeNode, types *TypeList) *Node {
|
|
if types != node.Types {
|
|
return updateNode(f.NewUnionTypeNode(types), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *UnionTypeNode) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Types)
|
|
}
|
|
|
|
func (node *UnionTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateUnionTypeNode(node, v.visitNodes(node.Types))
|
|
}
|
|
|
|
func (node *UnionTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewUnionTypeNode(node.Types), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsUnionTypeNode(node *Node) bool {
|
|
return node.Kind == KindUnionType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// IntersectionTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type IntersectionTypeNode struct {
|
|
UnionOrIntersectionTypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewIntersectionTypeNode(types *TypeList) *Node {
|
|
data := f.intersectionTypeNodeArena.New()
|
|
data.Types = types
|
|
return f.newNode(KindIntersectionType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateIntersectionTypeNode(node *IntersectionTypeNode, types *TypeList) *Node {
|
|
if types != node.Types {
|
|
return updateNode(f.NewIntersectionTypeNode(types), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *IntersectionTypeNode) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Types)
|
|
}
|
|
|
|
func (node *IntersectionTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateIntersectionTypeNode(node, v.visitNodes(node.Types))
|
|
}
|
|
|
|
func (node *IntersectionTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewIntersectionTypeNode(node.Types), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsIntersectionTypeNode(node *Node) bool {
|
|
return node.Kind == KindIntersectionType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ConditionalTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ConditionalTypeNode struct {
|
|
TypeNodeBase
|
|
LocalsContainerBase
|
|
CheckType *TypeNode
|
|
ExtendsType *TypeNode
|
|
TrueType *TypeNode
|
|
FalseType *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewConditionalTypeNode(checkType *TypeNode, extendsType *TypeNode, trueType *TypeNode, falseType *TypeNode) *Node {
|
|
data := &ConditionalTypeNode{}
|
|
data.CheckType = checkType
|
|
data.ExtendsType = extendsType
|
|
data.TrueType = trueType
|
|
data.FalseType = falseType
|
|
return f.newNode(KindConditionalType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateConditionalTypeNode(node *ConditionalTypeNode, checkType *TypeNode, extendsType *TypeNode, trueType *TypeNode, falseType *TypeNode) *Node {
|
|
if checkType != node.CheckType || extendsType != node.ExtendsType || trueType != node.TrueType || falseType != node.FalseType {
|
|
return updateNode(f.NewConditionalTypeNode(checkType, extendsType, trueType, falseType), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ConditionalTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.CheckType) ||
|
|
visit(v, node.ExtendsType) ||
|
|
visit(v, node.TrueType) ||
|
|
visit(v, node.FalseType)
|
|
}
|
|
|
|
func (node *ConditionalTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateConditionalTypeNode(node, v.visitNode(node.CheckType), v.visitNode(node.ExtendsType), v.visitNode(node.TrueType), v.visitNode(node.FalseType))
|
|
}
|
|
|
|
func (node *ConditionalTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewConditionalTypeNode(node.CheckType, node.ExtendsType, node.TrueType, node.FalseType), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsConditionalTypeNode(node *Node) bool {
|
|
return node.Kind == KindConditionalType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeOperatorNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeOperatorNode struct {
|
|
TypeNodeBase
|
|
Operator Kind
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeOperatorNode(operator Kind, typeNode *TypeNode) *Node {
|
|
data := f.typeOperatorNodeArena.New()
|
|
data.Operator = operator
|
|
data.Type = typeNode
|
|
return f.newNode(KindTypeOperator, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeOperatorNode(node *TypeOperatorNode, operator Kind, typeNode *TypeNode) *Node {
|
|
if operator != node.Operator || typeNode != node.Type {
|
|
return updateNode(f.NewTypeOperatorNode(operator, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeOperatorNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *TypeOperatorNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeOperatorNode(node, node.Operator, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *TypeOperatorNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeOperatorNode(node.Operator, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypeOperatorNode(node *Node) bool {
|
|
return node.Kind == KindTypeOperator
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// InferTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type InferTypeNode struct {
|
|
TypeNodeBase
|
|
TypeParameter *TypeParameterDeclarationNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewInferTypeNode(typeParameter *TypeParameterDeclarationNode) *Node {
|
|
data := &InferTypeNode{}
|
|
data.TypeParameter = typeParameter
|
|
return f.newNode(KindInferType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateInferTypeNode(node *InferTypeNode, typeParameter *TypeParameterDeclarationNode) *Node {
|
|
if typeParameter != node.TypeParameter {
|
|
return updateNode(f.NewInferTypeNode(typeParameter), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *InferTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TypeParameter)
|
|
}
|
|
|
|
func (node *InferTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateInferTypeNode(node, v.visitNode(node.TypeParameter))
|
|
}
|
|
|
|
func (node *InferTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewInferTypeNode(node.TypeParameter), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsInferTypeNode(node *Node) bool {
|
|
return node.Kind == KindInferType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ArrayTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ArrayTypeNode struct {
|
|
TypeNodeBase
|
|
ElementType *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewArrayTypeNode(elementType *TypeNode) *Node {
|
|
data := f.arrayTypeNodeArena.New()
|
|
data.ElementType = elementType
|
|
return f.newNode(KindArrayType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateArrayTypeNode(node *ArrayTypeNode, elementType *TypeNode) *Node {
|
|
if elementType != node.ElementType {
|
|
return updateNode(f.NewArrayTypeNode(elementType), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ArrayTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.ElementType)
|
|
}
|
|
|
|
func (node *ArrayTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateArrayTypeNode(node, v.visitNode(node.ElementType))
|
|
}
|
|
|
|
func (node *ArrayTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewArrayTypeNode(node.ElementType), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsArrayTypeNode(node *Node) bool {
|
|
return node.Kind == KindArrayType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// IndexedAccessTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type IndexedAccessTypeNode struct {
|
|
TypeNodeBase
|
|
ObjectType *TypeNode
|
|
IndexType *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewIndexedAccessTypeNode(objectType *TypeNode, indexType *TypeNode) *Node {
|
|
data := f.indexedAccessTypeNodeArena.New()
|
|
data.ObjectType = objectType
|
|
data.IndexType = indexType
|
|
return f.newNode(KindIndexedAccessType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateIndexedAccessTypeNode(node *IndexedAccessTypeNode, objectType *TypeNode, indexType *TypeNode) *Node {
|
|
if objectType != node.ObjectType || indexType != node.IndexType {
|
|
return updateNode(f.NewIndexedAccessTypeNode(objectType, indexType), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *IndexedAccessTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.ObjectType) || visit(v, node.IndexType)
|
|
}
|
|
|
|
func (node *IndexedAccessTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateIndexedAccessTypeNode(node, v.visitNode(node.ObjectType), v.visitNode(node.IndexType))
|
|
}
|
|
|
|
func (node *IndexedAccessTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewIndexedAccessTypeNode(node.ObjectType, node.IndexType), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsIndexedAccessTypeNode(node *Node) bool {
|
|
return node.Kind == KindIndexedAccessType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeReferenceNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeReferenceNode struct {
|
|
NodeWithTypeArgumentsBase
|
|
TypeName *EntityName
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeReferenceNode(typeName *EntityName, typeArguments *TypeList) *Node {
|
|
data := f.typeReferenceNodeArena.New()
|
|
data.TypeName = typeName
|
|
data.TypeArguments = typeArguments
|
|
return f.newNode(KindTypeReference, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeReferenceNode(node *TypeReferenceNode, typeName *EntityName, typeArguments *TypeList) *Node {
|
|
if typeName != node.TypeName || typeArguments != node.TypeArguments {
|
|
return updateNode(f.NewTypeReferenceNode(typeName, typeArguments), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeReferenceNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TypeName) || visitNodeList(v, node.TypeArguments)
|
|
}
|
|
|
|
func (node *TypeReferenceNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeReferenceNode(node, v.visitNode(node.TypeName), v.visitNodes(node.TypeArguments))
|
|
}
|
|
|
|
func (node *TypeReferenceNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeReferenceNode(node.TypeName, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypeReferenceNode(node *Node) bool {
|
|
return node.Kind == KindTypeReference
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExpressionWithTypeArguments
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExpressionWithTypeArguments struct {
|
|
MemberExpressionBase
|
|
CompositeBase
|
|
Expression *Expression
|
|
TypeArguments *TypeList // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewExpressionWithTypeArguments(expression *Expression, typeArguments *TypeList) *Node {
|
|
data := f.expressionWithTypeArgumentsArena.New()
|
|
data.Expression = expression
|
|
data.TypeArguments = typeArguments
|
|
return f.newNode(KindExpressionWithTypeArguments, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExpressionWithTypeArguments(node *ExpressionWithTypeArguments, expression *Expression, typeArguments *TypeList) *Node {
|
|
if expression != node.Expression || typeArguments != node.TypeArguments {
|
|
return updateNode(f.NewExpressionWithTypeArguments(expression, typeArguments), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExpressionWithTypeArguments) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visitNodeList(v, node.TypeArguments)
|
|
}
|
|
|
|
func (node *ExpressionWithTypeArguments) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExpressionWithTypeArguments(node, v.visitNode(node.Expression), v.visitNodes(node.TypeArguments))
|
|
}
|
|
|
|
func (node *ExpressionWithTypeArguments) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExpressionWithTypeArguments(node.Expression, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsExpressionWithTypeArguments(node *Node) bool {
|
|
return node.Kind == KindExpressionWithTypeArguments
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// LiteralTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type LiteralTypeNode struct {
|
|
TypeNodeBase
|
|
Literal *Node
|
|
}
|
|
|
|
func (f *NodeFactory) NewLiteralTypeNode(literal *Node) *Node {
|
|
data := f.literalTypeNodeArena.New()
|
|
data.Literal = literal
|
|
return f.newNode(KindLiteralType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateLiteralTypeNode(node *LiteralTypeNode, literal *Node) *Node {
|
|
if literal != node.Literal {
|
|
return updateNode(f.NewLiteralTypeNode(literal), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *LiteralTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Literal)
|
|
}
|
|
|
|
func (node *LiteralTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateLiteralTypeNode(node, v.visitNode(node.Literal))
|
|
}
|
|
|
|
func (node *LiteralTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewLiteralTypeNode(node.Literal), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsLiteralTypeNode(node *Node) bool {
|
|
return node.Kind == KindLiteralType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ThisTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ThisTypeNode struct {
|
|
TypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewThisTypeNode() *Node {
|
|
data := &ThisTypeNode{}
|
|
return f.newNode(KindThisType, data.AsNode())
|
|
}
|
|
|
|
func (node *ThisTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewThisTypeNode(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsThisTypeNode(node *Node) bool {
|
|
return node.Kind == KindThisType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypePredicateNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypePredicateNode struct {
|
|
TypeNodeBase
|
|
AssertsModifier *AssertsKeyword // Optional
|
|
ParameterName *TypePredicateParameterName
|
|
Type *TypeNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypePredicateNode(assertsModifier *AssertsKeyword, parameterName *TypePredicateParameterName, typeNode *TypeNode) *Node {
|
|
data := &TypePredicateNode{}
|
|
data.AssertsModifier = assertsModifier
|
|
data.ParameterName = parameterName
|
|
data.Type = typeNode
|
|
return f.newNode(KindTypePredicate, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypePredicateNode(node *TypePredicateNode, assertsModifier *AssertsKeyword, parameterName *TypePredicateParameterName, typeNode *TypeNode) *Node {
|
|
if assertsModifier != node.AssertsModifier || parameterName != node.ParameterName || typeNode != node.Type {
|
|
return updateNode(f.NewTypePredicateNode(assertsModifier, parameterName, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypePredicateNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.AssertsModifier) || visit(v, node.ParameterName) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *TypePredicateNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypePredicateNode(node, v.visitNode(node.AssertsModifier), v.visitNode(node.ParameterName), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *TypePredicateNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypePredicateNode(node.AssertsModifier, node.ParameterName, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypePredicateNode(node *Node) bool {
|
|
return node.Kind == KindTypePredicate
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportAttribute
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportAttribute struct {
|
|
NodeBase
|
|
CompositeBase
|
|
name *ImportAttributeName
|
|
Value *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportAttribute(name *ImportAttributeName, value *Expression) *Node {
|
|
data := &ImportAttribute{}
|
|
data.name = name
|
|
data.Value = value
|
|
return f.newNode(KindImportAttribute, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportAttribute(node *ImportAttribute, name *ImportAttributeName, value *Expression) *Node {
|
|
if name != node.name || value != node.Value {
|
|
return updateNode(f.NewImportAttribute(name, value), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportAttribute) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name) || visit(v, node.Value)
|
|
}
|
|
|
|
func (node *ImportAttribute) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportAttribute(node, v.visitNode(node.name), v.visitNode(node.Value))
|
|
}
|
|
|
|
func (node *ImportAttribute) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportAttribute(node.name, node.Value), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ImportAttribute) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.name) |
|
|
propagateSubtreeFacts(node.Value)
|
|
}
|
|
|
|
func (node *ImportAttribute) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsImportAttribute(node *Node) bool {
|
|
return node.Kind == KindImportAttribute
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportAttributes
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportAttributes struct {
|
|
NodeBase
|
|
CompositeBase
|
|
Token Kind
|
|
Attributes *ImportAttributeList
|
|
MultiLine bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportAttributes(token Kind, attributes *ImportAttributeList, multiLine bool) *Node {
|
|
data := &ImportAttributes{}
|
|
data.Token = token
|
|
data.Attributes = attributes
|
|
data.MultiLine = multiLine
|
|
return f.newNode(KindImportAttributes, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportAttributes(node *ImportAttributes, token Kind, attributes *ImportAttributeList, multiLine bool) *Node {
|
|
if token != node.Token || attributes != node.Attributes || multiLine != node.MultiLine {
|
|
return updateNode(f.NewImportAttributes(token, attributes, multiLine), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportAttributes) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Attributes)
|
|
}
|
|
|
|
func (node *ImportAttributes) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportAttributes(node, node.Token, v.visitNodes(node.Attributes), node.MultiLine)
|
|
}
|
|
|
|
func (node *ImportAttributes) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportAttributes(node.Token, node.Attributes, node.MultiLine), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ImportAttributes) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateNodeListSubtreeFacts(node.Attributes, propagateSubtreeFacts)
|
|
}
|
|
|
|
func IsImportAttributes(node *Node) bool {
|
|
return node.Kind == KindImportAttributes
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeQueryNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeQueryNode struct {
|
|
NodeWithTypeArgumentsBase
|
|
ExprName *EntityName
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeQueryNode(exprName *EntityName, typeArguments *TypeList) *Node {
|
|
data := &TypeQueryNode{}
|
|
data.ExprName = exprName
|
|
data.TypeArguments = typeArguments
|
|
return f.newNode(KindTypeQuery, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeQueryNode(node *TypeQueryNode, exprName *EntityName, typeArguments *TypeList) *Node {
|
|
if exprName != node.ExprName || typeArguments != node.TypeArguments {
|
|
return updateNode(f.NewTypeQueryNode(exprName, typeArguments), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeQueryNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.ExprName) || visitNodeList(v, node.TypeArguments)
|
|
}
|
|
|
|
func (node *TypeQueryNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeQueryNode(node, v.visitNode(node.ExprName), v.visitNodes(node.TypeArguments))
|
|
}
|
|
|
|
func (node *TypeQueryNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeQueryNode(node.ExprName, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypeQueryNode(node *Node) bool {
|
|
return node.Kind == KindTypeQuery
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// MappedTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type MappedTypeNode struct {
|
|
TypeNodeBase
|
|
DeclarationBase
|
|
LocalsContainerBase
|
|
ReadonlyToken *TokenNode // Optional
|
|
TypeParameter *TypeParameterDeclarationNode
|
|
NameType *TypeNode // Optional
|
|
QuestionToken *TokenNode // Optional
|
|
Type *TypeNode // Optional
|
|
Members *TypeElementList // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewMappedTypeNode(readonlyToken *TokenNode, typeParameter *TypeParameterDeclarationNode, nameType *TypeNode, questionToken *TokenNode, typeNode *TypeNode, members *TypeElementList) *Node {
|
|
data := &MappedTypeNode{}
|
|
data.ReadonlyToken = readonlyToken
|
|
data.TypeParameter = typeParameter
|
|
data.NameType = nameType
|
|
data.QuestionToken = questionToken
|
|
data.Type = typeNode
|
|
data.Members = members
|
|
return f.newNode(KindMappedType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateMappedTypeNode(node *MappedTypeNode, readonlyToken *TokenNode, typeParameter *TypeParameterDeclarationNode, nameType *TypeNode, questionToken *TokenNode, typeNode *TypeNode, members *TypeElementList) *Node {
|
|
if readonlyToken != node.ReadonlyToken || typeParameter != node.TypeParameter || nameType != node.NameType || questionToken != node.QuestionToken || typeNode != node.Type || members != node.Members {
|
|
return updateNode(f.NewMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, typeNode, members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *MappedTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.ReadonlyToken) ||
|
|
visit(v, node.TypeParameter) ||
|
|
visit(v, node.NameType) ||
|
|
visit(v, node.QuestionToken) ||
|
|
visit(v, node.Type) ||
|
|
visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *MappedTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateMappedTypeNode(node, v.visitNode(node.ReadonlyToken), v.visitNode(node.TypeParameter), v.visitNode(node.NameType), v.visitNode(node.QuestionToken), v.visitNode(node.Type), v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *MappedTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewMappedTypeNode(node.ReadonlyToken, node.TypeParameter, node.NameType, node.QuestionToken, node.Type, node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsMappedTypeNode(node *Node) bool {
|
|
return node.Kind == KindMappedType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeLiteralNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeLiteralNode struct {
|
|
TypeNodeBase
|
|
DeclarationBase
|
|
Members *TypeElementList
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeLiteralNode(members *TypeElementList) *Node {
|
|
data := f.typeLiteralNodeArena.New()
|
|
data.Members = members
|
|
return f.newNode(KindTypeLiteral, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeLiteralNode(node *TypeLiteralNode, members *TypeElementList) *Node {
|
|
if members != node.Members {
|
|
return updateNode(f.NewTypeLiteralNode(members), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeLiteralNode) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Members)
|
|
}
|
|
|
|
func (node *TypeLiteralNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeLiteralNode(node, v.visitNodes(node.Members))
|
|
}
|
|
|
|
func (node *TypeLiteralNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeLiteralNode(node.Members), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTypeLiteralNode(node *Node) bool {
|
|
return node.Kind == KindTypeLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TupleTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TupleTypeNode struct {
|
|
TypeNodeBase
|
|
Elements *TypeList
|
|
}
|
|
|
|
func (f *NodeFactory) NewTupleTypeNode(elements *TypeList) *Node {
|
|
data := &TupleTypeNode{}
|
|
data.Elements = elements
|
|
return f.newNode(KindTupleType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTupleTypeNode(node *TupleTypeNode, elements *TypeList) *Node {
|
|
if elements != node.Elements {
|
|
return updateNode(f.NewTupleTypeNode(elements), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TupleTypeNode) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Elements)
|
|
}
|
|
|
|
func (node *TupleTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTupleTypeNode(node, v.visitNodes(node.Elements))
|
|
}
|
|
|
|
func (node *TupleTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTupleTypeNode(node.Elements), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTupleTypeNode(node *Node) bool {
|
|
return node.Kind == KindTupleType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// NamedTupleMember
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type NamedTupleMember struct {
|
|
TypeNodeBase
|
|
DeclarationBase
|
|
DotDotDotToken *DotDotDotToken // Optional
|
|
name *IdentifierNode
|
|
QuestionToken *QuestionToken // Optional
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewNamedTupleMember(dotDotDotToken *DotDotDotToken, name *IdentifierNode, questionToken *QuestionToken, typeNode *TypeNode) *Node {
|
|
data := &NamedTupleMember{}
|
|
data.DotDotDotToken = dotDotDotToken
|
|
data.name = name
|
|
data.QuestionToken = questionToken
|
|
data.Type = typeNode
|
|
return f.newNode(KindNamedTupleMember, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateNamedTupleMember(node *NamedTupleMember, dotDotDotToken *DotDotDotToken, name *IdentifierNode, questionToken *QuestionToken, typeNode *TypeNode) *Node {
|
|
if dotDotDotToken != node.DotDotDotToken || name != node.name || questionToken != node.QuestionToken || typeNode != node.Type {
|
|
return updateNode(f.NewNamedTupleMember(dotDotDotToken, name, questionToken, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *NamedTupleMember) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.DotDotDotToken) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.QuestionToken) ||
|
|
visit(v, node.Type)
|
|
}
|
|
|
|
func (node *NamedTupleMember) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateNamedTupleMember(node, v.visitNode(node.DotDotDotToken), v.visitNode(node.name), v.visitNode(node.QuestionToken), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *NamedTupleMember) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewNamedTupleMember(node.DotDotDotToken, node.name, node.QuestionToken, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *NamedTupleMember) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsNamedTupleMember(node *Node) bool {
|
|
return node.Kind == KindNamedTupleMember
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// OptionalTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type OptionalTypeNode struct {
|
|
TypeNodeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewOptionalTypeNode(typeNode *TypeNode) *Node {
|
|
data := &OptionalTypeNode{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindOptionalType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateOptionalTypeNode(node *OptionalTypeNode, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewOptionalTypeNode(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *OptionalTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *OptionalTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateOptionalTypeNode(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *OptionalTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewOptionalTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsOptionalTypeNode(node *Node) bool {
|
|
return node.Kind == KindOptionalType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// RestTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type RestTypeNode struct {
|
|
TypeNodeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewRestTypeNode(typeNode *TypeNode) *Node {
|
|
data := &RestTypeNode{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindRestType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateRestTypeNode(node *RestTypeNode, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewRestTypeNode(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *RestTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *RestTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateRestTypeNode(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *RestTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewRestTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsRestTypeNode(node *Node) bool {
|
|
return node.Kind == KindRestType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ParenthesizedTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ParenthesizedTypeNode struct {
|
|
TypeNodeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewParenthesizedTypeNode(typeNode *TypeNode) *Node {
|
|
data := f.parenthesizedTypeNodeArena.New()
|
|
data.Type = typeNode
|
|
return f.newNode(KindParenthesizedType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateParenthesizedTypeNode(node *ParenthesizedTypeNode, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewParenthesizedTypeNode(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ParenthesizedTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *ParenthesizedTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateParenthesizedTypeNode(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *ParenthesizedTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewParenthesizedTypeNode(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsParenthesizedTypeNode(node *Node) bool {
|
|
return node.Kind == KindParenthesizedType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// FunctionTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type FunctionTypeNode struct {
|
|
FunctionOrConstructorTypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewFunctionTypeNode(typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := f.functionTypeNodeArena.New()
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindFunctionType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateFunctionTypeNode(node *FunctionTypeNode, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewFunctionTypeNode(typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *FunctionTypeNode) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *FunctionTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateFunctionTypeNode(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *FunctionTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewFunctionTypeNode(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsFunctionTypeNode(node *Node) bool {
|
|
return node.Kind == KindFunctionType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ConstructorTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ConstructorTypeNode struct {
|
|
FunctionOrConstructorTypeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewConstructorTypeNode(modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := &ConstructorTypeNode{}
|
|
data.modifiers = modifiers
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindConstructorType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateConstructorTypeNode(node *ConstructorTypeNode, modifiers *ModifierList, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if modifiers != node.modifiers || typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewConstructorTypeNode(modifiers, typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ConstructorTypeNode) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Parameters) ||
|
|
visit(v, node.Type)
|
|
}
|
|
|
|
func (node *ConstructorTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateConstructorTypeNode(node, v.visitModifiers(node.modifiers), v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *ConstructorTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewConstructorTypeNode(node.Modifiers(), node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsConstructorTypeNode(node *Node) bool {
|
|
return node.Kind == KindConstructorType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateHead
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateHead struct {
|
|
NodeBase
|
|
TemplateLiteralLikeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateHead(text string, rawText string, templateFlags TokenFlags) *Node {
|
|
data := &TemplateHead{}
|
|
data.Text = text
|
|
data.RawText = rawText
|
|
data.TemplateFlags = templateFlags & TokenFlagsTemplateLiteralLikeFlags
|
|
f.textCount++
|
|
return f.newNode(KindTemplateHead, data.AsNode())
|
|
}
|
|
|
|
func (node *TemplateHead) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateHead(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTemplateHead(node *Node) bool {
|
|
return node.Kind == KindTemplateHead
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateMiddle
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateMiddle struct {
|
|
NodeBase
|
|
TemplateLiteralLikeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateMiddle(text string, rawText string, templateFlags TokenFlags) *Node {
|
|
data := &TemplateMiddle{}
|
|
data.Text = text
|
|
data.RawText = rawText
|
|
data.TemplateFlags = templateFlags & TokenFlagsTemplateLiteralLikeFlags
|
|
f.textCount++
|
|
return f.newNode(KindTemplateMiddle, data.AsNode())
|
|
}
|
|
|
|
func (node *TemplateMiddle) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateMiddle(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTemplateMiddle(node *Node) bool {
|
|
return node.Kind == KindTemplateMiddle
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateTail
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateTail struct {
|
|
NodeBase
|
|
TemplateLiteralLikeNodeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateTail(text string, rawText string, templateFlags TokenFlags) *Node {
|
|
data := &TemplateTail{}
|
|
data.Text = text
|
|
data.RawText = rawText
|
|
data.TemplateFlags = templateFlags & TokenFlagsTemplateLiteralLikeFlags
|
|
f.textCount++
|
|
return f.newNode(KindTemplateTail, data.AsNode())
|
|
}
|
|
|
|
func (node *TemplateTail) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateTail(node.Text, node.RawText, node.TemplateFlags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTemplateTail(node *Node) bool {
|
|
return node.Kind == KindTemplateTail
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateLiteralTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateLiteralTypeNode struct {
|
|
TypeNodeBase
|
|
Head *TemplateHeadNode
|
|
TemplateSpans *TemplateLiteralTypeSpanList
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateLiteralTypeNode(head *TemplateHeadNode, templateSpans *TemplateLiteralTypeSpanList) *Node {
|
|
data := &TemplateLiteralTypeNode{}
|
|
data.Head = head
|
|
data.TemplateSpans = templateSpans
|
|
return f.newNode(KindTemplateLiteralType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTemplateLiteralTypeNode(node *TemplateLiteralTypeNode, head *TemplateHeadNode, templateSpans *TemplateLiteralTypeSpanList) *Node {
|
|
if head != node.Head || templateSpans != node.TemplateSpans {
|
|
return updateNode(f.NewTemplateLiteralTypeNode(head, templateSpans), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Head) || visitNodeList(v, node.TemplateSpans)
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTemplateLiteralTypeNode(node, v.visitNode(node.Head), v.visitNodes(node.TemplateSpans))
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateLiteralTypeNode(node.Head, node.TemplateSpans), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTemplateLiteralTypeNode(node *Node) bool {
|
|
return node.Kind == KindTemplateLiteralType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TemplateLiteralTypeSpan
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TemplateLiteralTypeSpan struct {
|
|
TypeNodeBase
|
|
Type *TypeNode
|
|
Literal *TemplateMiddleOrTail
|
|
}
|
|
|
|
func (f *NodeFactory) NewTemplateLiteralTypeSpan(typeNode *TypeNode, literal *TemplateMiddleOrTail) *Node {
|
|
data := &TemplateLiteralTypeSpan{}
|
|
data.Type = typeNode
|
|
data.Literal = literal
|
|
return f.newNode(KindTemplateLiteralTypeSpan, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTemplateLiteralTypeSpan(node *TemplateLiteralTypeSpan, typeNode *TypeNode, literal *TemplateMiddleOrTail) *Node {
|
|
if typeNode != node.Type || literal != node.Literal {
|
|
return updateNode(f.NewTemplateLiteralTypeSpan(typeNode, literal), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeSpan) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type) || visit(v, node.Literal)
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeSpan) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTemplateLiteralTypeSpan(node, v.visitNode(node.Type), v.visitNode(node.Literal))
|
|
}
|
|
|
|
func (node *TemplateLiteralTypeSpan) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTemplateLiteralTypeSpan(node.Type, node.Literal), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsTemplateLiteralTypeSpan(node *Node) bool {
|
|
return node.Kind == KindTemplateLiteralTypeSpan
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SyntheticExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SyntheticExpression struct {
|
|
ExpressionBase
|
|
Type any
|
|
IsSpread bool
|
|
TupleNameSource *Node // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewSyntheticExpression(typeNode any, isSpread bool, tupleNameSource *Node) *Node {
|
|
data := &SyntheticExpression{}
|
|
data.Type = typeNode
|
|
data.IsSpread = isSpread
|
|
data.TupleNameSource = tupleNameSource
|
|
return f.newNode(KindSyntheticExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSyntheticExpression(node *SyntheticExpression, typeNode any, isSpread bool, tupleNameSource *Node) *Node {
|
|
if typeNode != node.Type || isSpread != node.IsSpread || tupleNameSource != node.TupleNameSource {
|
|
return updateNode(f.NewSyntheticExpression(typeNode, isSpread, tupleNameSource), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SyntheticExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TupleNameSource)
|
|
}
|
|
|
|
func (node *SyntheticExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSyntheticExpression(node, node.Type, node.IsSpread, v.visitNode(node.TupleNameSource))
|
|
}
|
|
|
|
func (node *SyntheticExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSyntheticExpression(node.Type, node.IsSpread, node.TupleNameSource), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSyntheticExpression(node *Node) bool {
|
|
return node.Kind == KindSyntheticExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// PartiallyEmittedExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type PartiallyEmittedExpression struct {
|
|
LeftHandSideExpressionBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewPartiallyEmittedExpression(expression *Expression) *Node {
|
|
data := &PartiallyEmittedExpression{}
|
|
data.Expression = expression
|
|
return f.newNode(KindPartiallyEmittedExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdatePartiallyEmittedExpression(node *PartiallyEmittedExpression, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewPartiallyEmittedExpression(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *PartiallyEmittedExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *PartiallyEmittedExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdatePartiallyEmittedExpression(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *PartiallyEmittedExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewPartiallyEmittedExpression(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *PartiallyEmittedExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression)
|
|
}
|
|
|
|
func IsPartiallyEmittedExpression(node *Node) bool {
|
|
return node.Kind == KindPartiallyEmittedExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxElement struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
OpeningElement *JsxOpeningElementNode
|
|
Children *JsxChildList
|
|
ClosingElement *JsxClosingElementNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxElement(openingElement *JsxOpeningElementNode, children *JsxChildList, closingElement *JsxClosingElementNode) *Node {
|
|
data := &JsxElement{}
|
|
data.OpeningElement = openingElement
|
|
data.Children = children
|
|
data.ClosingElement = closingElement
|
|
return f.newNode(KindJsxElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxElement(node *JsxElement, openingElement *JsxOpeningElementNode, children *JsxChildList, closingElement *JsxClosingElementNode) *Node {
|
|
if openingElement != node.OpeningElement || children != node.Children || closingElement != node.ClosingElement {
|
|
return updateNode(f.NewJsxElement(openingElement, children, closingElement), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.OpeningElement) || visitNodeList(v, node.Children) || visit(v, node.ClosingElement)
|
|
}
|
|
|
|
func (node *JsxElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxElement(node, v.visitNode(node.OpeningElement), v.visitNodes(node.Children), v.visitNode(node.ClosingElement))
|
|
}
|
|
|
|
func (node *JsxElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxElement(node.OpeningElement, node.Children, node.ClosingElement), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxElement(node *Node) bool {
|
|
return node.Kind == KindJsxElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxAttributes
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxAttributes struct {
|
|
PrimaryExpressionBase
|
|
DeclarationBase
|
|
CompositeBase
|
|
Properties *JsxAttributeList
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxAttributes(properties *JsxAttributeList) *Node {
|
|
data := &JsxAttributes{}
|
|
data.Properties = properties
|
|
return f.newNode(KindJsxAttributes, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxAttributes(node *JsxAttributes, properties *JsxAttributeList) *Node {
|
|
if properties != node.Properties {
|
|
return updateNode(f.NewJsxAttributes(properties), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxAttributes) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Properties)
|
|
}
|
|
|
|
func (node *JsxAttributes) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxAttributes(node, v.visitNodes(node.Properties))
|
|
}
|
|
|
|
func (node *JsxAttributes) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxAttributes(node.Properties), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxAttributes(node *Node) bool {
|
|
return node.Kind == KindJsxAttributes
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxNamespacedName
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxNamespacedName struct {
|
|
ExpressionBase
|
|
CompositeBase
|
|
Namespace *IdentifierNode
|
|
name *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxNamespacedName(namespace *IdentifierNode, name *IdentifierNode) *Node {
|
|
data := &JsxNamespacedName{}
|
|
data.Namespace = namespace
|
|
data.name = name
|
|
return f.newNode(KindJsxNamespacedName, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxNamespacedName(node *JsxNamespacedName, namespace *IdentifierNode, name *IdentifierNode) *Node {
|
|
if namespace != node.Namespace || name != node.name {
|
|
return updateNode(f.NewJsxNamespacedName(namespace, name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxNamespacedName) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Namespace) || visit(v, node.name)
|
|
}
|
|
|
|
func (node *JsxNamespacedName) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxNamespacedName(node, v.visitNode(node.Namespace), v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *JsxNamespacedName) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxNamespacedName(node.Namespace, node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JsxNamespacedName) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJsxNamespacedName(node *Node) bool {
|
|
return node.Kind == KindJsxNamespacedName
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxOpeningElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxOpeningElement struct {
|
|
ExpressionBase
|
|
CompositeBase
|
|
TagName *JsxTagNameExpression
|
|
TypeArguments *TypeList // Optional
|
|
Attributes *JsxAttributesNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxOpeningElement(tagName *JsxTagNameExpression, typeArguments *TypeList, attributes *JsxAttributesNode) *Node {
|
|
data := &JsxOpeningElement{}
|
|
data.TagName = tagName
|
|
data.TypeArguments = typeArguments
|
|
data.Attributes = attributes
|
|
return f.newNode(KindJsxOpeningElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxOpeningElement(node *JsxOpeningElement, tagName *JsxTagNameExpression, typeArguments *TypeList, attributes *JsxAttributesNode) *Node {
|
|
if tagName != node.TagName || typeArguments != node.TypeArguments || attributes != node.Attributes {
|
|
return updateNode(f.NewJsxOpeningElement(tagName, typeArguments, attributes), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxOpeningElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.TypeArguments) || visit(v, node.Attributes)
|
|
}
|
|
|
|
func (node *JsxOpeningElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxOpeningElement(node, v.visitNode(node.TagName), v.visitNodes(node.TypeArguments), v.visitNode(node.Attributes))
|
|
}
|
|
|
|
func (node *JsxOpeningElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxOpeningElement(node.TagName, node.TypeArguments, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxOpeningElement(node *Node) bool {
|
|
return node.Kind == KindJsxOpeningElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxSelfClosingElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxSelfClosingElement struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
TagName *JsxTagNameExpression
|
|
TypeArguments *TypeList // Optional
|
|
Attributes *JsxAttributesNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxSelfClosingElement(tagName *JsxTagNameExpression, typeArguments *TypeList, attributes *JsxAttributesNode) *Node {
|
|
data := &JsxSelfClosingElement{}
|
|
data.TagName = tagName
|
|
data.TypeArguments = typeArguments
|
|
data.Attributes = attributes
|
|
return f.newNode(KindJsxSelfClosingElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxSelfClosingElement(node *JsxSelfClosingElement, tagName *JsxTagNameExpression, typeArguments *TypeList, attributes *JsxAttributesNode) *Node {
|
|
if tagName != node.TagName || typeArguments != node.TypeArguments || attributes != node.Attributes {
|
|
return updateNode(f.NewJsxSelfClosingElement(tagName, typeArguments, attributes), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxSelfClosingElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.TypeArguments) || visit(v, node.Attributes)
|
|
}
|
|
|
|
func (node *JsxSelfClosingElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxSelfClosingElement(node, v.visitNode(node.TagName), v.visitNodes(node.TypeArguments), v.visitNode(node.Attributes))
|
|
}
|
|
|
|
func (node *JsxSelfClosingElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxSelfClosingElement(node.TagName, node.TypeArguments, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxSelfClosingElement(node *Node) bool {
|
|
return node.Kind == KindJsxSelfClosingElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxFragment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxFragment struct {
|
|
PrimaryExpressionBase
|
|
CompositeBase
|
|
OpeningFragment *JsxOpeningFragmentNode
|
|
Children *JsxChildList
|
|
ClosingFragment *JsxClosingFragmentNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxFragment(openingFragment *JsxOpeningFragmentNode, children *JsxChildList, closingFragment *JsxClosingFragmentNode) *Node {
|
|
data := &JsxFragment{}
|
|
data.OpeningFragment = openingFragment
|
|
data.Children = children
|
|
data.ClosingFragment = closingFragment
|
|
return f.newNode(KindJsxFragment, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxFragment(node *JsxFragment, openingFragment *JsxOpeningFragmentNode, children *JsxChildList, closingFragment *JsxClosingFragmentNode) *Node {
|
|
if openingFragment != node.OpeningFragment || children != node.Children || closingFragment != node.ClosingFragment {
|
|
return updateNode(f.NewJsxFragment(openingFragment, children, closingFragment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxFragment) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.OpeningFragment) || visitNodeList(v, node.Children) || visit(v, node.ClosingFragment)
|
|
}
|
|
|
|
func (node *JsxFragment) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxFragment(node, v.visitNode(node.OpeningFragment), v.visitNodes(node.Children), v.visitNode(node.ClosingFragment))
|
|
}
|
|
|
|
func (node *JsxFragment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxFragment(node.OpeningFragment, node.Children, node.ClosingFragment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxFragment(node *Node) bool {
|
|
return node.Kind == KindJsxFragment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxOpeningFragment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxOpeningFragment struct {
|
|
ExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxOpeningFragment() *Node {
|
|
data := &JsxOpeningFragment{}
|
|
return f.newNode(KindJsxOpeningFragment, data.AsNode())
|
|
}
|
|
|
|
func (node *JsxOpeningFragment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxOpeningFragment(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxOpeningFragment(node *Node) bool {
|
|
return node.Kind == KindJsxOpeningFragment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxClosingFragment
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxClosingFragment struct {
|
|
ExpressionBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxClosingFragment() *Node {
|
|
data := &JsxClosingFragment{}
|
|
return f.newNode(KindJsxClosingFragment, data.AsNode())
|
|
}
|
|
|
|
func (node *JsxClosingFragment) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxClosingFragment(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxClosingFragment(node *Node) bool {
|
|
return node.Kind == KindJsxClosingFragment
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxAttribute
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxAttribute struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
CompositeBase
|
|
name *JsxAttributeName
|
|
Initializer *JsxAttributeValue // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxAttribute(name *JsxAttributeName, initializer *JsxAttributeValue) *Node {
|
|
data := &JsxAttribute{}
|
|
data.name = name
|
|
data.Initializer = initializer
|
|
return f.newNode(KindJsxAttribute, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxAttribute(node *JsxAttribute, name *JsxAttributeName, initializer *JsxAttributeValue) *Node {
|
|
if name != node.name || initializer != node.Initializer {
|
|
return updateNode(f.NewJsxAttribute(name, initializer), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxAttribute) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name) || visit(v, node.Initializer)
|
|
}
|
|
|
|
func (node *JsxAttribute) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxAttribute(node, v.visitNode(node.name), v.visitNode(node.Initializer))
|
|
}
|
|
|
|
func (node *JsxAttribute) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxAttribute(node.name, node.Initializer), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JsxAttribute) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJsxAttribute(node *Node) bool {
|
|
return node.Kind == KindJsxAttribute
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxSpreadAttribute
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxSpreadAttribute struct {
|
|
ObjectLiteralElementBase
|
|
NodeBase
|
|
Expression *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxSpreadAttribute(expression *Expression) *Node {
|
|
data := &JsxSpreadAttribute{}
|
|
data.Expression = expression
|
|
return f.newNode(KindJsxSpreadAttribute, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxSpreadAttribute(node *JsxSpreadAttribute, expression *Expression) *Node {
|
|
if expression != node.Expression {
|
|
return updateNode(f.NewJsxSpreadAttribute(expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxSpreadAttribute) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *JsxSpreadAttribute) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxSpreadAttribute(node, v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *JsxSpreadAttribute) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxSpreadAttribute(node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxSpreadAttribute(node *Node) bool {
|
|
return node.Kind == KindJsxSpreadAttribute
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxClosingElement
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxClosingElement struct {
|
|
NodeBase
|
|
TagName *JsxTagNameExpression
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxClosingElement(tagName *JsxTagNameExpression) *Node {
|
|
data := &JsxClosingElement{}
|
|
data.TagName = tagName
|
|
return f.newNode(KindJsxClosingElement, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxClosingElement(node *JsxClosingElement, tagName *JsxTagNameExpression) *Node {
|
|
if tagName != node.TagName {
|
|
return updateNode(f.NewJsxClosingElement(tagName), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxClosingElement) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName)
|
|
}
|
|
|
|
func (node *JsxClosingElement) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxClosingElement(node, v.visitNode(node.TagName))
|
|
}
|
|
|
|
func (node *JsxClosingElement) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxClosingElement(node.TagName), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxClosingElement(node *Node) bool {
|
|
return node.Kind == KindJsxClosingElement
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxExpression struct {
|
|
ExpressionBase
|
|
DotDotDotToken *DotDotDotToken // Optional
|
|
Expression *Expression // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxExpression(dotDotDotToken *DotDotDotToken, expression *Expression) *Node {
|
|
data := &JsxExpression{}
|
|
data.DotDotDotToken = dotDotDotToken
|
|
data.Expression = expression
|
|
return f.newNode(KindJsxExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJsxExpression(node *JsxExpression, dotDotDotToken *DotDotDotToken, expression *Expression) *Node {
|
|
if dotDotDotToken != node.DotDotDotToken || expression != node.Expression {
|
|
return updateNode(f.NewJsxExpression(dotDotDotToken, expression), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JsxExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.DotDotDotToken) || visit(v, node.Expression)
|
|
}
|
|
|
|
func (node *JsxExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJsxExpression(node, v.visitNode(node.DotDotDotToken), v.visitNode(node.Expression))
|
|
}
|
|
|
|
func (node *JsxExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxExpression(node.DotDotDotToken, node.Expression), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxExpression(node *Node) bool {
|
|
return node.Kind == KindJsxExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JsxText
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JsxText struct {
|
|
ExpressionBase
|
|
LiteralLikeNodeBase
|
|
ContainsOnlyTriviaWhiteSpaces bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewJsxText(text string, containsOnlyTriviaWhiteSpaces bool) *Node {
|
|
data := &JsxText{}
|
|
data.Text = text
|
|
data.ContainsOnlyTriviaWhiteSpaces = containsOnlyTriviaWhiteSpaces
|
|
f.textCount++
|
|
return f.newNode(KindJsxText, data.AsNode())
|
|
}
|
|
|
|
func (node *JsxText) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJsxText(node.Text, node.ContainsOnlyTriviaWhiteSpaces), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJsxText(node *Node) bool {
|
|
return node.Kind == KindJsxText
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SyntaxList
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SyntaxList struct {
|
|
NodeBase
|
|
Children []*Node
|
|
}
|
|
|
|
func (f *NodeFactory) NewSyntaxList(children []*Node) *Node {
|
|
data := &SyntaxList{}
|
|
data.Children = children
|
|
return f.newNode(KindSyntaxList, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSyntaxList(node *SyntaxList, children []*Node) *Node {
|
|
if !core.Same(children, node.Children) {
|
|
return updateNode(f.NewSyntaxList(children), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SyntaxList) ForEachChild(v Visitor) bool {
|
|
return visitNodes(v, node.Children)
|
|
}
|
|
|
|
func (node *SyntaxList) VisitEachChild(v *NodeVisitor) *Node {
|
|
children := core.SameMap(node.Children, func(n *Node) *Node { return v.visitNode(n) })
|
|
return v.Factory.UpdateSyntaxList(node, children)
|
|
}
|
|
|
|
func (node *SyntaxList) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSyntaxList(node.Children), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsSyntaxList(node *Node) bool {
|
|
return node.Kind == KindSyntaxList
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDoc
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDoc struct {
|
|
NodeBase
|
|
Comment *NodeList
|
|
Tags *NodeList // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDoc(comment *NodeList, tags *NodeList) *Node {
|
|
data := f.jsdocArena.New()
|
|
data.Comment = comment
|
|
data.Tags = tags
|
|
return f.newNode(KindJSDoc, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDoc(node *JSDoc, comment *NodeList, tags *NodeList) *Node {
|
|
if comment != node.Comment || tags != node.Tags {
|
|
return updateNode(f.NewJSDoc(comment, tags), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDoc) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.Comment) || visitNodeList(v, node.Tags)
|
|
}
|
|
|
|
func (node *JSDoc) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDoc(node, v.visitNodes(node.Comment), v.visitNodes(node.Tags))
|
|
}
|
|
|
|
func (node *JSDoc) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDoc(node.Comment, node.Tags), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDoc(node *Node) bool {
|
|
return node.Kind == KindJSDoc
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocTypeExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocTypeExpression struct {
|
|
TypeNodeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocTypeExpression(typeNode *TypeNode) *Node {
|
|
data := &JSDocTypeExpression{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocTypeExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocTypeExpression(node *JSDocTypeExpression, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewJSDocTypeExpression(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocTypeExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocTypeExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocTypeExpression(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocTypeExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocTypeExpression(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocTypeExpression(node *Node) bool {
|
|
return node.Kind == KindJSDocTypeExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocNonNullableType
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocNonNullableType struct {
|
|
JSDocTypeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocNonNullableType(typeNode *TypeNode) *Node {
|
|
data := &JSDocNonNullableType{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocNonNullableType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocNonNullableType(node *JSDocNonNullableType, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewJSDocNonNullableType(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocNonNullableType) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocNonNullableType) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocNonNullableType(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocNonNullableType) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocNonNullableType(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocNonNullableType(node *Node) bool {
|
|
return node.Kind == KindJSDocNonNullableType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocNullableType
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocNullableType struct {
|
|
JSDocTypeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocNullableType(typeNode *TypeNode) *Node {
|
|
data := &JSDocNullableType{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocNullableType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocNullableType(node *JSDocNullableType, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewJSDocNullableType(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocNullableType) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocNullableType) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocNullableType(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocNullableType) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocNullableType(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocNullableType(node *Node) bool {
|
|
return node.Kind == KindJSDocNullableType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocAllType
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocAllType struct {
|
|
JSDocTypeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocAllType() *Node {
|
|
data := &JSDocAllType{}
|
|
return f.newNode(KindJSDocAllType, data.AsNode())
|
|
}
|
|
|
|
func (node *JSDocAllType) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocAllType(), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocAllType(node *Node) bool {
|
|
return node.Kind == KindJSDocAllType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocVariadicType
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocVariadicType struct {
|
|
JSDocTypeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocVariadicType(typeNode *TypeNode) *Node {
|
|
data := &JSDocVariadicType{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocVariadicType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocVariadicType(node *JSDocVariadicType, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewJSDocVariadicType(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocVariadicType) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocVariadicType) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocVariadicType(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocVariadicType) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocVariadicType(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocVariadicType(node *Node) bool {
|
|
return node.Kind == KindJSDocVariadicType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocOptionalType
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocOptionalType struct {
|
|
JSDocTypeBase
|
|
Type *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocOptionalType(typeNode *TypeNode) *Node {
|
|
data := &JSDocOptionalType{}
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocOptionalType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocOptionalType(node *JSDocOptionalType, typeNode *TypeNode) *Node {
|
|
if typeNode != node.Type {
|
|
return updateNode(f.NewJSDocOptionalType(typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocOptionalType) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocOptionalType) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocOptionalType(node, v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocOptionalType) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocOptionalType(node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocOptionalType(node *Node) bool {
|
|
return node.Kind == KindJSDocOptionalType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocTypeTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocTypeTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *Node
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocTypeTag(tagName *IdentifierNode, typeExpression *Node, comment *NodeList) *Node {
|
|
data := &JSDocTypeTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocTypeTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocTypeTag(node *JSDocTypeTag, tagName *IdentifierNode, typeExpression *Node, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocTypeTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocTypeTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocTypeTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocTypeTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocTypeTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocTypeTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocTypeTag(node *Node) bool {
|
|
return node.Kind == KindJSDocTypeTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocUnknownTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocUnknownTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocUnknownTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := f.jsdocUnknownTagArena.New()
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocUnknownTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocUnknownTag(node *JSDocUnknownTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocUnknownTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocUnknownTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocUnknownTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocUnknownTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocUnknownTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocUnknownTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocUnknownTag(node *Node) bool {
|
|
return node.Kind == KindJSDocUnknownTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocTemplateTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocTemplateTag struct {
|
|
JSDocTagBase
|
|
Constraint *Node
|
|
TypeParameters *TypeParameterList
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocTemplateTag(tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node {
|
|
data := &JSDocTemplateTag{}
|
|
data.TagName = tagName
|
|
data.Constraint = constraint
|
|
data.TypeParameters = typeParameters
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocTemplateTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocTemplateTag(node *JSDocTemplateTag, tagName *IdentifierNode, constraint *Node, typeParameters *TypeParameterList, comment *NodeList) *Node {
|
|
if tagName != node.TagName || constraint != node.Constraint || typeParameters != node.TypeParameters || comment != node.Comment {
|
|
return updateNode(f.NewJSDocTemplateTag(tagName, constraint, typeParameters, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocTemplateTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) ||
|
|
visit(v, node.Constraint) ||
|
|
visitNodeList(v, node.TypeParameters) ||
|
|
visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocTemplateTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocTemplateTag(node, v.visitNode(node.TagName), v.visitNode(node.Constraint), v.visitNodes(node.TypeParameters), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocTemplateTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocTemplateTag(node.TagName, node.Constraint, node.TypeParameters, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocTemplateTag(node *Node) bool {
|
|
return node.Kind == KindJSDocTemplateTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocReturnTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocReturnTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocReturnTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocReturnTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocReturnTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocReturnTag(node *JSDocReturnTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocReturnTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocReturnTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocReturnTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocReturnTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocReturnTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocReturnTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocReturnTag(node *Node) bool {
|
|
return node.Kind == KindJSDocReturnTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocPublicTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocPublicTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocPublicTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := &JSDocPublicTag{}
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocPublicTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocPublicTag(node *JSDocPublicTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocPublicTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocPublicTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocPublicTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocPublicTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocPublicTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocPublicTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocPublicTag(node *Node) bool {
|
|
return node.Kind == KindJSDocPublicTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocPrivateTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocPrivateTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocPrivateTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := &JSDocPrivateTag{}
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocPrivateTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocPrivateTag(node *JSDocPrivateTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocPrivateTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocPrivateTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocPrivateTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocPrivateTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocPrivateTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocPrivateTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocPrivateTag(node *Node) bool {
|
|
return node.Kind == KindJSDocPrivateTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocProtectedTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocProtectedTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocProtectedTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := &JSDocProtectedTag{}
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocProtectedTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocProtectedTag(node *JSDocProtectedTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocProtectedTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocProtectedTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocProtectedTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocProtectedTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocProtectedTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocProtectedTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocProtectedTag(node *Node) bool {
|
|
return node.Kind == KindJSDocProtectedTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocReadonlyTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocReadonlyTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocReadonlyTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := &JSDocReadonlyTag{}
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocReadonlyTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocReadonlyTag(node *JSDocReadonlyTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocReadonlyTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocReadonlyTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocReadonlyTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocReadonlyTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocReadonlyTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocReadonlyTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocReadonlyTag(node *Node) bool {
|
|
return node.Kind == KindJSDocReadonlyTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocOverrideTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocOverrideTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocOverrideTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := &JSDocOverrideTag{}
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocOverrideTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocOverrideTag(node *JSDocOverrideTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocOverrideTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocOverrideTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocOverrideTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocOverrideTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocOverrideTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocOverrideTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocOverrideTag(node *Node) bool {
|
|
return node.Kind == KindJSDocOverrideTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocDeprecatedTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocDeprecatedTag struct {
|
|
JSDocTagBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocDeprecatedTag(tagName *IdentifierNode, comment *NodeList) *Node {
|
|
data := f.jsdocDeprecatedTagArena.New()
|
|
data.TagName = tagName
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocDeprecatedTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocDeprecatedTag(node *JSDocDeprecatedTag, tagName *IdentifierNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocDeprecatedTag(tagName, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocDeprecatedTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocDeprecatedTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocDeprecatedTag(node, v.visitNode(node.TagName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocDeprecatedTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocDeprecatedTag(node.TagName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocDeprecatedTag(node *Node) bool {
|
|
return node.Kind == KindJSDocDeprecatedTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocSeeTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocSeeTag struct {
|
|
JSDocTagBase
|
|
NameExpression *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocSeeTag(tagName *IdentifierNode, nameExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocSeeTag{}
|
|
data.TagName = tagName
|
|
data.NameExpression = nameExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocSeeTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocSeeTag(node *JSDocSeeTag, tagName *IdentifierNode, nameExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || nameExpression != node.NameExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocSeeTag(tagName, nameExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocSeeTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.NameExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocSeeTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocSeeTag(node, v.visitNode(node.TagName), v.visitNode(node.NameExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocSeeTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocSeeTag(node.TagName, node.NameExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocSeeTag(node *Node) bool {
|
|
return node.Kind == KindJSDocSeeTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocImplementsTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocImplementsTag struct {
|
|
JSDocTagBase
|
|
ClassName *ExpressionWithTypeArgumentsNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocImplementsTag(tagName *IdentifierNode, className *ExpressionWithTypeArgumentsNode, comment *NodeList) *Node {
|
|
data := &JSDocImplementsTag{}
|
|
data.TagName = tagName
|
|
data.ClassName = className
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocImplementsTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocImplementsTag(node *JSDocImplementsTag, tagName *IdentifierNode, className *ExpressionWithTypeArgumentsNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || className != node.ClassName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocImplementsTag(tagName, className, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocImplementsTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.ClassName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocImplementsTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocImplementsTag(node, v.visitNode(node.TagName), v.visitNode(node.ClassName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocImplementsTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocImplementsTag(node.TagName, node.ClassName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocImplementsTag(node *Node) bool {
|
|
return node.Kind == KindJSDocImplementsTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocAugmentsTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocAugmentsTag struct {
|
|
JSDocTagBase
|
|
ClassName *ExpressionWithTypeArgumentsNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocAugmentsTag(tagName *IdentifierNode, className *ExpressionWithTypeArgumentsNode, comment *NodeList) *Node {
|
|
data := &JSDocAugmentsTag{}
|
|
data.TagName = tagName
|
|
data.ClassName = className
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocAugmentsTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocAugmentsTag(node *JSDocAugmentsTag, tagName *IdentifierNode, className *ExpressionWithTypeArgumentsNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || className != node.ClassName || comment != node.Comment {
|
|
return updateNode(f.NewJSDocAugmentsTag(tagName, className, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocAugmentsTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.ClassName) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocAugmentsTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocAugmentsTag(node, v.visitNode(node.TagName), v.visitNode(node.ClassName), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocAugmentsTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocAugmentsTag(node.TagName, node.ClassName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocAugmentsTag(node *Node) bool {
|
|
return node.Kind == KindJSDocAugmentsTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocSatisfiesTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocSatisfiesTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocSatisfiesTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocSatisfiesTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocSatisfiesTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocSatisfiesTag(node *JSDocSatisfiesTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocSatisfiesTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocSatisfiesTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocSatisfiesTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocSatisfiesTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocSatisfiesTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocSatisfiesTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocSatisfiesTag(node *Node) bool {
|
|
return node.Kind == KindJSDocSatisfiesTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocThrowsTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocThrowsTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocThrowsTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocThrowsTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocThrowsTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocThrowsTag(node *JSDocThrowsTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocThrowsTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocThrowsTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocThrowsTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocThrowsTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocThrowsTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocThrowsTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocThrowsTag(node *Node) bool {
|
|
return node.Kind == KindJSDocThrowsTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocThisTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocThisTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocThisTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocThisTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocThisTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocThisTag(node *JSDocThisTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocThisTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocThisTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocThisTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocThisTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocThisTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocThisTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocThisTag(node *Node) bool {
|
|
return node.Kind == KindJSDocThisTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocImportTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocImportTag struct {
|
|
JSDocTagBase
|
|
ImportClause *ImportClauseNode // Optional
|
|
ModuleSpecifier *Expression
|
|
Attributes *ImportAttributesNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocImportTag(tagName *IdentifierNode, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode, comment *NodeList) *Node {
|
|
data := &JSDocImportTag{}
|
|
data.TagName = tagName
|
|
data.ImportClause = importClause
|
|
data.ModuleSpecifier = moduleSpecifier
|
|
data.Attributes = attributes
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocImportTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocImportTag(node *JSDocImportTag, tagName *IdentifierNode, importClause *ImportClauseNode, moduleSpecifier *Expression, attributes *ImportAttributesNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || importClause != node.ImportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes || comment != node.Comment {
|
|
return updateNode(f.NewJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocImportTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) ||
|
|
visit(v, node.ImportClause) ||
|
|
visit(v, node.ModuleSpecifier) ||
|
|
visit(v, node.Attributes) ||
|
|
visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocImportTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocImportTag(node, v.visitNode(node.TagName), v.visitNode(node.ImportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocImportTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocImportTag(node.TagName, node.ImportClause, node.ModuleSpecifier, node.Attributes, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocImportTag(node *Node) bool {
|
|
return node.Kind == KindJSDocImportTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocCallbackTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocCallbackTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode
|
|
name *JSDocFullName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocCallbackTag(tagName *IdentifierNode, typeExpression *TypeNode, name *JSDocFullName, comment *NodeList) *Node {
|
|
data := &JSDocCallbackTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.name = name
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocCallbackTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocCallbackTag(node *JSDocCallbackTag, tagName *IdentifierNode, typeExpression *TypeNode, name *JSDocFullName, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || name != node.name || comment != node.Comment {
|
|
return updateNode(f.NewJSDocCallbackTag(tagName, typeExpression, name, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocCallbackTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) ||
|
|
visit(v, node.TypeExpression) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocCallbackTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocCallbackTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.name), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocCallbackTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocCallbackTag(node.TagName, node.TypeExpression, node.name, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocCallbackTag) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocCallbackTag(node *Node) bool {
|
|
return node.Kind == KindJSDocCallbackTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocOverloadTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocOverloadTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *TypeNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocOverloadTag(tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
data := &JSDocOverloadTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocOverloadTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocOverloadTag(node *JSDocOverloadTag, tagName *IdentifierNode, typeExpression *TypeNode, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || comment != node.Comment {
|
|
return updateNode(f.NewJSDocOverloadTag(tagName, typeExpression, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocOverloadTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) || visit(v, node.TypeExpression) || visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocOverloadTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocOverloadTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocOverloadTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocOverloadTag(node.TagName, node.TypeExpression, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocOverloadTag(node *Node) bool {
|
|
return node.Kind == KindJSDocOverloadTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocTypedefTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocTypedefTag struct {
|
|
JSDocTagBase
|
|
TypeExpression *Node // Optional
|
|
name *JSDocFullName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocTypedefTag(tagName *IdentifierNode, typeExpression *Node, name *JSDocFullName, comment *NodeList) *Node {
|
|
data := &JSDocTypedefTag{}
|
|
data.TagName = tagName
|
|
data.TypeExpression = typeExpression
|
|
data.name = name
|
|
data.Comment = comment
|
|
return f.newNode(KindJSDocTypedefTag, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocTypedefTag(node *JSDocTypedefTag, tagName *IdentifierNode, typeExpression *Node, name *JSDocFullName, comment *NodeList) *Node {
|
|
if tagName != node.TagName || typeExpression != node.TypeExpression || name != node.name || comment != node.Comment {
|
|
return updateNode(f.NewJSDocTypedefTag(tagName, typeExpression, name, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocTypedefTag) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.TagName) ||
|
|
visit(v, node.TypeExpression) ||
|
|
visit(v, node.name) ||
|
|
visitNodeList(v, node.Comment)
|
|
}
|
|
|
|
func (node *JSDocTypedefTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocTypedefTag(node, v.visitNode(node.TagName), v.visitNode(node.TypeExpression), v.visitNode(node.name), v.visitNodes(node.Comment))
|
|
}
|
|
|
|
func (node *JSDocTypedefTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocTypedefTag(node.TagName, node.TypeExpression, node.name, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocTypedefTag) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocTypedefTag(node *Node) bool {
|
|
return node.Kind == KindJSDocTypedefTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocSignature
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocSignature struct {
|
|
JSDocTypeBase
|
|
DeclarationBase
|
|
FunctionLikeBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocSignature(typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
data := &JSDocSignature{}
|
|
data.TypeParameters = typeParameters
|
|
data.Parameters = parameters
|
|
data.Type = typeNode
|
|
return f.newNode(KindJSDocSignature, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocSignature(node *JSDocSignature, typeParameters *TypeParameterList, parameters *ParameterList, typeNode *TypeNode) *Node {
|
|
if typeParameters != node.TypeParameters || parameters != node.Parameters || typeNode != node.Type {
|
|
return updateNode(f.NewJSDocSignature(typeParameters, parameters, typeNode), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocSignature) ForEachChild(v Visitor) bool {
|
|
return visitNodeList(v, node.TypeParameters) || visitNodeList(v, node.Parameters) || visit(v, node.Type)
|
|
}
|
|
|
|
func (node *JSDocSignature) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocSignature(node, v.visitNodes(node.TypeParameters), v.visitNodes(node.Parameters), v.visitNode(node.Type))
|
|
}
|
|
|
|
func (node *JSDocSignature) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocSignature(node.TypeParameters, node.Parameters, node.Type), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocSignature(node *Node) bool {
|
|
return node.Kind == KindJSDocSignature
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocNameReference
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocNameReference struct {
|
|
TypeNodeBase
|
|
name *EntityName
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocNameReference(name *EntityName) *Node {
|
|
data := &JSDocNameReference{}
|
|
data.name = name
|
|
return f.newNode(KindJSDocNameReference, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocNameReference(node *JSDocNameReference, name *EntityName) *Node {
|
|
if name != node.name {
|
|
return updateNode(f.NewJSDocNameReference(name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocNameReference) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *JSDocNameReference) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocNameReference(node, v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *JSDocNameReference) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocNameReference(node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocNameReference) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocNameReference(node *Node) bool {
|
|
return node.Kind == KindJSDocNameReference
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SourceFile
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func IsSourceFile(node *Node) bool {
|
|
return node.Kind == KindSourceFile
|
|
}
|
|
|
|
// Struct and factory methods hand-written in ./ast.go
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ModuleDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ModuleDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
LocalsContainerBase
|
|
BodyBase
|
|
CompositeBase
|
|
Keyword Kind
|
|
name *ModuleName
|
|
}
|
|
|
|
func (f *NodeFactory) NewModuleDeclaration(modifiers *ModifierList, keyword Kind, name *ModuleName, body *ModuleBody) *Node {
|
|
data := &ModuleDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.Keyword = keyword
|
|
data.name = name
|
|
data.Body = body
|
|
return f.newNode(KindModuleDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateModuleDeclaration(node *ModuleDeclaration, modifiers *ModifierList, keyword Kind, name *ModuleName, body *ModuleBody) *Node {
|
|
if modifiers != node.modifiers || keyword != node.Keyword || name != node.name || body != node.Body {
|
|
return updateNode(f.NewModuleDeclaration(modifiers, keyword, name, body), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ModuleDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.Body)
|
|
}
|
|
|
|
func (node *ModuleDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateModuleDeclaration(node, v.visitModifiers(node.modifiers), node.Keyword, v.visitNode(node.name), v.visitNode(node.Body))
|
|
}
|
|
|
|
func (node *ModuleDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewModuleDeclaration(node.Modifiers(), node.Keyword, node.name, node.Body), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ModuleDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsModuleDeclaration(node *Node) bool {
|
|
return node.Kind == KindModuleDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportEqualsDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportEqualsDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
IsTypeOnly bool
|
|
name *IdentifierNode
|
|
ModuleReference *ModuleReference
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportEqualsDeclaration(modifiers *ModifierList, isTypeOnly bool, name *IdentifierNode, moduleReference *ModuleReference) *Node {
|
|
data := &ImportEqualsDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.IsTypeOnly = isTypeOnly
|
|
data.name = name
|
|
data.ModuleReference = moduleReference
|
|
return f.newNode(KindImportEqualsDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportEqualsDeclaration(node *ImportEqualsDeclaration, modifiers *ModifierList, isTypeOnly bool, name *IdentifierNode, moduleReference *ModuleReference) *Node {
|
|
if modifiers != node.modifiers || isTypeOnly != node.IsTypeOnly || name != node.name || moduleReference != node.ModuleReference {
|
|
return updateNode(f.NewImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportEqualsDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) || visit(v, node.name) || visit(v, node.ModuleReference)
|
|
}
|
|
|
|
func (node *ImportEqualsDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportEqualsDeclaration(node, v.visitModifiers(node.modifiers), node.IsTypeOnly, v.visitNode(node.name), v.visitNode(node.ModuleReference))
|
|
}
|
|
|
|
func (node *ImportEqualsDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportEqualsDeclaration(node.Modifiers(), node.IsTypeOnly, node.name, node.ModuleReference), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ImportEqualsDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsImportEqualsDeclaration(node *Node) bool {
|
|
return node.Kind == KindImportEqualsDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ExportDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ExportDeclaration struct {
|
|
StatementBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
CompositeBase
|
|
IsTypeOnly bool
|
|
ExportClause *NamedExportBindings // Optional
|
|
ModuleSpecifier *Expression // Optional
|
|
Attributes *ImportAttributesNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewExportDeclaration(modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node {
|
|
data := &ExportDeclaration{}
|
|
data.modifiers = modifiers
|
|
data.IsTypeOnly = isTypeOnly
|
|
data.ExportClause = exportClause
|
|
data.ModuleSpecifier = moduleSpecifier
|
|
data.Attributes = attributes
|
|
return f.newNode(KindExportDeclaration, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateExportDeclaration(node *ExportDeclaration, modifiers *ModifierList, isTypeOnly bool, exportClause *NamedExportBindings, moduleSpecifier *Expression, attributes *ImportAttributesNode) *Node {
|
|
if modifiers != node.modifiers || isTypeOnly != node.IsTypeOnly || exportClause != node.ExportClause || moduleSpecifier != node.ModuleSpecifier || attributes != node.Attributes {
|
|
return updateNode(f.NewExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ExportDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.ExportClause) ||
|
|
visit(v, node.ModuleSpecifier) ||
|
|
visit(v, node.Attributes)
|
|
}
|
|
|
|
func (node *ExportDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateExportDeclaration(node, v.visitModifiers(node.modifiers), node.IsTypeOnly, v.visitNode(node.ExportClause), v.visitNode(node.ModuleSpecifier), v.visitNode(node.Attributes))
|
|
}
|
|
|
|
func (node *ExportDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewExportDeclaration(node.Modifiers(), node.IsTypeOnly, node.ExportClause, node.ModuleSpecifier, node.Attributes), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsExportDeclaration(node *Node) bool {
|
|
return node.Kind == KindExportDeclaration
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportTypeNode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportTypeNode struct {
|
|
NodeWithTypeArgumentsBase
|
|
IsTypeOf bool
|
|
Argument *TypeNode
|
|
Attributes *ImportAttributesNode // Optional
|
|
Qualifier *EntityName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportTypeNode(isTypeOf bool, argument *TypeNode, attributes *ImportAttributesNode, qualifier *EntityName, typeArguments *TypeList) *Node {
|
|
data := &ImportTypeNode{}
|
|
data.IsTypeOf = isTypeOf
|
|
data.Argument = argument
|
|
data.Attributes = attributes
|
|
data.Qualifier = qualifier
|
|
data.TypeArguments = typeArguments
|
|
return f.newNode(KindImportType, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportTypeNode(node *ImportTypeNode, isTypeOf bool, argument *TypeNode, attributes *ImportAttributesNode, qualifier *EntityName, typeArguments *TypeList) *Node {
|
|
if isTypeOf != node.IsTypeOf || argument != node.Argument || attributes != node.Attributes || qualifier != node.Qualifier || typeArguments != node.TypeArguments {
|
|
return updateNode(f.NewImportTypeNode(isTypeOf, argument, attributes, qualifier, typeArguments), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportTypeNode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Argument) ||
|
|
visit(v, node.Attributes) ||
|
|
visit(v, node.Qualifier) ||
|
|
visitNodeList(v, node.TypeArguments)
|
|
}
|
|
|
|
func (node *ImportTypeNode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportTypeNode(node, node.IsTypeOf, v.visitNode(node.Argument), v.visitNode(node.Attributes), v.visitNode(node.Qualifier), v.visitNodes(node.TypeArguments))
|
|
}
|
|
|
|
func (node *ImportTypeNode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportTypeNode(node.IsTypeOf, node.Argument, node.Attributes, node.Qualifier, node.TypeArguments), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsImportTypeNode(node *Node) bool {
|
|
return node.Kind == KindImportType
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportClause
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportClause struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
CompositeBase
|
|
PhaseModifier ImportPhaseModifierSyntaxKind // Optional
|
|
name *IdentifierNode // Optional
|
|
NamedBindings *NamedImportBindings // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportClause(phaseModifier ImportPhaseModifierSyntaxKind, name *IdentifierNode, namedBindings *NamedImportBindings) *Node {
|
|
data := &ImportClause{}
|
|
data.PhaseModifier = phaseModifier
|
|
data.name = name
|
|
data.NamedBindings = namedBindings
|
|
return f.newNode(KindImportClause, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportClause(node *ImportClause, phaseModifier ImportPhaseModifierSyntaxKind, name *IdentifierNode, namedBindings *NamedImportBindings) *Node {
|
|
if phaseModifier != node.PhaseModifier || name != node.name || namedBindings != node.NamedBindings {
|
|
return updateNode(f.NewImportClause(phaseModifier, name, namedBindings), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportClause) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name) || visit(v, node.NamedBindings)
|
|
}
|
|
|
|
func (node *ImportClause) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportClause(node, node.PhaseModifier, v.visitNode(node.name), v.visitNode(node.NamedBindings))
|
|
}
|
|
|
|
func (node *ImportClause) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportClause(node.PhaseModifier, node.name, node.NamedBindings), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ImportClause) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsImportClause(node *Node) bool {
|
|
return node.Kind == KindImportClause
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ImportSpecifier
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type ImportSpecifier struct {
|
|
NodeBase
|
|
DeclarationBase
|
|
ExportableBase
|
|
CompositeBase
|
|
IsTypeOnly bool
|
|
PropertyName *ModuleExportName // Optional
|
|
name *IdentifierNode
|
|
}
|
|
|
|
func (f *NodeFactory) NewImportSpecifier(isTypeOnly bool, propertyName *ModuleExportName, name *IdentifierNode) *Node {
|
|
data := f.importSpecifierArena.New()
|
|
data.IsTypeOnly = isTypeOnly
|
|
data.PropertyName = propertyName
|
|
data.name = name
|
|
return f.newNode(KindImportSpecifier, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateImportSpecifier(node *ImportSpecifier, isTypeOnly bool, propertyName *ModuleExportName, name *IdentifierNode) *Node {
|
|
if isTypeOnly != node.IsTypeOnly || propertyName != node.PropertyName || name != node.name {
|
|
return updateNode(f.NewImportSpecifier(isTypeOnly, propertyName, name), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *ImportSpecifier) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.PropertyName) || visit(v, node.name)
|
|
}
|
|
|
|
func (node *ImportSpecifier) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateImportSpecifier(node, node.IsTypeOnly, v.visitNode(node.PropertyName), v.visitNode(node.name))
|
|
}
|
|
|
|
func (node *ImportSpecifier) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewImportSpecifier(node.IsTypeOnly, node.PropertyName, node.name), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *ImportSpecifier) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsImportSpecifier(node *Node) bool {
|
|
return node.Kind == KindImportSpecifier
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocText
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocText struct {
|
|
JSDocCommentBase
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocText(text []string) *Node {
|
|
data := f.jsdocTextArena.New()
|
|
data.text = text
|
|
f.textCount++
|
|
return f.newNode(KindJSDocText, data.AsNode())
|
|
}
|
|
|
|
func (node *JSDocText) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocText(node.text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocText(node *Node) bool {
|
|
return node.Kind == KindJSDocText
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocLink
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocLink struct {
|
|
JSDocCommentBase
|
|
name *EntityName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocLink(name *EntityName, text []string) *Node {
|
|
data := &JSDocLink{}
|
|
data.name = name
|
|
data.text = text
|
|
f.textCount++
|
|
return f.newNode(KindJSDocLink, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocLink(node *JSDocLink, name *EntityName, text []string) *Node {
|
|
if name != node.name || !core.Same(text, node.text) {
|
|
return updateNode(f.NewJSDocLink(name, text), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocLink) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *JSDocLink) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocLink(node, v.visitNode(node.name), node.text)
|
|
}
|
|
|
|
func (node *JSDocLink) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocLink(node.name, node.text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocLink) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocLink(node *Node) bool {
|
|
return node.Kind == KindJSDocLink
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocLinkPlain
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocLinkPlain struct {
|
|
JSDocCommentBase
|
|
name *EntityName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocLinkPlain(name *EntityName, text []string) *Node {
|
|
data := &JSDocLinkPlain{}
|
|
data.name = name
|
|
data.text = text
|
|
f.textCount++
|
|
return f.newNode(KindJSDocLinkPlain, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocLinkPlain(node *JSDocLinkPlain, name *EntityName, text []string) *Node {
|
|
if name != node.name || !core.Same(text, node.text) {
|
|
return updateNode(f.NewJSDocLinkPlain(name, text), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocLinkPlain) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *JSDocLinkPlain) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocLinkPlain(node, v.visitNode(node.name), node.text)
|
|
}
|
|
|
|
func (node *JSDocLinkPlain) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocLinkPlain(node.name, node.text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocLinkPlain) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocLinkPlain(node *Node) bool {
|
|
return node.Kind == KindJSDocLinkPlain
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocLinkCode
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocLinkCode struct {
|
|
JSDocCommentBase
|
|
name *EntityName // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocLinkCode(name *EntityName, text []string) *Node {
|
|
data := &JSDocLinkCode{}
|
|
data.name = name
|
|
data.text = text
|
|
f.textCount++
|
|
return f.newNode(KindJSDocLinkCode, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocLinkCode(node *JSDocLinkCode, name *EntityName, text []string) *Node {
|
|
if name != node.name || !core.Same(text, node.text) {
|
|
return updateNode(f.NewJSDocLinkCode(name, text), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocLinkCode) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.name)
|
|
}
|
|
|
|
func (node *JSDocLinkCode) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateJSDocLinkCode(node, v.visitNode(node.name), node.text)
|
|
}
|
|
|
|
func (node *JSDocLinkCode) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocLinkCode(node.name, node.text), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocLinkCode) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocLinkCode(node *Node) bool {
|
|
return node.Kind == KindJSDocLinkCode
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// TypeParameterDeclaration
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type TypeParameterDeclaration struct {
|
|
TypeSyntaxBase
|
|
NodeBase
|
|
DeclarationBase
|
|
ModifiersBase
|
|
name *IdentifierNode
|
|
Constraint *TypeNode // Optional
|
|
Expression *Expression // Optional
|
|
DefaultType *TypeNode // Optional
|
|
}
|
|
|
|
func (f *NodeFactory) NewTypeParameterDeclaration(modifiers *ModifierList, name *IdentifierNode, constraint *TypeNode, expression *Expression, defaultType *TypeNode) *Node {
|
|
data := f.typeParameterDeclarationArena.New()
|
|
data.modifiers = modifiers
|
|
data.name = name
|
|
data.Constraint = constraint
|
|
data.Expression = expression
|
|
data.DefaultType = defaultType
|
|
return f.newNode(KindTypeParameter, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateTypeParameterDeclaration(node *TypeParameterDeclaration, modifiers *ModifierList, name *IdentifierNode, constraint *TypeNode, expression *Expression, defaultType *TypeNode) *Node {
|
|
if modifiers != node.modifiers || name != node.name || constraint != node.Constraint || expression != node.Expression || defaultType != node.DefaultType {
|
|
return updateNode(f.NewTypeParameterDeclaration(modifiers, name, constraint, expression, defaultType), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *TypeParameterDeclaration) ForEachChild(v Visitor) bool {
|
|
return visitModifiers(v, node.modifiers) ||
|
|
visit(v, node.name) ||
|
|
visit(v, node.Constraint) ||
|
|
visit(v, node.Expression) ||
|
|
visit(v, node.DefaultType)
|
|
}
|
|
|
|
func (node *TypeParameterDeclaration) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateTypeParameterDeclaration(node, v.visitModifiers(node.modifiers), v.visitNode(node.name), v.visitNode(node.Constraint), v.visitNode(node.Expression), v.visitNode(node.DefaultType))
|
|
}
|
|
|
|
func (node *TypeParameterDeclaration) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewTypeParameterDeclaration(node.Modifiers(), node.name, node.Constraint, node.Expression, node.DefaultType), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *TypeParameterDeclaration) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsTypeParameterDeclaration(node *Node) bool {
|
|
return node.Kind == KindTypeParameter
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SyntheticReferenceExpression
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type SyntheticReferenceExpression struct {
|
|
ExpressionBase
|
|
Expression *Expression
|
|
ThisArg *Expression
|
|
}
|
|
|
|
func (f *NodeFactory) NewSyntheticReferenceExpression(expression *Expression, thisArg *Expression) *Node {
|
|
data := &SyntheticReferenceExpression{}
|
|
data.Expression = expression
|
|
data.ThisArg = thisArg
|
|
return f.newNode(KindSyntheticReferenceExpression, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateSyntheticReferenceExpression(node *SyntheticReferenceExpression, expression *Expression, thisArg *Expression) *Node {
|
|
if expression != node.Expression || thisArg != node.ThisArg {
|
|
return updateNode(f.NewSyntheticReferenceExpression(expression, thisArg), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *SyntheticReferenceExpression) ForEachChild(v Visitor) bool {
|
|
return visit(v, node.Expression) || visit(v, node.ThisArg)
|
|
}
|
|
|
|
func (node *SyntheticReferenceExpression) VisitEachChild(v *NodeVisitor) *Node {
|
|
return v.Factory.UpdateSyntheticReferenceExpression(node, v.visitNode(node.Expression), v.visitNode(node.ThisArg))
|
|
}
|
|
|
|
func (node *SyntheticReferenceExpression) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewSyntheticReferenceExpression(node.Expression, node.ThisArg), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *SyntheticReferenceExpression) computeSubtreeFacts() SubtreeFacts {
|
|
return propagateSubtreeFacts(node.Expression) |
|
|
propagateSubtreeFacts(node.ThisArg)
|
|
}
|
|
|
|
func IsSyntheticReferenceExpression(node *Node) bool {
|
|
return node.Kind == KindSyntheticReferenceExpression
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocTypeLiteral
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocTypeLiteral struct {
|
|
JSDocTypeBase
|
|
DeclarationBase
|
|
JSDocPropertyTags []*Node // Optional
|
|
IsArrayType bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocTypeLiteral(jsdocPropertyTags []*Node, isArrayType bool) *Node {
|
|
data := &JSDocTypeLiteral{}
|
|
data.JSDocPropertyTags = jsdocPropertyTags
|
|
data.IsArrayType = isArrayType
|
|
return f.newNode(KindJSDocTypeLiteral, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocTypeLiteral(node *JSDocTypeLiteral, jsdocPropertyTags []*Node, isArrayType bool) *Node {
|
|
if !core.Same(jsdocPropertyTags, node.JSDocPropertyTags) || isArrayType != node.IsArrayType {
|
|
return updateNode(f.NewJSDocTypeLiteral(jsdocPropertyTags, isArrayType), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocTypeLiteral) ForEachChild(v Visitor) bool {
|
|
return visitNodes(v, node.JSDocPropertyTags)
|
|
}
|
|
|
|
func (node *JSDocTypeLiteral) VisitEachChild(v *NodeVisitor) *Node {
|
|
jsdocPropertyTags := core.SameMap(node.JSDocPropertyTags, func(n *Node) *Node { return v.visitNode(n) })
|
|
return v.Factory.UpdateJSDocTypeLiteral(node, jsdocPropertyTags, node.IsArrayType)
|
|
}
|
|
|
|
func (node *JSDocTypeLiteral) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocTypeLiteral(node.JSDocPropertyTags, node.IsArrayType), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func IsJSDocTypeLiteral(node *Node) bool {
|
|
return node.Kind == KindJSDocTypeLiteral
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// JSDocParameterOrPropertyTag
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
type JSDocParameterOrPropertyTag struct {
|
|
JSDocTagBase
|
|
name *EntityName
|
|
IsBracketed bool
|
|
TypeExpression *TypeNode // Optional
|
|
IsNameFirst bool
|
|
}
|
|
|
|
func (f *NodeFactory) NewJSDocParameterOrPropertyTag(kind Kind, tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node {
|
|
data := &JSDocParameterOrPropertyTag{}
|
|
data.TagName = tagName
|
|
data.name = name
|
|
data.IsBracketed = isBracketed
|
|
data.TypeExpression = typeExpression
|
|
data.IsNameFirst = isNameFirst
|
|
data.Comment = comment
|
|
return f.newNode(kind, data.AsNode())
|
|
}
|
|
|
|
func (f *NodeFactory) UpdateJSDocParameterOrPropertyTag(node *JSDocParameterOrPropertyTag, tagName *IdentifierNode, name *EntityName, isBracketed bool, typeExpression *TypeNode, isNameFirst bool, comment *NodeList) *Node {
|
|
if tagName != node.TagName || name != node.name || isBracketed != node.IsBracketed || typeExpression != node.TypeExpression || isNameFirst != node.IsNameFirst || comment != node.Comment {
|
|
return updateNode(f.NewJSDocParameterOrPropertyTag(node.Kind, tagName, name, isBracketed, typeExpression, isNameFirst, comment), node.AsNode(), f.hooks)
|
|
}
|
|
return node.AsNode()
|
|
}
|
|
|
|
func (node *JSDocParameterOrPropertyTag) ForEachChild(v Visitor) bool {
|
|
return forEachChild_JSDocParameterOrPropertyTag(node, v)
|
|
}
|
|
|
|
func (node *JSDocParameterOrPropertyTag) VisitEachChild(v *NodeVisitor) *Node {
|
|
return visitEachChild_JSDocParameterOrPropertyTag(node, v)
|
|
}
|
|
|
|
func (node *JSDocParameterOrPropertyTag) Clone(f NodeFactoryCoercible) *Node {
|
|
return cloneNode(f.AsNodeFactory().NewJSDocParameterOrPropertyTag(node.Kind, node.TagName, node.name, node.IsBracketed, node.TypeExpression, node.IsNameFirst, node.Comment), node.AsNode(), f.AsNodeFactory().hooks)
|
|
}
|
|
|
|
func (node *JSDocParameterOrPropertyTag) Name() *DeclarationName {
|
|
return node.name
|
|
}
|
|
|
|
func IsJSDocParameterTag(node *Node) bool {
|
|
return node.Kind == KindJSDocParameterTag
|
|
}
|
|
|
|
func IsJSDocPropertyTag(node *Node) bool {
|
|
return node.Kind == KindJSDocPropertyTag
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// ForEachChild dispatch
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func (n *Node) ForEachChild(v Visitor) bool {
|
|
switch n.Kind {
|
|
case KindQualifiedName:
|
|
return (*QualifiedName)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindComputedPropertyName:
|
|
return (*ComputedPropertyName)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindDecorator:
|
|
return (*Decorator)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindIfStatement:
|
|
return (*IfStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindDoStatement:
|
|
return (*DoStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindWhileStatement:
|
|
return (*WhileStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindForStatement:
|
|
return (*ForStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindForInStatement, KindForOfStatement:
|
|
return (*ForInOrOfStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindReturnStatement:
|
|
return (*ReturnStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindWithStatement:
|
|
return (*WithStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSwitchStatement:
|
|
return (*SwitchStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindCaseBlock:
|
|
return (*CaseBlock)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindCaseClause, KindDefaultClause:
|
|
return (*CaseOrDefaultClause)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindThrowStatement:
|
|
return (*ThrowStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTryStatement:
|
|
return (*TryStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindCatchClause:
|
|
return (*CatchClause)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindBlock:
|
|
return (*Block)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindVariableStatement:
|
|
return (*VariableStatement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindVariableDeclaration:
|
|
return (*VariableDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindVariableDeclarationList:
|
|
return (*VariableDeclarationList)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
return (*BindingPattern)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindParameter:
|
|
return (*ParameterDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindBindingElement:
|
|
return (*BindingElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindFunctionDeclaration:
|
|
return (*FunctionDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindClassDeclaration:
|
|
return (*ClassDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindClassExpression:
|
|
return (*ClassExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindHeritageClause:
|
|
return (*HeritageClause)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindEnumMember:
|
|
return (*EnumMember)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindEnumDeclaration:
|
|
return (*EnumDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindModuleBlock:
|
|
return (*ModuleBlock)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
return (*ImportDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamedImports:
|
|
return (*NamedImports)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExportAssignment:
|
|
return (*ExportAssignment)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamedExports:
|
|
return (*NamedExports)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExportSpecifier:
|
|
return (*ExportSpecifier)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindConstructor:
|
|
return (*ConstructorDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindGetAccessor:
|
|
return (*GetAccessorDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSetAccessor:
|
|
return (*SetAccessorDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindMethodDeclaration:
|
|
return (*MethodDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPropertyDeclaration:
|
|
return (*PropertyDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindClassStaticBlockDeclaration:
|
|
return (*ClassStaticBlockDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindBinaryExpression:
|
|
return (*BinaryExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindArrowFunction:
|
|
return (*ArrowFunction)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindFunctionExpression:
|
|
return (*FunctionExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindConditionalExpression:
|
|
return (*ConditionalExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPropertyAccessExpression:
|
|
return (*PropertyAccessExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindElementAccessExpression:
|
|
return (*ElementAccessExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindCallExpression:
|
|
return (*CallExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNewExpression:
|
|
return (*NewExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindMetaProperty:
|
|
return (*MetaProperty)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTemplateExpression:
|
|
return (*TemplateExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTaggedTemplateExpression:
|
|
return (*TaggedTemplateExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindArrayLiteralExpression:
|
|
return (*ArrayLiteralExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindObjectLiteralExpression:
|
|
return (*ObjectLiteralExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPropertyAssignment:
|
|
return (*PropertyAssignment)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindShorthandPropertyAssignment:
|
|
return (*ShorthandPropertyAssignment)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExpressionWithTypeArguments:
|
|
return (*ExpressionWithTypeArguments)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportAttribute:
|
|
return (*ImportAttribute)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportAttributes:
|
|
return (*ImportAttributes)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxElement:
|
|
return (*JsxElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxAttributes:
|
|
return (*JsxAttributes)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxNamespacedName:
|
|
return (*JsxNamespacedName)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxOpeningElement:
|
|
return (*JsxOpeningElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxSelfClosingElement:
|
|
return (*JsxSelfClosingElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxFragment:
|
|
return (*JsxFragment)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxAttribute:
|
|
return (*JsxAttribute)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSourceFile:
|
|
return (*SourceFile)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindModuleDeclaration:
|
|
return (*ModuleDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportEqualsDeclaration:
|
|
return (*ImportEqualsDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindExportDeclaration:
|
|
return (*ExportDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportClause:
|
|
return (*ImportClause)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindImportSpecifier:
|
|
return (*ImportSpecifier)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n)).ForEachChild(v)
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n)).ForEachChild(v)
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// VisitEachChild dispatch
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func (n *Node) VisitEachChild(v *NodeVisitor) *Node {
|
|
switch n.Kind {
|
|
case KindQualifiedName:
|
|
return (*QualifiedName)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindComputedPropertyName:
|
|
return (*ComputedPropertyName)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindDecorator:
|
|
return (*Decorator)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindIfStatement:
|
|
return (*IfStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindDoStatement:
|
|
return (*DoStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindWhileStatement:
|
|
return (*WhileStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindForStatement:
|
|
return (*ForStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindForInStatement, KindForOfStatement:
|
|
return (*ForInOrOfStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindReturnStatement:
|
|
return (*ReturnStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindWithStatement:
|
|
return (*WithStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSwitchStatement:
|
|
return (*SwitchStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindCaseBlock:
|
|
return (*CaseBlock)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindCaseClause, KindDefaultClause:
|
|
return (*CaseOrDefaultClause)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindThrowStatement:
|
|
return (*ThrowStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTryStatement:
|
|
return (*TryStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindCatchClause:
|
|
return (*CatchClause)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindBlock:
|
|
return (*Block)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindVariableStatement:
|
|
return (*VariableStatement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindVariableDeclaration:
|
|
return (*VariableDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindVariableDeclarationList:
|
|
return (*VariableDeclarationList)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
return (*BindingPattern)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindParameter:
|
|
return (*ParameterDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindBindingElement:
|
|
return (*BindingElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindFunctionDeclaration:
|
|
return (*FunctionDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindClassDeclaration:
|
|
return (*ClassDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindClassExpression:
|
|
return (*ClassExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindHeritageClause:
|
|
return (*HeritageClause)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindEnumMember:
|
|
return (*EnumMember)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindEnumDeclaration:
|
|
return (*EnumDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindModuleBlock:
|
|
return (*ModuleBlock)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
return (*ImportDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamedImports:
|
|
return (*NamedImports)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExportAssignment:
|
|
return (*ExportAssignment)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamedExports:
|
|
return (*NamedExports)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExportSpecifier:
|
|
return (*ExportSpecifier)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindConstructor:
|
|
return (*ConstructorDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindGetAccessor:
|
|
return (*GetAccessorDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSetAccessor:
|
|
return (*SetAccessorDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindMethodDeclaration:
|
|
return (*MethodDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPropertyDeclaration:
|
|
return (*PropertyDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindClassStaticBlockDeclaration:
|
|
return (*ClassStaticBlockDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindBinaryExpression:
|
|
return (*BinaryExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindArrowFunction:
|
|
return (*ArrowFunction)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindFunctionExpression:
|
|
return (*FunctionExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindConditionalExpression:
|
|
return (*ConditionalExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPropertyAccessExpression:
|
|
return (*PropertyAccessExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindElementAccessExpression:
|
|
return (*ElementAccessExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindCallExpression:
|
|
return (*CallExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNewExpression:
|
|
return (*NewExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindMetaProperty:
|
|
return (*MetaProperty)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTemplateExpression:
|
|
return (*TemplateExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTaggedTemplateExpression:
|
|
return (*TaggedTemplateExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindArrayLiteralExpression:
|
|
return (*ArrayLiteralExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindObjectLiteralExpression:
|
|
return (*ObjectLiteralExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPropertyAssignment:
|
|
return (*PropertyAssignment)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindShorthandPropertyAssignment:
|
|
return (*ShorthandPropertyAssignment)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExpressionWithTypeArguments:
|
|
return (*ExpressionWithTypeArguments)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportAttribute:
|
|
return (*ImportAttribute)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportAttributes:
|
|
return (*ImportAttributes)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxElement:
|
|
return (*JsxElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxAttributes:
|
|
return (*JsxAttributes)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxNamespacedName:
|
|
return (*JsxNamespacedName)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxOpeningElement:
|
|
return (*JsxOpeningElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxSelfClosingElement:
|
|
return (*JsxSelfClosingElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxFragment:
|
|
return (*JsxFragment)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxAttribute:
|
|
return (*JsxAttribute)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSourceFile:
|
|
return (*SourceFile)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindModuleDeclaration:
|
|
return (*ModuleDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportEqualsDeclaration:
|
|
return (*ImportEqualsDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindExportDeclaration:
|
|
return (*ExportDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportClause:
|
|
return (*ImportClause)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindImportSpecifier:
|
|
return (*ImportSpecifier)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n)).VisitEachChild(v)
|
|
default:
|
|
return n
|
|
}
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// SubtreeFacts dispatch
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func (n *Node) SubtreeFacts() SubtreeFacts {
|
|
switch n.Kind {
|
|
case kindFlowSwitchClauseData:
|
|
return SubtreeFactsNone
|
|
case kindFlowReduceLabelData:
|
|
return SubtreeFactsNone
|
|
case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindJsxTextAllWhiteSpaces, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindReturnKeyword, KindSwitchKeyword, KindThrowKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAsyncKeyword, KindAwaitKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindSatisfiesKeyword, KindSetKeyword, KindTypeKeyword, KindUniqueKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword:
|
|
return (*Token)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNumericLiteral:
|
|
return (*NumericLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBigIntLiteral:
|
|
return (*BigIntLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindStringLiteral:
|
|
return (*StringLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxText:
|
|
return (*JsxText)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindRegularExpressionLiteral:
|
|
return (*RegularExpressionLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNoSubstitutionTemplateLiteral:
|
|
return (*NoSubstitutionTemplateLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateHead:
|
|
return (*TemplateHead)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateMiddle:
|
|
return (*TemplateMiddle)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateTail:
|
|
return (*TemplateTail)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIdentifier:
|
|
return (*Identifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPrivateIdentifier:
|
|
return (*PrivateIdentifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFalseKeyword, KindImportKeyword, KindNullKeyword, KindSuperKeyword, KindThisKeyword, KindTrueKeyword:
|
|
return (*KeywordExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVoidKeyword, KindAnyKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindBigIntKeyword:
|
|
return (*KeywordTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindQualifiedName:
|
|
data := (*QualifiedName)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindComputedPropertyName:
|
|
data := (*ComputedPropertyName)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindDecorator:
|
|
data := (*Decorator)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindEmptyStatement:
|
|
return (*EmptyStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIfStatement:
|
|
data := (*IfStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindDoStatement:
|
|
data := (*DoStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindWhileStatement:
|
|
data := (*WhileStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindForStatement:
|
|
data := (*ForStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindForInStatement, KindForOfStatement:
|
|
data := (*ForInOrOfStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindReturnStatement:
|
|
data := (*ReturnStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindWithStatement:
|
|
data := (*WithStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindSwitchStatement:
|
|
data := (*SwitchStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindCaseBlock:
|
|
data := (*CaseBlock)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindCaseClause, KindDefaultClause:
|
|
data := (*CaseOrDefaultClause)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindThrowStatement:
|
|
data := (*ThrowStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindTryStatement:
|
|
data := (*TryStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindCatchClause:
|
|
data := (*CatchClause)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindDebuggerStatement:
|
|
return (*DebuggerStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBlock:
|
|
data := (*Block)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindVariableStatement:
|
|
data := (*VariableStatement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindVariableDeclaration:
|
|
data := (*VariableDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindVariableDeclarationList:
|
|
data := (*VariableDeclarationList)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
data := (*BindingPattern)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindParameter:
|
|
data := (*ParameterDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindBindingElement:
|
|
data := (*BindingElement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFunctionDeclaration:
|
|
data := (*FunctionDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindClassDeclaration:
|
|
data := (*ClassDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindClassExpression:
|
|
data := (*ClassExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindHeritageClause:
|
|
data := (*HeritageClause)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindEnumMember:
|
|
data := (*EnumMember)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindEnumDeclaration:
|
|
data := (*EnumDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindModuleBlock:
|
|
data := (*ModuleBlock)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindNotEmittedStatement:
|
|
return (*NotEmittedStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNotEmittedTypeElement:
|
|
return (*NotEmittedTypeElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
data := (*ImportDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedImports:
|
|
data := (*NamedImports)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindExportAssignment:
|
|
data := (*ExportAssignment)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedExports:
|
|
data := (*NamedExports)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindExportSpecifier:
|
|
data := (*ExportSpecifier)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructor:
|
|
data := (*ConstructorDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindGetAccessor:
|
|
data := (*GetAccessorDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindSetAccessor:
|
|
data := (*SetAccessorDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMethodDeclaration:
|
|
data := (*MethodDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertyDeclaration:
|
|
data := (*PropertyDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindSemicolonClassElement:
|
|
return (*SemicolonClassElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindClassStaticBlockDeclaration:
|
|
data := (*ClassStaticBlockDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindOmittedExpression:
|
|
return (*OmittedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBinaryExpression:
|
|
data := (*BinaryExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrowFunction:
|
|
data := (*ArrowFunction)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindFunctionExpression:
|
|
data := (*FunctionExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConditionalExpression:
|
|
data := (*ConditionalExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindPropertyAccessExpression:
|
|
data := (*PropertyAccessExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindElementAccessExpression:
|
|
data := (*ElementAccessExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindCallExpression:
|
|
data := (*CallExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindNewExpression:
|
|
data := (*NewExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindMetaProperty:
|
|
data := (*MetaProperty)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateExpression:
|
|
data := (*TemplateExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTaggedTemplateExpression:
|
|
data := (*TaggedTemplateExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrayLiteralExpression:
|
|
data := (*ArrayLiteralExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindObjectLiteralExpression:
|
|
data := (*ObjectLiteralExpression)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertyAssignment:
|
|
data := (*PropertyAssignment)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindShorthandPropertyAssignment:
|
|
data := (*ShorthandPropertyAssignment)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExpressionWithTypeArguments:
|
|
data := (*ExpressionWithTypeArguments)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindThisType:
|
|
return (*ThisTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportAttribute:
|
|
data := (*ImportAttribute)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindImportAttributes:
|
|
data := (*ImportAttributes)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxElement:
|
|
data := (*JsxElement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxAttributes:
|
|
data := (*JsxAttributes)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxNamespacedName:
|
|
data := (*JsxNamespacedName)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxOpeningElement:
|
|
data := (*JsxOpeningElement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxSelfClosingElement:
|
|
data := (*JsxSelfClosingElement)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxFragment:
|
|
data := (*JsxFragment)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxOpeningFragment:
|
|
return (*JsxOpeningFragment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxClosingFragment:
|
|
return (*JsxClosingFragment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxAttribute:
|
|
data := (*JsxAttribute)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocAllType:
|
|
return (*JSDocAllType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSourceFile:
|
|
data := (*SourceFile)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindModuleDeclaration:
|
|
data := (*ModuleDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindImportEqualsDeclaration:
|
|
data := (*ImportEqualsDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindExportDeclaration:
|
|
data := (*ExportDeclaration)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportClause:
|
|
data := (*ImportClause)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindImportSpecifier:
|
|
data := (*ImportSpecifier)(unsafe.Pointer(n))
|
|
return data.subtreeFactsWorker(data.AsNode())
|
|
case KindJSDocText:
|
|
return (*JSDocText)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
default:
|
|
panic("Unhandled case in Node.SubtreeFacts: " + n.Kind.String())
|
|
}
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Compute subtree facts dispatch
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func (n *Node) computeSubtreeFacts() SubtreeFacts {
|
|
switch n.Kind {
|
|
case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindJsxTextAllWhiteSpaces, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindReturnKeyword, KindSwitchKeyword, KindThrowKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAsyncKeyword, KindAwaitKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindSatisfiesKeyword, KindSetKeyword, KindTypeKeyword, KindUniqueKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword:
|
|
return (*Token)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNumericLiteral:
|
|
return (*NumericLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBigIntLiteral:
|
|
return (*BigIntLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindStringLiteral:
|
|
return (*StringLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxText:
|
|
return (*JsxText)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindRegularExpressionLiteral:
|
|
return (*RegularExpressionLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNoSubstitutionTemplateLiteral:
|
|
return (*NoSubstitutionTemplateLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateHead:
|
|
return (*TemplateHead)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateMiddle:
|
|
return (*TemplateMiddle)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateTail:
|
|
return (*TemplateTail)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIdentifier:
|
|
return (*Identifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPrivateIdentifier:
|
|
return (*PrivateIdentifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFalseKeyword, KindImportKeyword, KindNullKeyword, KindSuperKeyword, KindThisKeyword, KindTrueKeyword:
|
|
return (*KeywordExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVoidKeyword, KindAnyKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindBigIntKeyword:
|
|
return (*KeywordTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindQualifiedName:
|
|
return (*QualifiedName)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindComputedPropertyName:
|
|
return (*ComputedPropertyName)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindDecorator:
|
|
return (*Decorator)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindEmptyStatement:
|
|
return (*EmptyStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIfStatement:
|
|
return (*IfStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindDoStatement:
|
|
return (*DoStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindWhileStatement:
|
|
return (*WhileStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindForStatement:
|
|
return (*ForStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindForInStatement, KindForOfStatement:
|
|
return (*ForInOrOfStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindReturnStatement:
|
|
return (*ReturnStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindWithStatement:
|
|
return (*WithStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSwitchStatement:
|
|
return (*SwitchStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindCaseBlock:
|
|
return (*CaseBlock)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindCaseClause, KindDefaultClause:
|
|
return (*CaseOrDefaultClause)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindThrowStatement:
|
|
return (*ThrowStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTryStatement:
|
|
return (*TryStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindCatchClause:
|
|
return (*CatchClause)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindDebuggerStatement:
|
|
return (*DebuggerStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBlock:
|
|
return (*Block)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVariableStatement:
|
|
return (*VariableStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVariableDeclaration:
|
|
return (*VariableDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVariableDeclarationList:
|
|
return (*VariableDeclarationList)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
return (*BindingPattern)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindParameter:
|
|
return (*ParameterDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBindingElement:
|
|
return (*BindingElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFunctionDeclaration:
|
|
return (*FunctionDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindClassDeclaration:
|
|
return (*ClassDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindClassExpression:
|
|
return (*ClassExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindHeritageClause:
|
|
return (*HeritageClause)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindEnumMember:
|
|
return (*EnumMember)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindEnumDeclaration:
|
|
return (*EnumDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindModuleBlock:
|
|
return (*ModuleBlock)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNotEmittedStatement:
|
|
return (*NotEmittedStatement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNotEmittedTypeElement:
|
|
return (*NotEmittedTypeElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
return (*ImportDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedImports:
|
|
return (*NamedImports)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExportAssignment:
|
|
return (*ExportAssignment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedExports:
|
|
return (*NamedExports)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExportSpecifier:
|
|
return (*ExportSpecifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructor:
|
|
return (*ConstructorDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindGetAccessor:
|
|
return (*GetAccessorDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSetAccessor:
|
|
return (*SetAccessorDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMethodDeclaration:
|
|
return (*MethodDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertyDeclaration:
|
|
return (*PropertyDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSemicolonClassElement:
|
|
return (*SemicolonClassElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindClassStaticBlockDeclaration:
|
|
return (*ClassStaticBlockDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindOmittedExpression:
|
|
return (*OmittedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindBinaryExpression:
|
|
return (*BinaryExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrowFunction:
|
|
return (*ArrowFunction)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFunctionExpression:
|
|
return (*FunctionExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConditionalExpression:
|
|
return (*ConditionalExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertyAccessExpression:
|
|
return (*PropertyAccessExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindElementAccessExpression:
|
|
return (*ElementAccessExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindCallExpression:
|
|
return (*CallExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNewExpression:
|
|
return (*NewExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMetaProperty:
|
|
return (*MetaProperty)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateExpression:
|
|
return (*TemplateExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTaggedTemplateExpression:
|
|
return (*TaggedTemplateExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrayLiteralExpression:
|
|
return (*ArrayLiteralExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindObjectLiteralExpression:
|
|
return (*ObjectLiteralExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPropertyAssignment:
|
|
return (*PropertyAssignment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindShorthandPropertyAssignment:
|
|
return (*ShorthandPropertyAssignment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExpressionWithTypeArguments:
|
|
return (*ExpressionWithTypeArguments)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindThisType:
|
|
return (*ThisTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportAttribute:
|
|
return (*ImportAttribute)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportAttributes:
|
|
return (*ImportAttributes)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxElement:
|
|
return (*JsxElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxAttributes:
|
|
return (*JsxAttributes)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxNamespacedName:
|
|
return (*JsxNamespacedName)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxOpeningElement:
|
|
return (*JsxOpeningElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxSelfClosingElement:
|
|
return (*JsxSelfClosingElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxFragment:
|
|
return (*JsxFragment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxOpeningFragment:
|
|
return (*JsxOpeningFragment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxClosingFragment:
|
|
return (*JsxClosingFragment)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxAttribute:
|
|
return (*JsxAttribute)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocAllType:
|
|
return (*JSDocAllType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSourceFile:
|
|
return (*SourceFile)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindModuleDeclaration:
|
|
return (*ModuleDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportEqualsDeclaration:
|
|
return (*ImportEqualsDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindExportDeclaration:
|
|
return (*ExportDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportClause:
|
|
return (*ImportClause)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindImportSpecifier:
|
|
return (*ImportSpecifier)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocText:
|
|
return (*JSDocText)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n)).computeSubtreeFacts()
|
|
default:
|
|
return SubtreeFactsNone
|
|
}
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Node data accessor dispatch
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
var nodeNameOffsets = [KindCount]uint16{
|
|
KindVariableDeclaration: uint16(unsafe.Offsetof(VariableDeclaration{}.name)) + 1,
|
|
KindParameter: uint16(unsafe.Offsetof(ParameterDeclaration{}.name)) + 1,
|
|
KindBindingElement: uint16(unsafe.Offsetof(BindingElement{}.name)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.name)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.name)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.name)) + 1,
|
|
KindInterfaceDeclaration: uint16(unsafe.Offsetof(InterfaceDeclaration{}.name)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.name)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.name)) + 1,
|
|
KindEnumMember: uint16(unsafe.Offsetof(EnumMember{}.name)) + 1,
|
|
KindEnumDeclaration: uint16(unsafe.Offsetof(EnumDeclaration{}.name)) + 1,
|
|
KindNamespaceImport: uint16(unsafe.Offsetof(NamespaceImport{}.name)) + 1,
|
|
KindNamespaceExportDeclaration: uint16(unsafe.Offsetof(NamespaceExportDeclaration{}.name)) + 1,
|
|
KindNamespaceExport: uint16(unsafe.Offsetof(NamespaceExport{}.name)) + 1,
|
|
KindExportSpecifier: uint16(unsafe.Offsetof(ExportSpecifier{}.name)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.name)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.name)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.name)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.name)) + 1,
|
|
KindPropertySignature: uint16(unsafe.Offsetof(PropertySignatureDeclaration{}.name)) + 1,
|
|
KindPropertyDeclaration: uint16(unsafe.Offsetof(PropertyDeclaration{}.name)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.name)) + 1,
|
|
KindPropertyAccessExpression: uint16(unsafe.Offsetof(PropertyAccessExpression{}.name)) + 1,
|
|
KindMetaProperty: uint16(unsafe.Offsetof(MetaProperty{}.name)) + 1,
|
|
KindPropertyAssignment: uint16(unsafe.Offsetof(PropertyAssignment{}.name)) + 1,
|
|
KindShorthandPropertyAssignment: uint16(unsafe.Offsetof(ShorthandPropertyAssignment{}.name)) + 1,
|
|
KindImportAttribute: uint16(unsafe.Offsetof(ImportAttribute{}.name)) + 1,
|
|
KindNamedTupleMember: uint16(unsafe.Offsetof(NamedTupleMember{}.name)) + 1,
|
|
KindJsxNamespacedName: uint16(unsafe.Offsetof(JsxNamespacedName{}.name)) + 1,
|
|
KindJsxAttribute: uint16(unsafe.Offsetof(JsxAttribute{}.name)) + 1,
|
|
KindJSDocCallbackTag: uint16(unsafe.Offsetof(JSDocCallbackTag{}.name)) + 1,
|
|
KindJSDocTypedefTag: uint16(unsafe.Offsetof(JSDocTypedefTag{}.name)) + 1,
|
|
KindJSDocNameReference: uint16(unsafe.Offsetof(JSDocNameReference{}.name)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.name)) + 1,
|
|
KindImportEqualsDeclaration: uint16(unsafe.Offsetof(ImportEqualsDeclaration{}.name)) + 1,
|
|
KindImportClause: uint16(unsafe.Offsetof(ImportClause{}.name)) + 1,
|
|
KindImportSpecifier: uint16(unsafe.Offsetof(ImportSpecifier{}.name)) + 1,
|
|
KindJSDocLink: uint16(unsafe.Offsetof(JSDocLink{}.name)) + 1,
|
|
KindJSDocLinkPlain: uint16(unsafe.Offsetof(JSDocLinkPlain{}.name)) + 1,
|
|
KindJSDocLinkCode: uint16(unsafe.Offsetof(JSDocLinkCode{}.name)) + 1,
|
|
KindTypeParameter: uint16(unsafe.Offsetof(TypeParameterDeclaration{}.name)) + 1,
|
|
KindJSDocParameterTag: uint16(unsafe.Offsetof(JSDocParameterOrPropertyTag{}.name)) + 1,
|
|
KindJSDocPropertyTag: uint16(unsafe.Offsetof(JSDocParameterOrPropertyTag{}.name)) + 1,
|
|
}
|
|
|
|
func (n *Node) Name() *DeclarationName {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeNameOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeNameOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return *(**DeclarationName)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeModifiersOffsets = [KindCount]uint16{
|
|
KindVariableStatement: uint16(unsafe.Offsetof(VariableStatement{}.modifiers)) + 1,
|
|
KindParameter: uint16(unsafe.Offsetof(ParameterDeclaration{}.modifiers)) + 1,
|
|
KindMissingDeclaration: uint16(unsafe.Offsetof(MissingDeclaration{}.modifiers)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.modifiers)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.modifiers)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.modifiers)) + 1,
|
|
KindInterfaceDeclaration: uint16(unsafe.Offsetof(InterfaceDeclaration{}.modifiers)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.modifiers)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.modifiers)) + 1,
|
|
KindEnumMember: uint16(unsafe.Offsetof(EnumMember{}.modifiers)) + 1,
|
|
KindEnumDeclaration: uint16(unsafe.Offsetof(EnumDeclaration{}.modifiers)) + 1,
|
|
KindImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.modifiers)) + 1,
|
|
KindJSImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.modifiers)) + 1,
|
|
KindExportAssignment: uint16(unsafe.Offsetof(ExportAssignment{}.modifiers)) + 1,
|
|
KindNamespaceExportDeclaration: uint16(unsafe.Offsetof(NamespaceExportDeclaration{}.modifiers)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.modifiers)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.modifiers)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.modifiers)) + 1,
|
|
KindIndexSignature: uint16(unsafe.Offsetof(IndexSignatureDeclaration{}.modifiers)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.modifiers)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.modifiers)) + 1,
|
|
KindPropertySignature: uint16(unsafe.Offsetof(PropertySignatureDeclaration{}.modifiers)) + 1,
|
|
KindPropertyDeclaration: uint16(unsafe.Offsetof(PropertyDeclaration{}.modifiers)) + 1,
|
|
KindClassStaticBlockDeclaration: uint16(unsafe.Offsetof(ClassStaticBlockDeclaration{}.modifiers)) + 1,
|
|
KindBinaryExpression: uint16(unsafe.Offsetof(BinaryExpression{}.modifiers)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.modifiers)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.modifiers)) + 1,
|
|
KindPropertyAssignment: uint16(unsafe.Offsetof(PropertyAssignment{}.modifiers)) + 1,
|
|
KindShorthandPropertyAssignment: uint16(unsafe.Offsetof(ShorthandPropertyAssignment{}.modifiers)) + 1,
|
|
KindFunctionType: uint16(unsafe.Offsetof(FunctionTypeNode{}.modifiers)) + 1,
|
|
KindConstructorType: uint16(unsafe.Offsetof(ConstructorTypeNode{}.modifiers)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.modifiers)) + 1,
|
|
KindImportEqualsDeclaration: uint16(unsafe.Offsetof(ImportEqualsDeclaration{}.modifiers)) + 1,
|
|
KindExportDeclaration: uint16(unsafe.Offsetof(ExportDeclaration{}.modifiers)) + 1,
|
|
KindTypeParameter: uint16(unsafe.Offsetof(TypeParameterDeclaration{}.modifiers)) + 1,
|
|
}
|
|
|
|
func (n *Node) Modifiers() *ModifierList {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeModifiersOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeModifiersOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return *(**ModifierList)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeFlowNodeDataOffsets = [KindCount]uint16{
|
|
KindIdentifier: uint16(unsafe.Offsetof(Identifier{}.FlowNodeBase)) + 1,
|
|
KindFalseKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindImportKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindNullKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindSuperKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindThisKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindTrueKeyword: uint16(unsafe.Offsetof(KeywordExpression{}.FlowNodeBase)) + 1,
|
|
KindQualifiedName: uint16(unsafe.Offsetof(QualifiedName{}.FlowNodeBase)) + 1,
|
|
KindEmptyStatement: uint16(unsafe.Offsetof(EmptyStatement{}.FlowNodeBase)) + 1,
|
|
KindIfStatement: uint16(unsafe.Offsetof(IfStatement{}.FlowNodeBase)) + 1,
|
|
KindDoStatement: uint16(unsafe.Offsetof(DoStatement{}.FlowNodeBase)) + 1,
|
|
KindWhileStatement: uint16(unsafe.Offsetof(WhileStatement{}.FlowNodeBase)) + 1,
|
|
KindForStatement: uint16(unsafe.Offsetof(ForStatement{}.FlowNodeBase)) + 1,
|
|
KindForInStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.FlowNodeBase)) + 1,
|
|
KindForOfStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.FlowNodeBase)) + 1,
|
|
KindBreakStatement: uint16(unsafe.Offsetof(BreakStatement{}.FlowNodeBase)) + 1,
|
|
KindContinueStatement: uint16(unsafe.Offsetof(ContinueStatement{}.FlowNodeBase)) + 1,
|
|
KindReturnStatement: uint16(unsafe.Offsetof(ReturnStatement{}.FlowNodeBase)) + 1,
|
|
KindWithStatement: uint16(unsafe.Offsetof(WithStatement{}.FlowNodeBase)) + 1,
|
|
KindSwitchStatement: uint16(unsafe.Offsetof(SwitchStatement{}.FlowNodeBase)) + 1,
|
|
KindThrowStatement: uint16(unsafe.Offsetof(ThrowStatement{}.FlowNodeBase)) + 1,
|
|
KindTryStatement: uint16(unsafe.Offsetof(TryStatement{}.FlowNodeBase)) + 1,
|
|
KindDebuggerStatement: uint16(unsafe.Offsetof(DebuggerStatement{}.FlowNodeBase)) + 1,
|
|
KindLabeledStatement: uint16(unsafe.Offsetof(LabeledStatement{}.FlowNodeBase)) + 1,
|
|
KindExpressionStatement: uint16(unsafe.Offsetof(ExpressionStatement{}.FlowNodeBase)) + 1,
|
|
KindBlock: uint16(unsafe.Offsetof(Block{}.FlowNodeBase)) + 1,
|
|
KindVariableStatement: uint16(unsafe.Offsetof(VariableStatement{}.FlowNodeBase)) + 1,
|
|
KindBindingElement: uint16(unsafe.Offsetof(BindingElement{}.FlowNodeBase)) + 1,
|
|
KindMissingDeclaration: uint16(unsafe.Offsetof(MissingDeclaration{}.FlowNodeBase)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.FlowNodeBase)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.FlowNodeBase)) + 1,
|
|
KindInterfaceDeclaration: uint16(unsafe.Offsetof(InterfaceDeclaration{}.FlowNodeBase)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.FlowNodeBase)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.FlowNodeBase)) + 1,
|
|
KindEnumDeclaration: uint16(unsafe.Offsetof(EnumDeclaration{}.FlowNodeBase)) + 1,
|
|
KindModuleBlock: uint16(unsafe.Offsetof(ModuleBlock{}.FlowNodeBase)) + 1,
|
|
KindNotEmittedStatement: uint16(unsafe.Offsetof(NotEmittedStatement{}.FlowNodeBase)) + 1,
|
|
KindImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.FlowNodeBase)) + 1,
|
|
KindJSImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.FlowNodeBase)) + 1,
|
|
KindExportAssignment: uint16(unsafe.Offsetof(ExportAssignment{}.FlowNodeBase)) + 1,
|
|
KindNamespaceExportDeclaration: uint16(unsafe.Offsetof(NamespaceExportDeclaration{}.FlowNodeBase)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.FlowNodeBase)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.FlowNodeBase)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.FlowNodeBase)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.FlowNodeBase)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.FlowNodeBase)) + 1,
|
|
KindPropertyAccessExpression: uint16(unsafe.Offsetof(PropertyAccessExpression{}.FlowNodeBase)) + 1,
|
|
KindElementAccessExpression: uint16(unsafe.Offsetof(ElementAccessExpression{}.FlowNodeBase)) + 1,
|
|
KindMetaProperty: uint16(unsafe.Offsetof(MetaProperty{}.FlowNodeBase)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.FlowNodeBase)) + 1,
|
|
KindImportEqualsDeclaration: uint16(unsafe.Offsetof(ImportEqualsDeclaration{}.FlowNodeBase)) + 1,
|
|
KindExportDeclaration: uint16(unsafe.Offsetof(ExportDeclaration{}.FlowNodeBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) FlowNodeData() *FlowNodeBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeFlowNodeDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeFlowNodeDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*FlowNodeBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeDeclarationDataOffsets = [KindCount]uint16{
|
|
KindNoSubstitutionTemplateLiteral: uint16(unsafe.Offsetof(NoSubstitutionTemplateLiteral{}.DeclarationBase)) + 1,
|
|
KindVariableDeclaration: uint16(unsafe.Offsetof(VariableDeclaration{}.DeclarationBase)) + 1,
|
|
KindParameter: uint16(unsafe.Offsetof(ParameterDeclaration{}.DeclarationBase)) + 1,
|
|
KindBindingElement: uint16(unsafe.Offsetof(BindingElement{}.DeclarationBase)) + 1,
|
|
KindMissingDeclaration: uint16(unsafe.Offsetof(MissingDeclaration{}.DeclarationBase)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.DeclarationBase)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.DeclarationBase)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.DeclarationBase)) + 1,
|
|
KindInterfaceDeclaration: uint16(unsafe.Offsetof(InterfaceDeclaration{}.DeclarationBase)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.DeclarationBase)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.DeclarationBase)) + 1,
|
|
KindEnumMember: uint16(unsafe.Offsetof(EnumMember{}.DeclarationBase)) + 1,
|
|
KindEnumDeclaration: uint16(unsafe.Offsetof(EnumDeclaration{}.DeclarationBase)) + 1,
|
|
KindImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.DeclarationBase)) + 1,
|
|
KindJSImportDeclaration: uint16(unsafe.Offsetof(ImportDeclaration{}.DeclarationBase)) + 1,
|
|
KindNamespaceImport: uint16(unsafe.Offsetof(NamespaceImport{}.DeclarationBase)) + 1,
|
|
KindExportAssignment: uint16(unsafe.Offsetof(ExportAssignment{}.DeclarationBase)) + 1,
|
|
KindNamespaceExportDeclaration: uint16(unsafe.Offsetof(NamespaceExportDeclaration{}.DeclarationBase)) + 1,
|
|
KindNamespaceExport: uint16(unsafe.Offsetof(NamespaceExport{}.DeclarationBase)) + 1,
|
|
KindExportSpecifier: uint16(unsafe.Offsetof(ExportSpecifier{}.DeclarationBase)) + 1,
|
|
KindCallSignature: uint16(unsafe.Offsetof(CallSignatureDeclaration{}.DeclarationBase)) + 1,
|
|
KindConstructSignature: uint16(unsafe.Offsetof(ConstructSignatureDeclaration{}.DeclarationBase)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.DeclarationBase)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.DeclarationBase)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.DeclarationBase)) + 1,
|
|
KindIndexSignature: uint16(unsafe.Offsetof(IndexSignatureDeclaration{}.DeclarationBase)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.DeclarationBase)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.DeclarationBase)) + 1,
|
|
KindPropertySignature: uint16(unsafe.Offsetof(PropertySignatureDeclaration{}.DeclarationBase)) + 1,
|
|
KindPropertyDeclaration: uint16(unsafe.Offsetof(PropertyDeclaration{}.DeclarationBase)) + 1,
|
|
KindSemicolonClassElement: uint16(unsafe.Offsetof(SemicolonClassElement{}.DeclarationBase)) + 1,
|
|
KindClassStaticBlockDeclaration: uint16(unsafe.Offsetof(ClassStaticBlockDeclaration{}.DeclarationBase)) + 1,
|
|
KindBinaryExpression: uint16(unsafe.Offsetof(BinaryExpression{}.DeclarationBase)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.DeclarationBase)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.DeclarationBase)) + 1,
|
|
KindCallExpression: uint16(unsafe.Offsetof(CallExpression{}.DeclarationBase)) + 1,
|
|
KindObjectLiteralExpression: uint16(unsafe.Offsetof(ObjectLiteralExpression{}.DeclarationBase)) + 1,
|
|
KindSpreadAssignment: uint16(unsafe.Offsetof(SpreadAssignment{}.DeclarationBase)) + 1,
|
|
KindPropertyAssignment: uint16(unsafe.Offsetof(PropertyAssignment{}.DeclarationBase)) + 1,
|
|
KindShorthandPropertyAssignment: uint16(unsafe.Offsetof(ShorthandPropertyAssignment{}.DeclarationBase)) + 1,
|
|
KindMappedType: uint16(unsafe.Offsetof(MappedTypeNode{}.DeclarationBase)) + 1,
|
|
KindTypeLiteral: uint16(unsafe.Offsetof(TypeLiteralNode{}.DeclarationBase)) + 1,
|
|
KindNamedTupleMember: uint16(unsafe.Offsetof(NamedTupleMember{}.DeclarationBase)) + 1,
|
|
KindFunctionType: uint16(unsafe.Offsetof(FunctionTypeNode{}.DeclarationBase)) + 1,
|
|
KindConstructorType: uint16(unsafe.Offsetof(ConstructorTypeNode{}.DeclarationBase)) + 1,
|
|
KindJsxAttributes: uint16(unsafe.Offsetof(JsxAttributes{}.DeclarationBase)) + 1,
|
|
KindJsxAttribute: uint16(unsafe.Offsetof(JsxAttribute{}.DeclarationBase)) + 1,
|
|
KindJSDocSignature: uint16(unsafe.Offsetof(JSDocSignature{}.DeclarationBase)) + 1,
|
|
KindSourceFile: uint16(unsafe.Offsetof(SourceFile{}.DeclarationBase)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.DeclarationBase)) + 1,
|
|
KindImportEqualsDeclaration: uint16(unsafe.Offsetof(ImportEqualsDeclaration{}.DeclarationBase)) + 1,
|
|
KindExportDeclaration: uint16(unsafe.Offsetof(ExportDeclaration{}.DeclarationBase)) + 1,
|
|
KindImportClause: uint16(unsafe.Offsetof(ImportClause{}.DeclarationBase)) + 1,
|
|
KindImportSpecifier: uint16(unsafe.Offsetof(ImportSpecifier{}.DeclarationBase)) + 1,
|
|
KindTypeParameter: uint16(unsafe.Offsetof(TypeParameterDeclaration{}.DeclarationBase)) + 1,
|
|
KindJSDocTypeLiteral: uint16(unsafe.Offsetof(JSDocTypeLiteral{}.DeclarationBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) DeclarationData() *DeclarationBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeDeclarationDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeDeclarationDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*DeclarationBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeLocalsContainerDataOffsets = [KindCount]uint16{
|
|
KindForStatement: uint16(unsafe.Offsetof(ForStatement{}.LocalsContainerBase)) + 1,
|
|
KindForInStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.LocalsContainerBase)) + 1,
|
|
KindForOfStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.LocalsContainerBase)) + 1,
|
|
KindCaseBlock: uint16(unsafe.Offsetof(CaseBlock{}.LocalsContainerBase)) + 1,
|
|
KindCatchClause: uint16(unsafe.Offsetof(CatchClause{}.LocalsContainerBase)) + 1,
|
|
KindBlock: uint16(unsafe.Offsetof(Block{}.LocalsContainerBase)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.LocalsContainerBase)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindCallSignature: uint16(unsafe.Offsetof(CallSignatureDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindConstructSignature: uint16(unsafe.Offsetof(ConstructSignatureDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindIndexSignature: uint16(unsafe.Offsetof(IndexSignatureDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindClassStaticBlockDeclaration: uint16(unsafe.Offsetof(ClassStaticBlockDeclaration{}.LocalsContainerBase)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.LocalsContainerBase)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.LocalsContainerBase)) + 1,
|
|
KindConditionalType: uint16(unsafe.Offsetof(ConditionalTypeNode{}.LocalsContainerBase)) + 1,
|
|
KindMappedType: uint16(unsafe.Offsetof(MappedTypeNode{}.LocalsContainerBase)) + 1,
|
|
KindFunctionType: uint16(unsafe.Offsetof(FunctionTypeNode{}.LocalsContainerBase)) + 1,
|
|
KindConstructorType: uint16(unsafe.Offsetof(ConstructorTypeNode{}.LocalsContainerBase)) + 1,
|
|
KindJSDocSignature: uint16(unsafe.Offsetof(JSDocSignature{}.LocalsContainerBase)) + 1,
|
|
KindSourceFile: uint16(unsafe.Offsetof(SourceFile{}.LocalsContainerBase)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.LocalsContainerBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) LocalsContainerData() *LocalsContainerBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeLocalsContainerDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeLocalsContainerDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*LocalsContainerBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeFunctionLikeDataOffsets = [KindCount]uint16{
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindCallSignature: uint16(unsafe.Offsetof(CallSignatureDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindConstructSignature: uint16(unsafe.Offsetof(ConstructSignatureDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindIndexSignature: uint16(unsafe.Offsetof(IndexSignatureDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.FunctionLikeBase)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.FunctionLikeBase)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.FunctionLikeBase)) + 1,
|
|
KindFunctionType: uint16(unsafe.Offsetof(FunctionTypeNode{}.FunctionLikeBase)) + 1,
|
|
KindConstructorType: uint16(unsafe.Offsetof(ConstructorTypeNode{}.FunctionLikeBase)) + 1,
|
|
KindJSDocSignature: uint16(unsafe.Offsetof(JSDocSignature{}.FunctionLikeBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) FunctionLikeData() *FunctionLikeBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeFunctionLikeDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeFunctionLikeDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*FunctionLikeBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeExpressionOffsets = [kindFlowReduceLabelData + 1]uint16{
|
|
KindComputedPropertyName: uint16(unsafe.Offsetof(ComputedPropertyName{}.Expression)) + 1,
|
|
KindDecorator: uint16(unsafe.Offsetof(Decorator{}.Expression)) + 1,
|
|
KindIfStatement: uint16(unsafe.Offsetof(IfStatement{}.Expression)) + 1,
|
|
KindDoStatement: uint16(unsafe.Offsetof(DoStatement{}.Expression)) + 1,
|
|
KindWhileStatement: uint16(unsafe.Offsetof(WhileStatement{}.Expression)) + 1,
|
|
KindForInStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.Expression)) + 1,
|
|
KindForOfStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.Expression)) + 1,
|
|
KindReturnStatement: uint16(unsafe.Offsetof(ReturnStatement{}.Expression)) + 1,
|
|
KindWithStatement: uint16(unsafe.Offsetof(WithStatement{}.Expression)) + 1,
|
|
KindSwitchStatement: uint16(unsafe.Offsetof(SwitchStatement{}.Expression)) + 1,
|
|
KindCaseClause: uint16(unsafe.Offsetof(CaseOrDefaultClause{}.Expression)) + 1,
|
|
KindThrowStatement: uint16(unsafe.Offsetof(ThrowStatement{}.Expression)) + 1,
|
|
KindExpressionStatement: uint16(unsafe.Offsetof(ExpressionStatement{}.Expression)) + 1,
|
|
KindExternalModuleReference: uint16(unsafe.Offsetof(ExternalModuleReference{}.Expression)) + 1,
|
|
KindExportAssignment: uint16(unsafe.Offsetof(ExportAssignment{}.Expression)) + 1,
|
|
KindYieldExpression: uint16(unsafe.Offsetof(YieldExpression{}.Expression)) + 1,
|
|
KindAsExpression: uint16(unsafe.Offsetof(AsExpression{}.Expression)) + 1,
|
|
KindSatisfiesExpression: uint16(unsafe.Offsetof(SatisfiesExpression{}.Expression)) + 1,
|
|
KindPropertyAccessExpression: uint16(unsafe.Offsetof(PropertyAccessExpression{}.Expression)) + 1,
|
|
KindElementAccessExpression: uint16(unsafe.Offsetof(ElementAccessExpression{}.Expression)) + 1,
|
|
KindCallExpression: uint16(unsafe.Offsetof(CallExpression{}.Expression)) + 1,
|
|
KindNewExpression: uint16(unsafe.Offsetof(NewExpression{}.Expression)) + 1,
|
|
KindNonNullExpression: uint16(unsafe.Offsetof(NonNullExpression{}.Expression)) + 1,
|
|
KindSpreadElement: uint16(unsafe.Offsetof(SpreadElement{}.Expression)) + 1,
|
|
KindTemplateSpan: uint16(unsafe.Offsetof(TemplateSpan{}.Expression)) + 1,
|
|
KindParenthesizedExpression: uint16(unsafe.Offsetof(ParenthesizedExpression{}.Expression)) + 1,
|
|
KindSpreadAssignment: uint16(unsafe.Offsetof(SpreadAssignment{}.Expression)) + 1,
|
|
KindDeleteExpression: uint16(unsafe.Offsetof(DeleteExpression{}.Expression)) + 1,
|
|
KindTypeOfExpression: uint16(unsafe.Offsetof(TypeOfExpression{}.Expression)) + 1,
|
|
KindVoidExpression: uint16(unsafe.Offsetof(VoidExpression{}.Expression)) + 1,
|
|
KindAwaitExpression: uint16(unsafe.Offsetof(AwaitExpression{}.Expression)) + 1,
|
|
KindTypeAssertionExpression: uint16(unsafe.Offsetof(TypeAssertion{}.Expression)) + 1,
|
|
KindExpressionWithTypeArguments: uint16(unsafe.Offsetof(ExpressionWithTypeArguments{}.Expression)) + 1,
|
|
KindPartiallyEmittedExpression: uint16(unsafe.Offsetof(PartiallyEmittedExpression{}.Expression)) + 1,
|
|
KindJsxSpreadAttribute: uint16(unsafe.Offsetof(JsxSpreadAttribute{}.Expression)) + 1,
|
|
KindJsxExpression: uint16(unsafe.Offsetof(JsxExpression{}.Expression)) + 1,
|
|
}
|
|
|
|
func (n *Node) Expression() *Node {
|
|
offset := nodeExpressionOffsets[n.Kind]
|
|
if offset == 0 {
|
|
return n.expressionUnsupported()
|
|
}
|
|
return *(**Node)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeTypeOffsets = [KindCount]uint16{
|
|
KindVariableDeclaration: uint16(unsafe.Offsetof(VariableDeclaration{}.Type)) + 1,
|
|
KindParameter: uint16(unsafe.Offsetof(ParameterDeclaration{}.Type)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.Type)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.Type)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.Type)) + 1,
|
|
KindExportAssignment: uint16(unsafe.Offsetof(ExportAssignment{}.Type)) + 1,
|
|
KindCallSignature: uint16(unsafe.Offsetof(CallSignatureDeclaration{}.Type)) + 1,
|
|
KindConstructSignature: uint16(unsafe.Offsetof(ConstructSignatureDeclaration{}.Type)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.Type)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.Type)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.Type)) + 1,
|
|
KindIndexSignature: uint16(unsafe.Offsetof(IndexSignatureDeclaration{}.Type)) + 1,
|
|
KindMethodSignature: uint16(unsafe.Offsetof(MethodSignatureDeclaration{}.Type)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.Type)) + 1,
|
|
KindPropertySignature: uint16(unsafe.Offsetof(PropertySignatureDeclaration{}.Type)) + 1,
|
|
KindPropertyDeclaration: uint16(unsafe.Offsetof(PropertyDeclaration{}.Type)) + 1,
|
|
KindBinaryExpression: uint16(unsafe.Offsetof(BinaryExpression{}.Type)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.Type)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.Type)) + 1,
|
|
KindAsExpression: uint16(unsafe.Offsetof(AsExpression{}.Type)) + 1,
|
|
KindSatisfiesExpression: uint16(unsafe.Offsetof(SatisfiesExpression{}.Type)) + 1,
|
|
KindPropertyAssignment: uint16(unsafe.Offsetof(PropertyAssignment{}.Type)) + 1,
|
|
KindShorthandPropertyAssignment: uint16(unsafe.Offsetof(ShorthandPropertyAssignment{}.Type)) + 1,
|
|
KindTypeAssertionExpression: uint16(unsafe.Offsetof(TypeAssertion{}.Type)) + 1,
|
|
KindTypeOperator: uint16(unsafe.Offsetof(TypeOperatorNode{}.Type)) + 1,
|
|
KindTypePredicate: uint16(unsafe.Offsetof(TypePredicateNode{}.Type)) + 1,
|
|
KindMappedType: uint16(unsafe.Offsetof(MappedTypeNode{}.Type)) + 1,
|
|
KindNamedTupleMember: uint16(unsafe.Offsetof(NamedTupleMember{}.Type)) + 1,
|
|
KindOptionalType: uint16(unsafe.Offsetof(OptionalTypeNode{}.Type)) + 1,
|
|
KindRestType: uint16(unsafe.Offsetof(RestTypeNode{}.Type)) + 1,
|
|
KindParenthesizedType: uint16(unsafe.Offsetof(ParenthesizedTypeNode{}.Type)) + 1,
|
|
KindFunctionType: uint16(unsafe.Offsetof(FunctionTypeNode{}.Type)) + 1,
|
|
KindConstructorType: uint16(unsafe.Offsetof(ConstructorTypeNode{}.Type)) + 1,
|
|
KindTemplateLiteralTypeSpan: uint16(unsafe.Offsetof(TemplateLiteralTypeSpan{}.Type)) + 1,
|
|
KindJSDocTypeExpression: uint16(unsafe.Offsetof(JSDocTypeExpression{}.Type)) + 1,
|
|
KindJSDocNonNullableType: uint16(unsafe.Offsetof(JSDocNonNullableType{}.Type)) + 1,
|
|
KindJSDocNullableType: uint16(unsafe.Offsetof(JSDocNullableType{}.Type)) + 1,
|
|
KindJSDocOptionalType: uint16(unsafe.Offsetof(JSDocOptionalType{}.Type)) + 1,
|
|
KindJSDocSignature: uint16(unsafe.Offsetof(JSDocSignature{}.Type)) + 1,
|
|
KindJSDocParameterTag: uint16(unsafe.Offsetof(JSDocParameterOrPropertyTag{}.TypeExpression)) + 1,
|
|
KindJSDocPropertyTag: uint16(unsafe.Offsetof(JSDocParameterOrPropertyTag{}.TypeExpression)) + 1,
|
|
}
|
|
|
|
func (n *Node) Type() *Node {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeTypeOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeTypeOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return *(**Node)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeInitializerOffsets = [KindCount]uint16{
|
|
KindForStatement: uint16(unsafe.Offsetof(ForStatement{}.Initializer)) + 1,
|
|
KindForInStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.Initializer)) + 1,
|
|
KindForOfStatement: uint16(unsafe.Offsetof(ForInOrOfStatement{}.Initializer)) + 1,
|
|
KindVariableDeclaration: uint16(unsafe.Offsetof(VariableDeclaration{}.Initializer)) + 1,
|
|
KindParameter: uint16(unsafe.Offsetof(ParameterDeclaration{}.Initializer)) + 1,
|
|
KindBindingElement: uint16(unsafe.Offsetof(BindingElement{}.Initializer)) + 1,
|
|
KindEnumMember: uint16(unsafe.Offsetof(EnumMember{}.Initializer)) + 1,
|
|
KindPropertySignature: uint16(unsafe.Offsetof(PropertySignatureDeclaration{}.Initializer)) + 1,
|
|
KindPropertyDeclaration: uint16(unsafe.Offsetof(PropertyDeclaration{}.Initializer)) + 1,
|
|
KindPropertyAssignment: uint16(unsafe.Offsetof(PropertyAssignment{}.Initializer)) + 1,
|
|
KindJsxAttribute: uint16(unsafe.Offsetof(JsxAttribute{}.Initializer)) + 1,
|
|
}
|
|
|
|
func (n *Node) Initializer() *Node {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeInitializerOffsets)) {
|
|
panic("Unhandled case in Node.Initializer")
|
|
}
|
|
offset := nodeInitializerOffsets[kind]
|
|
if offset == 0 {
|
|
panic("Unhandled case in Node.Initializer")
|
|
}
|
|
return *(**Node)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeTextOffsets = [kindFlowReduceLabelData + 1]uint16{
|
|
KindNumericLiteral: uint16(unsafe.Offsetof(NumericLiteral{}.Text)) + 1,
|
|
KindBigIntLiteral: uint16(unsafe.Offsetof(BigIntLiteral{}.Text)) + 1,
|
|
KindStringLiteral: uint16(unsafe.Offsetof(StringLiteral{}.Text)) + 1,
|
|
KindRegularExpressionLiteral: uint16(unsafe.Offsetof(RegularExpressionLiteral{}.Text)) + 1,
|
|
KindNoSubstitutionTemplateLiteral: uint16(unsafe.Offsetof(NoSubstitutionTemplateLiteral{}.Text)) + 1,
|
|
KindTemplateHead: uint16(unsafe.Offsetof(TemplateHead{}.Text)) + 1,
|
|
KindTemplateMiddle: uint16(unsafe.Offsetof(TemplateMiddle{}.Text)) + 1,
|
|
KindTemplateTail: uint16(unsafe.Offsetof(TemplateTail{}.Text)) + 1,
|
|
KindIdentifier: uint16(unsafe.Offsetof(Identifier{}.Text)) + 1,
|
|
KindPrivateIdentifier: uint16(unsafe.Offsetof(PrivateIdentifier{}.Text)) + 1,
|
|
}
|
|
|
|
var nodePropagateSubtreeFactsExclusions = [KindCount]SubtreeFacts{
|
|
KindCatchClause: SubtreeExclusionsCatchClause,
|
|
KindVariableDeclarationList: SubtreeExclusionsVariableDeclarationList,
|
|
KindObjectBindingPattern: SubtreeExclusionsBindingPattern,
|
|
KindArrayBindingPattern: SubtreeExclusionsBindingPattern,
|
|
KindParameter: SubtreeExclusionsParameter,
|
|
KindFunctionDeclaration: SubtreeExclusionsFunction,
|
|
KindClassDeclaration: SubtreeExclusionsClass,
|
|
KindClassExpression: SubtreeExclusionsClass,
|
|
KindModuleDeclaration: SubtreeExclusionsModule,
|
|
KindConstructor: SubtreeExclusionsConstructor,
|
|
KindArrowFunction: SubtreeExclusionsArrowFunction,
|
|
KindFunctionExpression: SubtreeExclusionsFunction,
|
|
KindAsExpression: SubtreeExclusionsOuterExpression,
|
|
KindSatisfiesExpression: SubtreeExclusionsOuterExpression,
|
|
KindPropertyAccessExpression: SubtreeExclusionsPropertyAccess,
|
|
KindElementAccessExpression: SubtreeExclusionsElementAccess,
|
|
KindCallExpression: SubtreeExclusionsCall,
|
|
KindNewExpression: SubtreeExclusionsNew,
|
|
KindArrayLiteralExpression: SubtreeExclusionsArrayLiteral,
|
|
KindObjectLiteralExpression: SubtreeExclusionsObjectLiteral,
|
|
KindTypeAssertionExpression: SubtreeExclusionsOuterExpression,
|
|
}
|
|
|
|
func (n *Node) propagateSubtreeFacts() SubtreeFacts {
|
|
facts := n.SubtreeFacts()
|
|
switch n.Kind {
|
|
case KindGetAccessor, KindSetAccessor:
|
|
return facts & ^SubtreeExclusionsAccessor | propagateSubtreeFacts(n.Name())
|
|
case KindMethodDeclaration:
|
|
return facts & ^SubtreeExclusionsMethod | propagateSubtreeFacts(n.Name())
|
|
case KindPropertyDeclaration:
|
|
return facts & ^SubtreeExclusionsProperty | propagateSubtreeFacts(n.Name())
|
|
}
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodePropagateSubtreeFactsExclusions)) {
|
|
return facts
|
|
}
|
|
return facts & ^nodePropagateSubtreeFactsExclusions[kind]
|
|
}
|
|
|
|
var nodeExportableDataOffsets = [KindCount]uint16{
|
|
KindVariableDeclaration: uint16(unsafe.Offsetof(VariableDeclaration{}.ExportableBase)) + 1,
|
|
KindBindingElement: uint16(unsafe.Offsetof(BindingElement{}.ExportableBase)) + 1,
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.ExportableBase)) + 1,
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.ExportableBase)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.ExportableBase)) + 1,
|
|
KindInterfaceDeclaration: uint16(unsafe.Offsetof(InterfaceDeclaration{}.ExportableBase)) + 1,
|
|
KindTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.ExportableBase)) + 1,
|
|
KindJSTypeAliasDeclaration: uint16(unsafe.Offsetof(TypeAliasDeclaration{}.ExportableBase)) + 1,
|
|
KindEnumDeclaration: uint16(unsafe.Offsetof(EnumDeclaration{}.ExportableBase)) + 1,
|
|
KindNamespaceImport: uint16(unsafe.Offsetof(NamespaceImport{}.ExportableBase)) + 1,
|
|
KindExportSpecifier: uint16(unsafe.Offsetof(ExportSpecifier{}.ExportableBase)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.ExportableBase)) + 1,
|
|
KindImportEqualsDeclaration: uint16(unsafe.Offsetof(ImportEqualsDeclaration{}.ExportableBase)) + 1,
|
|
KindImportClause: uint16(unsafe.Offsetof(ImportClause{}.ExportableBase)) + 1,
|
|
KindImportSpecifier: uint16(unsafe.Offsetof(ImportSpecifier{}.ExportableBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) ExportableData() *ExportableBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeExportableDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeExportableDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*ExportableBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeClassLikeDataOffsets = [KindCount]uint16{
|
|
KindClassDeclaration: uint16(unsafe.Offsetof(ClassDeclaration{}.ClassLikeBase)) + 1,
|
|
KindClassExpression: uint16(unsafe.Offsetof(ClassExpression{}.ClassLikeBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) ClassLikeData() *ClassLikeBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeClassLikeDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeClassLikeDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*ClassLikeBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeBodyDataOffsets = [KindCount]uint16{
|
|
KindFunctionDeclaration: uint16(unsafe.Offsetof(FunctionDeclaration{}.BodyBase)) + 1,
|
|
KindConstructor: uint16(unsafe.Offsetof(ConstructorDeclaration{}.BodyBase)) + 1,
|
|
KindGetAccessor: uint16(unsafe.Offsetof(GetAccessorDeclaration{}.BodyBase)) + 1,
|
|
KindSetAccessor: uint16(unsafe.Offsetof(SetAccessorDeclaration{}.BodyBase)) + 1,
|
|
KindMethodDeclaration: uint16(unsafe.Offsetof(MethodDeclaration{}.BodyBase)) + 1,
|
|
KindArrowFunction: uint16(unsafe.Offsetof(ArrowFunction{}.BodyBase)) + 1,
|
|
KindFunctionExpression: uint16(unsafe.Offsetof(FunctionExpression{}.BodyBase)) + 1,
|
|
KindModuleDeclaration: uint16(unsafe.Offsetof(ModuleDeclaration{}.BodyBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) BodyData() *BodyBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeBodyDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeBodyDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*BodyBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeLiteralLikeDataOffsets = [KindCount]uint16{
|
|
KindNumericLiteral: uint16(unsafe.Offsetof(NumericLiteral{}.LiteralLikeNodeBase)) + 1,
|
|
KindBigIntLiteral: uint16(unsafe.Offsetof(BigIntLiteral{}.LiteralLikeNodeBase)) + 1,
|
|
KindStringLiteral: uint16(unsafe.Offsetof(StringLiteral{}.LiteralLikeNodeBase)) + 1,
|
|
KindJsxText: uint16(unsafe.Offsetof(JsxText{}.LiteralLikeNodeBase)) + 1,
|
|
KindRegularExpressionLiteral: uint16(unsafe.Offsetof(RegularExpressionLiteral{}.LiteralLikeNodeBase)) + 1,
|
|
KindNoSubstitutionTemplateLiteral: uint16(unsafe.Offsetof(NoSubstitutionTemplateLiteral{}.LiteralLikeNodeBase)) + 1,
|
|
KindTemplateHead: uint16(unsafe.Offsetof(TemplateHead{}.LiteralLikeNodeBase)) + 1,
|
|
KindTemplateMiddle: uint16(unsafe.Offsetof(TemplateMiddle{}.LiteralLikeNodeBase)) + 1,
|
|
KindTemplateTail: uint16(unsafe.Offsetof(TemplateTail{}.LiteralLikeNodeBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) LiteralLikeData() *LiteralLikeNodeBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeLiteralLikeDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeLiteralLikeDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*LiteralLikeNodeBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
var nodeTemplateLiteralLikeDataOffsets = [KindCount]uint16{
|
|
KindNoSubstitutionTemplateLiteral: uint16(unsafe.Offsetof(NoSubstitutionTemplateLiteral{}.TemplateLiteralLikeNodeBase)) + 1,
|
|
KindTemplateHead: uint16(unsafe.Offsetof(TemplateHead{}.TemplateLiteralLikeNodeBase)) + 1,
|
|
KindTemplateMiddle: uint16(unsafe.Offsetof(TemplateMiddle{}.TemplateLiteralLikeNodeBase)) + 1,
|
|
KindTemplateTail: uint16(unsafe.Offsetof(TemplateTail{}.TemplateLiteralLikeNodeBase)) + 1,
|
|
}
|
|
|
|
func (n *Node) TemplateLiteralLikeData() *TemplateLiteralLikeNodeBase {
|
|
kind := uint16(n.Kind)
|
|
if kind >= uint16(len(nodeTemplateLiteralLikeDataOffsets)) {
|
|
return nil
|
|
}
|
|
offset := nodeTemplateLiteralLikeDataOffsets[kind]
|
|
if offset == 0 {
|
|
return nil
|
|
}
|
|
return (*TemplateLiteralLikeNodeBase)(unsafe.Add(unsafe.Pointer(n), uintptr(offset-1)))
|
|
}
|
|
|
|
func (n *Node) Clone(f NodeFactoryCoercible) *Node {
|
|
switch n.Kind {
|
|
case kindFlowSwitchClauseData, kindFlowReduceLabelData:
|
|
return nil
|
|
case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindJsxTextAllWhiteSpaces, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindReturnKeyword, KindSwitchKeyword, KindThrowKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAsyncKeyword, KindAwaitKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindSatisfiesKeyword, KindSetKeyword, KindTypeKeyword, KindUniqueKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword:
|
|
return (*Token)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNumericLiteral:
|
|
return (*NumericLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindBigIntLiteral:
|
|
return (*BigIntLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindStringLiteral:
|
|
return (*StringLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxText:
|
|
return (*JsxText)(unsafe.Pointer(n)).Clone(f)
|
|
case KindRegularExpressionLiteral:
|
|
return (*RegularExpressionLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNoSubstitutionTemplateLiteral:
|
|
return (*NoSubstitutionTemplateLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateHead:
|
|
return (*TemplateHead)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateMiddle:
|
|
return (*TemplateMiddle)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateTail:
|
|
return (*TemplateTail)(unsafe.Pointer(n)).Clone(f)
|
|
case KindIdentifier:
|
|
return (*Identifier)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPrivateIdentifier:
|
|
return (*PrivateIdentifier)(unsafe.Pointer(n)).Clone(f)
|
|
case KindFalseKeyword, KindImportKeyword, KindNullKeyword, KindSuperKeyword, KindThisKeyword, KindTrueKeyword:
|
|
return (*KeywordExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindVoidKeyword, KindAnyKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindBigIntKeyword:
|
|
return (*KeywordTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindQualifiedName:
|
|
return (*QualifiedName)(unsafe.Pointer(n)).Clone(f)
|
|
case KindComputedPropertyName:
|
|
return (*ComputedPropertyName)(unsafe.Pointer(n)).Clone(f)
|
|
case KindDecorator:
|
|
return (*Decorator)(unsafe.Pointer(n)).Clone(f)
|
|
case KindEmptyStatement:
|
|
return (*EmptyStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindIfStatement:
|
|
return (*IfStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindDoStatement:
|
|
return (*DoStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindWhileStatement:
|
|
return (*WhileStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindForStatement:
|
|
return (*ForStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindForInStatement, KindForOfStatement:
|
|
return (*ForInOrOfStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindReturnStatement:
|
|
return (*ReturnStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindWithStatement:
|
|
return (*WithStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSwitchStatement:
|
|
return (*SwitchStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindCaseBlock:
|
|
return (*CaseBlock)(unsafe.Pointer(n)).Clone(f)
|
|
case KindCaseClause, KindDefaultClause:
|
|
return (*CaseOrDefaultClause)(unsafe.Pointer(n)).Clone(f)
|
|
case KindThrowStatement:
|
|
return (*ThrowStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTryStatement:
|
|
return (*TryStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindCatchClause:
|
|
return (*CatchClause)(unsafe.Pointer(n)).Clone(f)
|
|
case KindDebuggerStatement:
|
|
return (*DebuggerStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindBlock:
|
|
return (*Block)(unsafe.Pointer(n)).Clone(f)
|
|
case KindVariableStatement:
|
|
return (*VariableStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindVariableDeclaration:
|
|
return (*VariableDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindVariableDeclarationList:
|
|
return (*VariableDeclarationList)(unsafe.Pointer(n)).Clone(f)
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
return (*BindingPattern)(unsafe.Pointer(n)).Clone(f)
|
|
case KindParameter:
|
|
return (*ParameterDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindBindingElement:
|
|
return (*BindingElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindFunctionDeclaration:
|
|
return (*FunctionDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindClassDeclaration:
|
|
return (*ClassDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindClassExpression:
|
|
return (*ClassExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindHeritageClause:
|
|
return (*HeritageClause)(unsafe.Pointer(n)).Clone(f)
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindEnumMember:
|
|
return (*EnumMember)(unsafe.Pointer(n)).Clone(f)
|
|
case KindEnumDeclaration:
|
|
return (*EnumDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindModuleBlock:
|
|
return (*ModuleBlock)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNotEmittedStatement:
|
|
return (*NotEmittedStatement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNotEmittedTypeElement:
|
|
return (*NotEmittedTypeElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
return (*ImportDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamedImports:
|
|
return (*NamedImports)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExportAssignment:
|
|
return (*ExportAssignment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamedExports:
|
|
return (*NamedExports)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExportSpecifier:
|
|
return (*ExportSpecifier)(unsafe.Pointer(n)).Clone(f)
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindConstructor:
|
|
return (*ConstructorDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindGetAccessor:
|
|
return (*GetAccessorDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSetAccessor:
|
|
return (*SetAccessorDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindMethodDeclaration:
|
|
return (*MethodDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPropertyDeclaration:
|
|
return (*PropertyDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSemicolonClassElement:
|
|
return (*SemicolonClassElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindClassStaticBlockDeclaration:
|
|
return (*ClassStaticBlockDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindOmittedExpression:
|
|
return (*OmittedExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindBinaryExpression:
|
|
return (*BinaryExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindArrowFunction:
|
|
return (*ArrowFunction)(unsafe.Pointer(n)).Clone(f)
|
|
case KindFunctionExpression:
|
|
return (*FunctionExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindConditionalExpression:
|
|
return (*ConditionalExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPropertyAccessExpression:
|
|
return (*PropertyAccessExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindElementAccessExpression:
|
|
return (*ElementAccessExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindCallExpression:
|
|
return (*CallExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNewExpression:
|
|
return (*NewExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindMetaProperty:
|
|
return (*MetaProperty)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateExpression:
|
|
return (*TemplateExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTaggedTemplateExpression:
|
|
return (*TaggedTemplateExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindArrayLiteralExpression:
|
|
return (*ArrayLiteralExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindObjectLiteralExpression:
|
|
return (*ObjectLiteralExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPropertyAssignment:
|
|
return (*PropertyAssignment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindShorthandPropertyAssignment:
|
|
return (*ShorthandPropertyAssignment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n)).Clone(f)
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExpressionWithTypeArguments:
|
|
return (*ExpressionWithTypeArguments)(unsafe.Pointer(n)).Clone(f)
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindThisType:
|
|
return (*ThisTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportAttribute:
|
|
return (*ImportAttribute)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportAttributes:
|
|
return (*ImportAttributes)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n)).Clone(f)
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxElement:
|
|
return (*JsxElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxAttributes:
|
|
return (*JsxAttributes)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxNamespacedName:
|
|
return (*JsxNamespacedName)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxOpeningElement:
|
|
return (*JsxOpeningElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxSelfClosingElement:
|
|
return (*JsxSelfClosingElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxFragment:
|
|
return (*JsxFragment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxOpeningFragment:
|
|
return (*JsxOpeningFragment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxClosingFragment:
|
|
return (*JsxClosingFragment)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxAttribute:
|
|
return (*JsxAttribute)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocAllType:
|
|
return (*JSDocAllType)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSourceFile:
|
|
return (*SourceFile)(unsafe.Pointer(n)).Clone(f)
|
|
case KindModuleDeclaration:
|
|
return (*ModuleDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportEqualsDeclaration:
|
|
return (*ImportEqualsDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindExportDeclaration:
|
|
return (*ExportDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportClause:
|
|
return (*ImportClause)(unsafe.Pointer(n)).Clone(f)
|
|
case KindImportSpecifier:
|
|
return (*ImportSpecifier)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocText:
|
|
return (*JSDocText)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n)).Clone(f)
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n)).Clone(f)
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n)).Clone(f)
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n)).Clone(f)
|
|
default:
|
|
panic("Unhandled case in Node.Clone: " + n.Kind.String())
|
|
}
|
|
}
|
|
|
|
func (n *MutableNode) SetModifiers(modifiers *ModifierList) {
|
|
node := (*Node)(unsafe.Pointer(n))
|
|
kind := uint16(node.Kind)
|
|
if kind >= uint16(len(nodeModifiersOffsets)) {
|
|
panic("Cannot set modifiers on " + node.Kind.String())
|
|
}
|
|
offset := nodeModifiersOffsets[kind]
|
|
if offset == 0 {
|
|
panic("Cannot set modifiers on " + node.Kind.String())
|
|
}
|
|
*(**ModifierList)(unsafe.Add(unsafe.Pointer(node), uintptr(offset-1))) = modifiers
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// As*() cast methods
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func (n *Node) AsToken() *Token {
|
|
switch n.Kind {
|
|
case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindJsxTextAllWhiteSpaces, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindReturnKeyword, KindSwitchKeyword, KindThrowKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAsyncKeyword, KindAwaitKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindSatisfiesKeyword, KindSetKeyword, KindTypeKeyword, KindUniqueKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword:
|
|
return (*Token)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to Token")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsIdentifier() *Identifier {
|
|
switch n.Kind {
|
|
case KindIdentifier:
|
|
return (*Identifier)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to Identifier")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPrivateIdentifier() *PrivateIdentifier {
|
|
switch n.Kind {
|
|
case KindPrivateIdentifier:
|
|
return (*PrivateIdentifier)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PrivateIdentifier")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsQualifiedName() *QualifiedName {
|
|
switch n.Kind {
|
|
case KindQualifiedName:
|
|
return (*QualifiedName)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to QualifiedName")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsComputedPropertyName() *ComputedPropertyName {
|
|
switch n.Kind {
|
|
case KindComputedPropertyName:
|
|
return (*ComputedPropertyName)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ComputedPropertyName")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsDecorator() *Decorator {
|
|
switch n.Kind {
|
|
case KindDecorator:
|
|
return (*Decorator)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to Decorator")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsEmptyStatement() *EmptyStatement {
|
|
switch n.Kind {
|
|
case KindEmptyStatement:
|
|
return (*EmptyStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to EmptyStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsIfStatement() *IfStatement {
|
|
switch n.Kind {
|
|
case KindIfStatement:
|
|
return (*IfStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to IfStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsDoStatement() *DoStatement {
|
|
switch n.Kind {
|
|
case KindDoStatement:
|
|
return (*DoStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to DoStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsWhileStatement() *WhileStatement {
|
|
switch n.Kind {
|
|
case KindWhileStatement:
|
|
return (*WhileStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to WhileStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsForStatement() *ForStatement {
|
|
switch n.Kind {
|
|
case KindForStatement:
|
|
return (*ForStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ForStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsForInOrOfStatement() *ForInOrOfStatement {
|
|
switch n.Kind {
|
|
case KindForInStatement, KindForOfStatement:
|
|
return (*ForInOrOfStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ForInOrOfStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBreakStatement() *BreakStatement {
|
|
switch n.Kind {
|
|
case KindBreakStatement:
|
|
return (*BreakStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to BreakStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsContinueStatement() *ContinueStatement {
|
|
switch n.Kind {
|
|
case KindContinueStatement:
|
|
return (*ContinueStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ContinueStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsReturnStatement() *ReturnStatement {
|
|
switch n.Kind {
|
|
case KindReturnStatement:
|
|
return (*ReturnStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ReturnStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsWithStatement() *WithStatement {
|
|
switch n.Kind {
|
|
case KindWithStatement:
|
|
return (*WithStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to WithStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSwitchStatement() *SwitchStatement {
|
|
switch n.Kind {
|
|
case KindSwitchStatement:
|
|
return (*SwitchStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SwitchStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsCaseBlock() *CaseBlock {
|
|
switch n.Kind {
|
|
case KindCaseBlock:
|
|
return (*CaseBlock)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to CaseBlock")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsCaseOrDefaultClause() *CaseOrDefaultClause {
|
|
switch n.Kind {
|
|
case KindCaseClause, KindDefaultClause:
|
|
return (*CaseOrDefaultClause)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to CaseOrDefaultClause")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsThrowStatement() *ThrowStatement {
|
|
switch n.Kind {
|
|
case KindThrowStatement:
|
|
return (*ThrowStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ThrowStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTryStatement() *TryStatement {
|
|
switch n.Kind {
|
|
case KindTryStatement:
|
|
return (*TryStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TryStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsCatchClause() *CatchClause {
|
|
switch n.Kind {
|
|
case KindCatchClause:
|
|
return (*CatchClause)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to CatchClause")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsDebuggerStatement() *DebuggerStatement {
|
|
switch n.Kind {
|
|
case KindDebuggerStatement:
|
|
return (*DebuggerStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to DebuggerStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsLabeledStatement() *LabeledStatement {
|
|
switch n.Kind {
|
|
case KindLabeledStatement:
|
|
return (*LabeledStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to LabeledStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExpressionStatement() *ExpressionStatement {
|
|
switch n.Kind {
|
|
case KindExpressionStatement:
|
|
return (*ExpressionStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExpressionStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBlock() *Block {
|
|
switch n.Kind {
|
|
case KindBlock:
|
|
return (*Block)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to Block")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsVariableStatement() *VariableStatement {
|
|
switch n.Kind {
|
|
case KindVariableStatement:
|
|
return (*VariableStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to VariableStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsVariableDeclaration() *VariableDeclaration {
|
|
switch n.Kind {
|
|
case KindVariableDeclaration:
|
|
return (*VariableDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to VariableDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsVariableDeclarationList() *VariableDeclarationList {
|
|
switch n.Kind {
|
|
case KindVariableDeclarationList:
|
|
return (*VariableDeclarationList)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to VariableDeclarationList")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBindingPattern() *BindingPattern {
|
|
switch n.Kind {
|
|
case KindObjectBindingPattern, KindArrayBindingPattern:
|
|
return (*BindingPattern)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to BindingPattern")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsParameterDeclaration() *ParameterDeclaration {
|
|
switch n.Kind {
|
|
case KindParameter:
|
|
return (*ParameterDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ParameterDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBindingElement() *BindingElement {
|
|
switch n.Kind {
|
|
case KindBindingElement:
|
|
return (*BindingElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to BindingElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsMissingDeclaration() *MissingDeclaration {
|
|
switch n.Kind {
|
|
case KindMissingDeclaration:
|
|
return (*MissingDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to MissingDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsFunctionDeclaration() *FunctionDeclaration {
|
|
switch n.Kind {
|
|
case KindFunctionDeclaration:
|
|
return (*FunctionDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to FunctionDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsClassDeclaration() *ClassDeclaration {
|
|
switch n.Kind {
|
|
case KindClassDeclaration:
|
|
return (*ClassDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ClassDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsClassExpression() *ClassExpression {
|
|
switch n.Kind {
|
|
case KindClassExpression:
|
|
return (*ClassExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ClassExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsHeritageClause() *HeritageClause {
|
|
switch n.Kind {
|
|
case KindHeritageClause:
|
|
return (*HeritageClause)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to HeritageClause")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsInterfaceDeclaration() *InterfaceDeclaration {
|
|
switch n.Kind {
|
|
case KindInterfaceDeclaration:
|
|
return (*InterfaceDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to InterfaceDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeAliasDeclaration() *TypeAliasDeclaration {
|
|
switch n.Kind {
|
|
case KindTypeAliasDeclaration, KindJSTypeAliasDeclaration:
|
|
return (*TypeAliasDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeAliasDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsEnumMember() *EnumMember {
|
|
switch n.Kind {
|
|
case KindEnumMember:
|
|
return (*EnumMember)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to EnumMember")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsEnumDeclaration() *EnumDeclaration {
|
|
switch n.Kind {
|
|
case KindEnumDeclaration:
|
|
return (*EnumDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to EnumDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsModuleBlock() *ModuleBlock {
|
|
switch n.Kind {
|
|
case KindModuleBlock:
|
|
return (*ModuleBlock)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ModuleBlock")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNotEmittedStatement() *NotEmittedStatement {
|
|
switch n.Kind {
|
|
case KindNotEmittedStatement:
|
|
return (*NotEmittedStatement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NotEmittedStatement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNotEmittedTypeElement() *NotEmittedTypeElement {
|
|
switch n.Kind {
|
|
case KindNotEmittedTypeElement:
|
|
return (*NotEmittedTypeElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NotEmittedTypeElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportDeclaration() *ImportDeclaration {
|
|
switch n.Kind {
|
|
case KindImportDeclaration, KindJSImportDeclaration:
|
|
return (*ImportDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExternalModuleReference() *ExternalModuleReference {
|
|
switch n.Kind {
|
|
case KindExternalModuleReference:
|
|
return (*ExternalModuleReference)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExternalModuleReference")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamespaceImport() *NamespaceImport {
|
|
switch n.Kind {
|
|
case KindNamespaceImport:
|
|
return (*NamespaceImport)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamespaceImport")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamedImports() *NamedImports {
|
|
switch n.Kind {
|
|
case KindNamedImports:
|
|
return (*NamedImports)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamedImports")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExportAssignment() *ExportAssignment {
|
|
switch n.Kind {
|
|
case KindExportAssignment:
|
|
return (*ExportAssignment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExportAssignment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamespaceExportDeclaration() *NamespaceExportDeclaration {
|
|
switch n.Kind {
|
|
case KindNamespaceExportDeclaration:
|
|
return (*NamespaceExportDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamespaceExportDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamespaceExport() *NamespaceExport {
|
|
switch n.Kind {
|
|
case KindNamespaceExport:
|
|
return (*NamespaceExport)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamespaceExport")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamedExports() *NamedExports {
|
|
switch n.Kind {
|
|
case KindNamedExports:
|
|
return (*NamedExports)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamedExports")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExportSpecifier() *ExportSpecifier {
|
|
switch n.Kind {
|
|
case KindExportSpecifier:
|
|
return (*ExportSpecifier)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExportSpecifier")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsCallSignatureDeclaration() *CallSignatureDeclaration {
|
|
switch n.Kind {
|
|
case KindCallSignature:
|
|
return (*CallSignatureDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to CallSignatureDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsConstructSignatureDeclaration() *ConstructSignatureDeclaration {
|
|
switch n.Kind {
|
|
case KindConstructSignature:
|
|
return (*ConstructSignatureDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ConstructSignatureDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsConstructorDeclaration() *ConstructorDeclaration {
|
|
switch n.Kind {
|
|
case KindConstructor:
|
|
return (*ConstructorDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ConstructorDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsGetAccessorDeclaration() *GetAccessorDeclaration {
|
|
switch n.Kind {
|
|
case KindGetAccessor:
|
|
return (*GetAccessorDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to GetAccessorDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSetAccessorDeclaration() *SetAccessorDeclaration {
|
|
switch n.Kind {
|
|
case KindSetAccessor:
|
|
return (*SetAccessorDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SetAccessorDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsIndexSignatureDeclaration() *IndexSignatureDeclaration {
|
|
switch n.Kind {
|
|
case KindIndexSignature:
|
|
return (*IndexSignatureDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to IndexSignatureDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsMethodSignatureDeclaration() *MethodSignatureDeclaration {
|
|
switch n.Kind {
|
|
case KindMethodSignature:
|
|
return (*MethodSignatureDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to MethodSignatureDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsMethodDeclaration() *MethodDeclaration {
|
|
switch n.Kind {
|
|
case KindMethodDeclaration:
|
|
return (*MethodDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to MethodDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPropertySignatureDeclaration() *PropertySignatureDeclaration {
|
|
switch n.Kind {
|
|
case KindPropertySignature:
|
|
return (*PropertySignatureDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PropertySignatureDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPropertyDeclaration() *PropertyDeclaration {
|
|
switch n.Kind {
|
|
case KindPropertyDeclaration:
|
|
return (*PropertyDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PropertyDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSemicolonClassElement() *SemicolonClassElement {
|
|
switch n.Kind {
|
|
case KindSemicolonClassElement:
|
|
return (*SemicolonClassElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SemicolonClassElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsClassStaticBlockDeclaration() *ClassStaticBlockDeclaration {
|
|
switch n.Kind {
|
|
case KindClassStaticBlockDeclaration:
|
|
return (*ClassStaticBlockDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ClassStaticBlockDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsOmittedExpression() *OmittedExpression {
|
|
switch n.Kind {
|
|
case KindOmittedExpression:
|
|
return (*OmittedExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to OmittedExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsKeywordExpression() *KeywordExpression {
|
|
switch n.Kind {
|
|
case KindFalseKeyword, KindImportKeyword, KindNullKeyword, KindSuperKeyword, KindThisKeyword, KindTrueKeyword:
|
|
return (*KeywordExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to KeywordExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsStringLiteral() *StringLiteral {
|
|
switch n.Kind {
|
|
case KindStringLiteral:
|
|
return (*StringLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to StringLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNumericLiteral() *NumericLiteral {
|
|
switch n.Kind {
|
|
case KindNumericLiteral:
|
|
return (*NumericLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NumericLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBigIntLiteral() *BigIntLiteral {
|
|
switch n.Kind {
|
|
case KindBigIntLiteral:
|
|
return (*BigIntLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to BigIntLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsRegularExpressionLiteral() *RegularExpressionLiteral {
|
|
switch n.Kind {
|
|
case KindRegularExpressionLiteral:
|
|
return (*RegularExpressionLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to RegularExpressionLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNoSubstitutionTemplateLiteral() *NoSubstitutionTemplateLiteral {
|
|
switch n.Kind {
|
|
case KindNoSubstitutionTemplateLiteral:
|
|
return (*NoSubstitutionTemplateLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NoSubstitutionTemplateLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsBinaryExpression() *BinaryExpression {
|
|
switch n.Kind {
|
|
case KindBinaryExpression:
|
|
return (*BinaryExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to BinaryExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPrefixUnaryExpression() *PrefixUnaryExpression {
|
|
switch n.Kind {
|
|
case KindPrefixUnaryExpression:
|
|
return (*PrefixUnaryExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PrefixUnaryExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPostfixUnaryExpression() *PostfixUnaryExpression {
|
|
switch n.Kind {
|
|
case KindPostfixUnaryExpression:
|
|
return (*PostfixUnaryExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PostfixUnaryExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsYieldExpression() *YieldExpression {
|
|
switch n.Kind {
|
|
case KindYieldExpression:
|
|
return (*YieldExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to YieldExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsArrowFunction() *ArrowFunction {
|
|
switch n.Kind {
|
|
case KindArrowFunction:
|
|
return (*ArrowFunction)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ArrowFunction")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsFunctionExpression() *FunctionExpression {
|
|
switch n.Kind {
|
|
case KindFunctionExpression:
|
|
return (*FunctionExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to FunctionExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsAsExpression() *AsExpression {
|
|
switch n.Kind {
|
|
case KindAsExpression:
|
|
return (*AsExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to AsExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSatisfiesExpression() *SatisfiesExpression {
|
|
switch n.Kind {
|
|
case KindSatisfiesExpression:
|
|
return (*SatisfiesExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SatisfiesExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsConditionalExpression() *ConditionalExpression {
|
|
switch n.Kind {
|
|
case KindConditionalExpression:
|
|
return (*ConditionalExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ConditionalExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPropertyAccessExpression() *PropertyAccessExpression {
|
|
switch n.Kind {
|
|
case KindPropertyAccessExpression:
|
|
return (*PropertyAccessExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PropertyAccessExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsElementAccessExpression() *ElementAccessExpression {
|
|
switch n.Kind {
|
|
case KindElementAccessExpression:
|
|
return (*ElementAccessExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ElementAccessExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsCallExpression() *CallExpression {
|
|
switch n.Kind {
|
|
case KindCallExpression:
|
|
return (*CallExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to CallExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNewExpression() *NewExpression {
|
|
switch n.Kind {
|
|
case KindNewExpression:
|
|
return (*NewExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NewExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsMetaProperty() *MetaProperty {
|
|
switch n.Kind {
|
|
case KindMetaProperty:
|
|
return (*MetaProperty)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to MetaProperty")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNonNullExpression() *NonNullExpression {
|
|
switch n.Kind {
|
|
case KindNonNullExpression:
|
|
return (*NonNullExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NonNullExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSpreadElement() *SpreadElement {
|
|
switch n.Kind {
|
|
case KindSpreadElement:
|
|
return (*SpreadElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SpreadElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateExpression() *TemplateExpression {
|
|
switch n.Kind {
|
|
case KindTemplateExpression:
|
|
return (*TemplateExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateSpan() *TemplateSpan {
|
|
switch n.Kind {
|
|
case KindTemplateSpan:
|
|
return (*TemplateSpan)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateSpan")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTaggedTemplateExpression() *TaggedTemplateExpression {
|
|
switch n.Kind {
|
|
case KindTaggedTemplateExpression:
|
|
return (*TaggedTemplateExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TaggedTemplateExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsParenthesizedExpression() *ParenthesizedExpression {
|
|
switch n.Kind {
|
|
case KindParenthesizedExpression:
|
|
return (*ParenthesizedExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ParenthesizedExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsArrayLiteralExpression() *ArrayLiteralExpression {
|
|
switch n.Kind {
|
|
case KindArrayLiteralExpression:
|
|
return (*ArrayLiteralExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ArrayLiteralExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsObjectLiteralExpression() *ObjectLiteralExpression {
|
|
switch n.Kind {
|
|
case KindObjectLiteralExpression:
|
|
return (*ObjectLiteralExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ObjectLiteralExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSpreadAssignment() *SpreadAssignment {
|
|
switch n.Kind {
|
|
case KindSpreadAssignment:
|
|
return (*SpreadAssignment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SpreadAssignment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPropertyAssignment() *PropertyAssignment {
|
|
switch n.Kind {
|
|
case KindPropertyAssignment:
|
|
return (*PropertyAssignment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PropertyAssignment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsShorthandPropertyAssignment() *ShorthandPropertyAssignment {
|
|
switch n.Kind {
|
|
case KindShorthandPropertyAssignment:
|
|
return (*ShorthandPropertyAssignment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ShorthandPropertyAssignment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsDeleteExpression() *DeleteExpression {
|
|
switch n.Kind {
|
|
case KindDeleteExpression:
|
|
return (*DeleteExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to DeleteExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeOfExpression() *TypeOfExpression {
|
|
switch n.Kind {
|
|
case KindTypeOfExpression:
|
|
return (*TypeOfExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeOfExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsVoidExpression() *VoidExpression {
|
|
switch n.Kind {
|
|
case KindVoidExpression:
|
|
return (*VoidExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to VoidExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsAwaitExpression() *AwaitExpression {
|
|
switch n.Kind {
|
|
case KindAwaitExpression:
|
|
return (*AwaitExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to AwaitExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeAssertion() *TypeAssertion {
|
|
switch n.Kind {
|
|
case KindTypeAssertionExpression:
|
|
return (*TypeAssertion)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeAssertion")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsKeywordTypeNode() *KeywordTypeNode {
|
|
switch n.Kind {
|
|
case KindVoidKeyword, KindAnyKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindBigIntKeyword:
|
|
return (*KeywordTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to KeywordTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsUnionTypeNode() *UnionTypeNode {
|
|
switch n.Kind {
|
|
case KindUnionType:
|
|
return (*UnionTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to UnionTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsIntersectionTypeNode() *IntersectionTypeNode {
|
|
switch n.Kind {
|
|
case KindIntersectionType:
|
|
return (*IntersectionTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to IntersectionTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsConditionalTypeNode() *ConditionalTypeNode {
|
|
switch n.Kind {
|
|
case KindConditionalType:
|
|
return (*ConditionalTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ConditionalTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeOperatorNode() *TypeOperatorNode {
|
|
switch n.Kind {
|
|
case KindTypeOperator:
|
|
return (*TypeOperatorNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeOperatorNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsInferTypeNode() *InferTypeNode {
|
|
switch n.Kind {
|
|
case KindInferType:
|
|
return (*InferTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to InferTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsArrayTypeNode() *ArrayTypeNode {
|
|
switch n.Kind {
|
|
case KindArrayType:
|
|
return (*ArrayTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ArrayTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsIndexedAccessTypeNode() *IndexedAccessTypeNode {
|
|
switch n.Kind {
|
|
case KindIndexedAccessType:
|
|
return (*IndexedAccessTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to IndexedAccessTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeReferenceNode() *TypeReferenceNode {
|
|
switch n.Kind {
|
|
case KindTypeReference:
|
|
return (*TypeReferenceNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeReferenceNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExpressionWithTypeArguments() *ExpressionWithTypeArguments {
|
|
switch n.Kind {
|
|
case KindExpressionWithTypeArguments:
|
|
return (*ExpressionWithTypeArguments)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExpressionWithTypeArguments")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsLiteralTypeNode() *LiteralTypeNode {
|
|
switch n.Kind {
|
|
case KindLiteralType:
|
|
return (*LiteralTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to LiteralTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsThisTypeNode() *ThisTypeNode {
|
|
switch n.Kind {
|
|
case KindThisType:
|
|
return (*ThisTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ThisTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypePredicateNode() *TypePredicateNode {
|
|
switch n.Kind {
|
|
case KindTypePredicate:
|
|
return (*TypePredicateNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypePredicateNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportAttribute() *ImportAttribute {
|
|
switch n.Kind {
|
|
case KindImportAttribute:
|
|
return (*ImportAttribute)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportAttribute")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportAttributes() *ImportAttributes {
|
|
switch n.Kind {
|
|
case KindImportAttributes:
|
|
return (*ImportAttributes)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportAttributes")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeQueryNode() *TypeQueryNode {
|
|
switch n.Kind {
|
|
case KindTypeQuery:
|
|
return (*TypeQueryNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeQueryNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsMappedTypeNode() *MappedTypeNode {
|
|
switch n.Kind {
|
|
case KindMappedType:
|
|
return (*MappedTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to MappedTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeLiteralNode() *TypeLiteralNode {
|
|
switch n.Kind {
|
|
case KindTypeLiteral:
|
|
return (*TypeLiteralNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeLiteralNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTupleTypeNode() *TupleTypeNode {
|
|
switch n.Kind {
|
|
case KindTupleType:
|
|
return (*TupleTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TupleTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsNamedTupleMember() *NamedTupleMember {
|
|
switch n.Kind {
|
|
case KindNamedTupleMember:
|
|
return (*NamedTupleMember)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to NamedTupleMember")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsOptionalTypeNode() *OptionalTypeNode {
|
|
switch n.Kind {
|
|
case KindOptionalType:
|
|
return (*OptionalTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to OptionalTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsRestTypeNode() *RestTypeNode {
|
|
switch n.Kind {
|
|
case KindRestType:
|
|
return (*RestTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to RestTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsParenthesizedTypeNode() *ParenthesizedTypeNode {
|
|
switch n.Kind {
|
|
case KindParenthesizedType:
|
|
return (*ParenthesizedTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ParenthesizedTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsFunctionTypeNode() *FunctionTypeNode {
|
|
switch n.Kind {
|
|
case KindFunctionType:
|
|
return (*FunctionTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to FunctionTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsConstructorTypeNode() *ConstructorTypeNode {
|
|
switch n.Kind {
|
|
case KindConstructorType:
|
|
return (*ConstructorTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ConstructorTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateHead() *TemplateHead {
|
|
switch n.Kind {
|
|
case KindTemplateHead:
|
|
return (*TemplateHead)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateHead")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateMiddle() *TemplateMiddle {
|
|
switch n.Kind {
|
|
case KindTemplateMiddle:
|
|
return (*TemplateMiddle)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateMiddle")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateTail() *TemplateTail {
|
|
switch n.Kind {
|
|
case KindTemplateTail:
|
|
return (*TemplateTail)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateTail")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateLiteralTypeNode() *TemplateLiteralTypeNode {
|
|
switch n.Kind {
|
|
case KindTemplateLiteralType:
|
|
return (*TemplateLiteralTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateLiteralTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTemplateLiteralTypeSpan() *TemplateLiteralTypeSpan {
|
|
switch n.Kind {
|
|
case KindTemplateLiteralTypeSpan:
|
|
return (*TemplateLiteralTypeSpan)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TemplateLiteralTypeSpan")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSyntheticExpression() *SyntheticExpression {
|
|
switch n.Kind {
|
|
case KindSyntheticExpression:
|
|
return (*SyntheticExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SyntheticExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsPartiallyEmittedExpression() *PartiallyEmittedExpression {
|
|
switch n.Kind {
|
|
case KindPartiallyEmittedExpression:
|
|
return (*PartiallyEmittedExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to PartiallyEmittedExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxElement() *JsxElement {
|
|
switch n.Kind {
|
|
case KindJsxElement:
|
|
return (*JsxElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxAttributes() *JsxAttributes {
|
|
switch n.Kind {
|
|
case KindJsxAttributes:
|
|
return (*JsxAttributes)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxAttributes")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxNamespacedName() *JsxNamespacedName {
|
|
switch n.Kind {
|
|
case KindJsxNamespacedName:
|
|
return (*JsxNamespacedName)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxNamespacedName")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxOpeningElement() *JsxOpeningElement {
|
|
switch n.Kind {
|
|
case KindJsxOpeningElement:
|
|
return (*JsxOpeningElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxOpeningElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxSelfClosingElement() *JsxSelfClosingElement {
|
|
switch n.Kind {
|
|
case KindJsxSelfClosingElement:
|
|
return (*JsxSelfClosingElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxSelfClosingElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxFragment() *JsxFragment {
|
|
switch n.Kind {
|
|
case KindJsxFragment:
|
|
return (*JsxFragment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxFragment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxOpeningFragment() *JsxOpeningFragment {
|
|
switch n.Kind {
|
|
case KindJsxOpeningFragment:
|
|
return (*JsxOpeningFragment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxOpeningFragment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxClosingFragment() *JsxClosingFragment {
|
|
switch n.Kind {
|
|
case KindJsxClosingFragment:
|
|
return (*JsxClosingFragment)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxClosingFragment")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxAttribute() *JsxAttribute {
|
|
switch n.Kind {
|
|
case KindJsxAttribute:
|
|
return (*JsxAttribute)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxAttribute")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxSpreadAttribute() *JsxSpreadAttribute {
|
|
switch n.Kind {
|
|
case KindJsxSpreadAttribute:
|
|
return (*JsxSpreadAttribute)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxSpreadAttribute")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxClosingElement() *JsxClosingElement {
|
|
switch n.Kind {
|
|
case KindJsxClosingElement:
|
|
return (*JsxClosingElement)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxClosingElement")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxExpression() *JsxExpression {
|
|
switch n.Kind {
|
|
case KindJsxExpression:
|
|
return (*JsxExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJsxText() *JsxText {
|
|
switch n.Kind {
|
|
case KindJsxText:
|
|
return (*JsxText)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JsxText")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSyntaxList() *SyntaxList {
|
|
switch n.Kind {
|
|
case KindSyntaxList:
|
|
return (*SyntaxList)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SyntaxList")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDoc() *JSDoc {
|
|
switch n.Kind {
|
|
case KindJSDoc:
|
|
return (*JSDoc)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDoc")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocTypeExpression() *JSDocTypeExpression {
|
|
switch n.Kind {
|
|
case KindJSDocTypeExpression:
|
|
return (*JSDocTypeExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocTypeExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocNonNullableType() *JSDocNonNullableType {
|
|
switch n.Kind {
|
|
case KindJSDocNonNullableType:
|
|
return (*JSDocNonNullableType)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocNonNullableType")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocNullableType() *JSDocNullableType {
|
|
switch n.Kind {
|
|
case KindJSDocNullableType:
|
|
return (*JSDocNullableType)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocNullableType")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocAllType() *JSDocAllType {
|
|
switch n.Kind {
|
|
case KindJSDocAllType:
|
|
return (*JSDocAllType)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocAllType")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocVariadicType() *JSDocVariadicType {
|
|
switch n.Kind {
|
|
case KindJSDocVariadicType:
|
|
return (*JSDocVariadicType)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocVariadicType")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocOptionalType() *JSDocOptionalType {
|
|
switch n.Kind {
|
|
case KindJSDocOptionalType:
|
|
return (*JSDocOptionalType)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocOptionalType")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocTypeTag() *JSDocTypeTag {
|
|
switch n.Kind {
|
|
case KindJSDocTypeTag:
|
|
return (*JSDocTypeTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocTypeTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocUnknownTag() *JSDocUnknownTag {
|
|
switch n.Kind {
|
|
case KindJSDocUnknownTag:
|
|
return (*JSDocUnknownTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocUnknownTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocTemplateTag() *JSDocTemplateTag {
|
|
switch n.Kind {
|
|
case KindJSDocTemplateTag:
|
|
return (*JSDocTemplateTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocTemplateTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocReturnTag() *JSDocReturnTag {
|
|
switch n.Kind {
|
|
case KindJSDocReturnTag:
|
|
return (*JSDocReturnTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocReturnTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocPublicTag() *JSDocPublicTag {
|
|
switch n.Kind {
|
|
case KindJSDocPublicTag:
|
|
return (*JSDocPublicTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocPublicTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocPrivateTag() *JSDocPrivateTag {
|
|
switch n.Kind {
|
|
case KindJSDocPrivateTag:
|
|
return (*JSDocPrivateTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocPrivateTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocProtectedTag() *JSDocProtectedTag {
|
|
switch n.Kind {
|
|
case KindJSDocProtectedTag:
|
|
return (*JSDocProtectedTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocProtectedTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocReadonlyTag() *JSDocReadonlyTag {
|
|
switch n.Kind {
|
|
case KindJSDocReadonlyTag:
|
|
return (*JSDocReadonlyTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocReadonlyTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocOverrideTag() *JSDocOverrideTag {
|
|
switch n.Kind {
|
|
case KindJSDocOverrideTag:
|
|
return (*JSDocOverrideTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocOverrideTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocDeprecatedTag() *JSDocDeprecatedTag {
|
|
switch n.Kind {
|
|
case KindJSDocDeprecatedTag:
|
|
return (*JSDocDeprecatedTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocDeprecatedTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocSeeTag() *JSDocSeeTag {
|
|
switch n.Kind {
|
|
case KindJSDocSeeTag:
|
|
return (*JSDocSeeTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocSeeTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocImplementsTag() *JSDocImplementsTag {
|
|
switch n.Kind {
|
|
case KindJSDocImplementsTag:
|
|
return (*JSDocImplementsTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocImplementsTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocAugmentsTag() *JSDocAugmentsTag {
|
|
switch n.Kind {
|
|
case KindJSDocAugmentsTag:
|
|
return (*JSDocAugmentsTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocAugmentsTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocSatisfiesTag() *JSDocSatisfiesTag {
|
|
switch n.Kind {
|
|
case KindJSDocSatisfiesTag:
|
|
return (*JSDocSatisfiesTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocSatisfiesTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocThrowsTag() *JSDocThrowsTag {
|
|
switch n.Kind {
|
|
case KindJSDocThrowsTag:
|
|
return (*JSDocThrowsTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocThrowsTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocThisTag() *JSDocThisTag {
|
|
switch n.Kind {
|
|
case KindJSDocThisTag:
|
|
return (*JSDocThisTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocThisTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocImportTag() *JSDocImportTag {
|
|
switch n.Kind {
|
|
case KindJSDocImportTag:
|
|
return (*JSDocImportTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocImportTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocCallbackTag() *JSDocCallbackTag {
|
|
switch n.Kind {
|
|
case KindJSDocCallbackTag:
|
|
return (*JSDocCallbackTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocCallbackTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocOverloadTag() *JSDocOverloadTag {
|
|
switch n.Kind {
|
|
case KindJSDocOverloadTag:
|
|
return (*JSDocOverloadTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocOverloadTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocTypedefTag() *JSDocTypedefTag {
|
|
switch n.Kind {
|
|
case KindJSDocTypedefTag:
|
|
return (*JSDocTypedefTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocTypedefTag")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocSignature() *JSDocSignature {
|
|
switch n.Kind {
|
|
case KindJSDocSignature:
|
|
return (*JSDocSignature)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocSignature")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocNameReference() *JSDocNameReference {
|
|
switch n.Kind {
|
|
case KindJSDocNameReference:
|
|
return (*JSDocNameReference)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocNameReference")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSourceFile() *SourceFile {
|
|
switch n.Kind {
|
|
case KindSourceFile:
|
|
return (*SourceFile)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SourceFile")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsModuleDeclaration() *ModuleDeclaration {
|
|
switch n.Kind {
|
|
case KindModuleDeclaration:
|
|
return (*ModuleDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ModuleDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportEqualsDeclaration() *ImportEqualsDeclaration {
|
|
switch n.Kind {
|
|
case KindImportEqualsDeclaration:
|
|
return (*ImportEqualsDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportEqualsDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsExportDeclaration() *ExportDeclaration {
|
|
switch n.Kind {
|
|
case KindExportDeclaration:
|
|
return (*ExportDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ExportDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportTypeNode() *ImportTypeNode {
|
|
switch n.Kind {
|
|
case KindImportType:
|
|
return (*ImportTypeNode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportTypeNode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportClause() *ImportClause {
|
|
switch n.Kind {
|
|
case KindImportClause:
|
|
return (*ImportClause)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportClause")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsImportSpecifier() *ImportSpecifier {
|
|
switch n.Kind {
|
|
case KindImportSpecifier:
|
|
return (*ImportSpecifier)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to ImportSpecifier")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocText() *JSDocText {
|
|
switch n.Kind {
|
|
case KindJSDocText:
|
|
return (*JSDocText)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocText")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocLink() *JSDocLink {
|
|
switch n.Kind {
|
|
case KindJSDocLink:
|
|
return (*JSDocLink)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocLink")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocLinkPlain() *JSDocLinkPlain {
|
|
switch n.Kind {
|
|
case KindJSDocLinkPlain:
|
|
return (*JSDocLinkPlain)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocLinkPlain")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocLinkCode() *JSDocLinkCode {
|
|
switch n.Kind {
|
|
case KindJSDocLinkCode:
|
|
return (*JSDocLinkCode)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocLinkCode")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsTypeParameterDeclaration() *TypeParameterDeclaration {
|
|
switch n.Kind {
|
|
case KindTypeParameter:
|
|
return (*TypeParameterDeclaration)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to TypeParameterDeclaration")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsSyntheticReferenceExpression() *SyntheticReferenceExpression {
|
|
switch n.Kind {
|
|
case KindSyntheticReferenceExpression:
|
|
return (*SyntheticReferenceExpression)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to SyntheticReferenceExpression")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocTypeLiteral() *JSDocTypeLiteral {
|
|
switch n.Kind {
|
|
case KindJSDocTypeLiteral:
|
|
return (*JSDocTypeLiteral)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocTypeLiteral")
|
|
}
|
|
}
|
|
|
|
func (n *Node) AsJSDocParameterOrPropertyTag() *JSDocParameterOrPropertyTag {
|
|
switch n.Kind {
|
|
case KindJSDocParameterTag, KindJSDocPropertyTag:
|
|
return (*JSDocParameterOrPropertyTag)(unsafe.Pointer(n))
|
|
default:
|
|
panic("Cannot cast " + n.Kind.String() + " to JSDocParameterOrPropertyTag")
|
|
}
|
|
}
|
|
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
// Kind alias guards
|
|
// ──────────────────────────────────────────────────────────────────────
|
|
|
|
func IsTriviaKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsLiteralKind(kind Kind) bool {
|
|
return kind >= KindFirstLiteralToken && kind <= KindLastLiteralToken
|
|
}
|
|
|
|
func IsPseudoLiteralKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindTemplateHead, KindTemplateMiddle, KindTemplateTail:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsPunctuationKind(kind Kind) bool {
|
|
return kind >= KindFirstPunctuation && kind <= KindLastPunctuation
|
|
}
|
|
|
|
func IsKeywordKind(kind Kind) bool {
|
|
return kind >= KindFirstKeyword && kind <= KindLastKeyword
|
|
}
|
|
|
|
func IsModifierKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindAbstractKeyword, KindAccessorKeyword, KindAsyncKeyword, KindConstKeyword, KindDeclareKeyword, KindDefaultKeyword, KindExportKeyword, KindInKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindReadonlyKeyword, KindOutKeyword, KindOverrideKeyword, KindStaticKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsKeywordTypeKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindAnyKeyword, KindBigIntKeyword, KindBooleanKeyword, KindIntrinsicKeyword, KindNeverKeyword, KindNumberKeyword, KindObjectKeyword, KindStringKeyword, KindSymbolKeyword, KindUndefinedKeyword, KindUnknownKeyword, KindVoidKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsKeywordExpressionKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindNullKeyword, KindTrueKeyword, KindFalseKeyword, KindThisKeyword, KindSuperKeyword, KindImportKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsTokenKind(kind Kind) bool {
|
|
return kind >= KindFirstToken && kind <= KindLastToken
|
|
}
|
|
|
|
func IsJsxTokenKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindLessThanSlashToken, KindEndOfFile, KindConflictMarkerTrivia, KindJsxText, KindJsxTextAllWhiteSpaces, KindOpenBraceToken, KindLessThanToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsJSDocNodeKind(kind Kind) bool {
|
|
return kind >= KindFirstJSDocNode && kind <= KindLastJSDocNode
|
|
}
|
|
|
|
func IsImportPhaseModifierKind(kind Kind) bool {
|
|
switch kind {
|
|
case KindTypeKeyword, KindDeferKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsPostfixUnaryOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindPlusPlusToken, KindMinusMinusToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsPrefixUnaryOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindPlusToken, KindMinusToken, KindTildeToken, KindExclamationToken, KindPlusPlusToken, KindMinusMinusToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsAssignmentOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskAsteriskEqualsToken, KindAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindCaretEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsBinaryOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindQuestionQuestionToken, KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword, KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindAmpersandAmpersandToken, KindBarBarToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskAsteriskEqualsToken, KindAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindCaretEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCommaToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsExponentiationOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsMultiplicativeOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskToken, KindSlashToken, KindPercentToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsMultiplicativeOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsAdditiveOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindPlusToken, KindMinusToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsAdditiveOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsShiftOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsShiftOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsRelationalOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsRelationalOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsEqualityOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsEqualityOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword, KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsBitwiseOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindAmpersandToken, KindBarToken, KindCaretToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsBitwiseOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword, KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken, KindAmpersandToken, KindBarToken, KindCaretToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsLogicalOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindAmpersandAmpersandToken, KindBarBarToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsLogicalOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword, KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindAmpersandAmpersandToken, KindBarBarToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsCompoundAssignmentOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskAsteriskEqualsToken, KindAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindCaretEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsAssignmentOperatorOrHigher(kind Kind) bool {
|
|
switch kind {
|
|
case KindQuestionQuestionToken, KindAsteriskAsteriskToken, KindAsteriskToken, KindSlashToken, KindPercentToken, KindPlusToken, KindMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindLessThanToken, KindLessThanEqualsToken, KindGreaterThanToken, KindGreaterThanEqualsToken, KindInstanceOfKeyword, KindInKeyword, KindEqualsEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindExclamationEqualsToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindAmpersandAmpersandToken, KindBarBarToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskAsteriskEqualsToken, KindAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindCaretEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func IsLogicalOrCoalescingAssignmentOperator(kind Kind) bool {
|
|
switch kind {
|
|
case KindAmpersandAmpersandEqualsToken, KindBarBarEqualsToken, KindQuestionQuestionEqualsToken:
|
|
return true
|
|
}
|
|
return false
|
|
}
|