AstCloner class

An AST visitor that will clone any AST structure that it visits. The cloner will only clone the structure, it will not preserve any resolution results or properties associated with the nodes.

Implemented types

Constructors

AstCloner([bool cloneTokens = false])
Initialize a newly created AST cloner to optionally clone tokens while cloning AST nodes if cloneTokens is true. [...]

Properties

cloneTokens → bool
A flag indicating whether tokens should be cloned while cloning an AST structure.
final
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

cloneNode<E extends AstNode>(E node) → E
Return a clone of the given node.
cloneNodeList<E extends AstNode>(List<E> nodes) → List<E>
Return a list containing cloned versions of the nodes in the given list of nodes.
cloneToken(Token token) Token
Clone the given token if tokens are supposed to be cloned.
cloneTokenList(List<Token> tokens) → List<Token>
Clone the given tokens if tokens are supposed to be cloned.
visitAdjacentStrings(AdjacentStrings node) AdjacentStrings
override
visitAnnotation(Annotation node) Annotation
override
visitArgumentList(ArgumentList node) ArgumentList
override
visitAsExpression(AsExpression node) AsExpression
override
visitAssertInitializer(AssertInitializer node) AstNode
override
visitAssertStatement(AssertStatement node) AstNode
override
visitAssignmentExpression(AssignmentExpression node) AssignmentExpression
override
visitAwaitExpression(AwaitExpression node) AwaitExpression
override
visitBinaryExpression(BinaryExpression node) BinaryExpression
override
visitBlock(Block node) Block
override
visitBlockFunctionBody(BlockFunctionBody node) BlockFunctionBody
override
visitBooleanLiteral(BooleanLiteral node) BooleanLiteral
override
visitBreakStatement(BreakStatement node) BreakStatement
override
visitCascadeExpression(CascadeExpression node) CascadeExpression
override
visitCatchClause(CatchClause node) CatchClause
override
visitClassDeclaration(ClassDeclaration node) ClassDeclaration
override
visitClassTypeAlias(ClassTypeAlias node) ClassTypeAlias
override
visitComment(Comment node) Comment
override
visitCommentReference(CommentReference node) CommentReference
override
visitCompilationUnit(CompilationUnit node) CompilationUnit
override
visitConditionalExpression(ConditionalExpression node) ConditionalExpression
override
visitConfiguration(Configuration node) Configuration
override
visitConstructorDeclaration(ConstructorDeclaration node) ConstructorDeclaration
override
visitConstructorFieldInitializer(ConstructorFieldInitializer node) ConstructorFieldInitializer
override
visitConstructorName(ConstructorName node) ConstructorName
override
visitContinueStatement(ContinueStatement node) ContinueStatement
override
visitDeclaredIdentifier(DeclaredIdentifier node) DeclaredIdentifier
override
visitDefaultFormalParameter(DefaultFormalParameter node) DefaultFormalParameter
override
visitDoStatement(DoStatement node) DoStatement
override
visitDottedName(DottedName node) DottedName
override
visitDoubleLiteral(DoubleLiteral node) DoubleLiteral
override
visitEmptyFunctionBody(EmptyFunctionBody node) EmptyFunctionBody
override
visitEmptyStatement(EmptyStatement node) EmptyStatement
override
visitEnumConstantDeclaration(EnumConstantDeclaration node) AstNode
override
visitEnumDeclaration(EnumDeclaration node) EnumDeclaration
override
visitExportDirective(ExportDirective node) ExportDirective
override
visitExpressionFunctionBody(ExpressionFunctionBody node) ExpressionFunctionBody
override
visitExpressionStatement(ExpressionStatement node) ExpressionStatement
override
visitExtendsClause(ExtendsClause node) ExtendsClause
override
visitExtensionDeclaration(ExtensionDeclaration node) ExtensionDeclaration
override
visitExtensionOverride(ExtensionOverride node) ExtensionOverride
override
visitFieldDeclaration(FieldDeclaration node) FieldDeclaration
override
visitFieldFormalParameter(FieldFormalParameter node) FieldFormalParameter
override
visitForEachPartsWithDeclaration(ForEachPartsWithDeclaration node) ForEachPartsWithDeclaration
override
visitForEachPartsWithIdentifier(ForEachPartsWithIdentifier node) ForEachPartsWithIdentifier
override
visitForElement(ForElement node) ForElement
override
visitFormalParameterList(FormalParameterList node) FormalParameterList
override
visitForPartsWithDeclarations(ForPartsWithDeclarations node) ForPartsWithDeclarations
override
visitForPartsWithExpression(ForPartsWithExpression node) ForPartsWithExpression
override
visitForStatement(ForStatement node) ForStatement
override
visitFunctionDeclaration(FunctionDeclaration node) FunctionDeclaration
override
visitFunctionDeclarationStatement(FunctionDeclarationStatement node) FunctionDeclarationStatement
override
visitFunctionExpression(FunctionExpression node) FunctionExpression
override
visitFunctionExpressionInvocation(FunctionExpressionInvocation node) FunctionExpressionInvocation
override
visitFunctionTypeAlias(FunctionTypeAlias node) FunctionTypeAlias
override
visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) FunctionTypedFormalParameter
override
visitGenericFunctionType(GenericFunctionType node) AstNode
override
visitGenericTypeAlias(GenericTypeAlias node) AstNode
override
visitHideCombinator(HideCombinator node) HideCombinator
override
visitIfElement(IfElement node) IfElement
override
visitIfStatement(IfStatement node) IfStatement
override
visitImplementsClause(ImplementsClause node) ImplementsClause
override
visitImportDirective(ImportDirective node) ImportDirective
override
visitIndexExpression(IndexExpression node) IndexExpression
override
visitInstanceCreationExpression(InstanceCreationExpression node) InstanceCreationExpression
override
visitIntegerLiteral(IntegerLiteral node) IntegerLiteral
override
visitInterpolationExpression(InterpolationExpression node) InterpolationExpression
override
visitInterpolationString(InterpolationString node) InterpolationString
override
visitIsExpression(IsExpression node) IsExpression
override
visitLabel(Label node) Label
override
visitLabeledStatement(LabeledStatement node) LabeledStatement
override
visitLibraryDirective(LibraryDirective node) LibraryDirective
override
visitLibraryIdentifier(LibraryIdentifier node) LibraryIdentifier
override
visitListLiteral(ListLiteral node) ListLiteral
override
visitMapLiteralEntry(MapLiteralEntry node) MapLiteralEntry
override
visitMethodDeclaration(MethodDeclaration node) MethodDeclaration
override
visitMethodInvocation(MethodInvocation node) MethodInvocation
override
visitMixinDeclaration(MixinDeclaration node) AstNode
override
visitNamedExpression(NamedExpression node) NamedExpression
override
visitNativeClause(NativeClause node) AstNode
override
visitNativeFunctionBody(NativeFunctionBody node) NativeFunctionBody
override
visitNullLiteral(NullLiteral node) NullLiteral
override
visitOnClause(OnClause node) AstNode
override
visitParenthesizedExpression(ParenthesizedExpression node) ParenthesizedExpression
override
visitPartDirective(PartDirective node) PartDirective
override
visitPartOfDirective(PartOfDirective node) PartOfDirective
override
visitPostfixExpression(PostfixExpression node) PostfixExpression
override
visitPrefixedIdentifier(PrefixedIdentifier node) PrefixedIdentifier
override
visitPrefixExpression(PrefixExpression node) PrefixExpression
override
visitPropertyAccess(PropertyAccess node) PropertyAccess
override
visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) RedirectingConstructorInvocation
override
visitRethrowExpression(RethrowExpression node) RethrowExpression
override
visitReturnStatement(ReturnStatement node) ReturnStatement
override
visitScriptTag(ScriptTag node) ScriptTag
override
visitSetOrMapLiteral(SetOrMapLiteral node) SetOrMapLiteral
override
visitShowCombinator(ShowCombinator node) ShowCombinator
override
visitSimpleFormalParameter(SimpleFormalParameter node) SimpleFormalParameter
override
visitSimpleIdentifier(SimpleIdentifier node) SimpleIdentifier
override
visitSimpleStringLiteral(SimpleStringLiteral node) SimpleStringLiteral
override
visitSpreadElement(SpreadElement node) SpreadElement
override
visitStringInterpolation(StringInterpolation node) StringInterpolation
override
visitSuperConstructorInvocation(SuperConstructorInvocation node) SuperConstructorInvocation
override
visitSuperExpression(SuperExpression node) SuperExpression
override
visitSwitchCase(SwitchCase node) SwitchCase
override
visitSwitchDefault(SwitchDefault node) SwitchDefault
override
visitSwitchStatement(SwitchStatement node) SwitchStatement
override
visitSymbolLiteral(SymbolLiteral node) SymbolLiteral
override
visitThisExpression(ThisExpression node) ThisExpression
override
visitThrowExpression(ThrowExpression node) ThrowExpression
override
visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) TopLevelVariableDeclaration
override
visitTryStatement(TryStatement node) TryStatement
override
visitTypeArgumentList(TypeArgumentList node) TypeArgumentList
override
visitTypeName(TypeName node) TypeName
override
visitTypeParameter(TypeParameter node) TypeParameter
override
visitTypeParameterList(TypeParameterList node) TypeParameterList
override
visitVariableDeclaration(VariableDeclaration node) VariableDeclaration
override
visitVariableDeclarationList(VariableDeclarationList node) VariableDeclarationList
override
visitVariableDeclarationStatement(VariableDeclarationStatement node) VariableDeclarationStatement
override
visitWhileStatement(WhileStatement node) WhileStatement
override
visitWithClause(WithClause node) WithClause
override
visitYieldStatement(YieldStatement node) YieldStatement
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Methods

clone(AstNode node) AstNode
Return a clone of the given node.