pub trait FoldAstPath {
Show 21 methods
// Provided methods
fn fold_atom(&mut self, node: Atom, __ast_path: &mut AstKindPath) -> Atom { ... }
fn fold_attribute(
&mut self,
node: Attribute,
__ast_path: &mut AstKindPath,
) -> Attribute { ... }
fn fold_attribute_token(
&mut self,
node: AttributeToken,
__ast_path: &mut AstKindPath,
) -> AttributeToken { ... }
fn fold_attribute_tokens(
&mut self,
node: Vec<AttributeToken>,
__ast_path: &mut AstKindPath,
) -> Vec<AttributeToken> { ... }
fn fold_attributes(
&mut self,
node: Vec<Attribute>,
__ast_path: &mut AstKindPath,
) -> Vec<Attribute> { ... }
fn fold_cdata_section(
&mut self,
node: CdataSection,
__ast_path: &mut AstKindPath,
) -> CdataSection { ... }
fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child { ... }
fn fold_childs(
&mut self,
node: Vec<Child>,
__ast_path: &mut AstKindPath,
) -> Vec<Child> { ... }
fn fold_comment(
&mut self,
node: Comment,
__ast_path: &mut AstKindPath,
) -> Comment { ... }
fn fold_document(
&mut self,
node: Document,
__ast_path: &mut AstKindPath,
) -> Document { ... }
fn fold_document_mode(
&mut self,
node: DocumentMode,
__ast_path: &mut AstKindPath,
) -> DocumentMode { ... }
fn fold_document_type(
&mut self,
node: DocumentType,
__ast_path: &mut AstKindPath,
) -> DocumentType { ... }
fn fold_element(
&mut self,
node: Element,
__ast_path: &mut AstKindPath,
) -> Element { ... }
fn fold_namespace(
&mut self,
node: Namespace,
__ast_path: &mut AstKindPath,
) -> Namespace { ... }
fn fold_opt_atom(
&mut self,
node: Option<Atom>,
__ast_path: &mut AstKindPath,
) -> Option<Atom> { ... }
fn fold_opt_namespace(
&mut self,
node: Option<Namespace>,
__ast_path: &mut AstKindPath,
) -> Option<Namespace> { ... }
fn fold_processing_instruction(
&mut self,
node: ProcessingInstruction,
__ast_path: &mut AstKindPath,
) -> ProcessingInstruction { ... }
fn fold_span(&mut self, node: Span, __ast_path: &mut AstKindPath) -> Span { ... }
fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text { ... }
fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token { ... }
fn fold_token_and_span(
&mut self,
node: TokenAndSpan,
__ast_path: &mut AstKindPath,
) -> TokenAndSpan { ... }
}
path
only.Expand description
A visitor trait for traversing the AST.
Provided Methods§
sourcefn fold_atom(&mut self, node: Atom, __ast_path: &mut AstKindPath) -> Atom
fn fold_atom(&mut self, node: Atom, __ast_path: &mut AstKindPath) -> Atom
Visit a node of type swc_atoms :: Atom
.
By default, this method calls [swc_atoms :: Atom::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute(
&mut self,
node: Attribute,
__ast_path: &mut AstKindPath,
) -> Attribute
fn fold_attribute( &mut self, node: Attribute, __ast_path: &mut AstKindPath, ) -> Attribute
Visit a node of type Attribute
.
By default, this method calls [Attribute::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute_token(
&mut self,
node: AttributeToken,
__ast_path: &mut AstKindPath,
) -> AttributeToken
fn fold_attribute_token( &mut self, node: AttributeToken, __ast_path: &mut AstKindPath, ) -> AttributeToken
Visit a node of type AttributeToken
.
By default, this method calls [AttributeToken::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_attribute_tokens(
&mut self,
node: Vec<AttributeToken>,
__ast_path: &mut AstKindPath,
) -> Vec<AttributeToken>
fn fold_attribute_tokens( &mut self, node: Vec<AttributeToken>, __ast_path: &mut AstKindPath, ) -> Vec<AttributeToken>
Visit a node of type Vec < AttributeToken >
.
By default, this method calls [Vec < AttributeToken >::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_attributes(
&mut self,
node: Vec<Attribute>,
__ast_path: &mut AstKindPath,
) -> Vec<Attribute>
fn fold_attributes( &mut self, node: Vec<Attribute>, __ast_path: &mut AstKindPath, ) -> Vec<Attribute>
Visit a node of type Vec < Attribute >
.
By default, this method calls [Vec < Attribute >::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_cdata_section(
&mut self,
node: CdataSection,
__ast_path: &mut AstKindPath,
) -> CdataSection
fn fold_cdata_section( &mut self, node: CdataSection, __ast_path: &mut AstKindPath, ) -> CdataSection
Visit a node of type CdataSection
.
By default, this method calls [CdataSection::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child
fn fold_child(&mut self, node: Child, __ast_path: &mut AstKindPath) -> Child
Visit a node of type Child
.
By default, this method calls [Child::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_childs(
&mut self,
node: Vec<Child>,
__ast_path: &mut AstKindPath,
) -> Vec<Child>
fn fold_childs( &mut self, node: Vec<Child>, __ast_path: &mut AstKindPath, ) -> Vec<Child>
Visit a node of type Vec < Child >
.
By default, this method calls [Vec < Child >::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_comment(
&mut self,
node: Comment,
__ast_path: &mut AstKindPath,
) -> Comment
fn fold_comment( &mut self, node: Comment, __ast_path: &mut AstKindPath, ) -> Comment
Visit a node of type Comment
.
By default, this method calls [Comment::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_document(
&mut self,
node: Document,
__ast_path: &mut AstKindPath,
) -> Document
fn fold_document( &mut self, node: Document, __ast_path: &mut AstKindPath, ) -> Document
Visit a node of type Document
.
By default, this method calls [Document::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_document_mode(
&mut self,
node: DocumentMode,
__ast_path: &mut AstKindPath,
) -> DocumentMode
fn fold_document_mode( &mut self, node: DocumentMode, __ast_path: &mut AstKindPath, ) -> DocumentMode
Visit a node of type DocumentMode
.
By default, this method calls [DocumentMode::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_document_type(
&mut self,
node: DocumentType,
__ast_path: &mut AstKindPath,
) -> DocumentType
fn fold_document_type( &mut self, node: DocumentType, __ast_path: &mut AstKindPath, ) -> DocumentType
Visit a node of type DocumentType
.
By default, this method calls [DocumentType::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_element(
&mut self,
node: Element,
__ast_path: &mut AstKindPath,
) -> Element
fn fold_element( &mut self, node: Element, __ast_path: &mut AstKindPath, ) -> Element
Visit a node of type Element
.
By default, this method calls [Element::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_namespace(
&mut self,
node: Namespace,
__ast_path: &mut AstKindPath,
) -> Namespace
fn fold_namespace( &mut self, node: Namespace, __ast_path: &mut AstKindPath, ) -> Namespace
Visit a node of type Namespace
.
By default, this method calls [Namespace::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_opt_atom(
&mut self,
node: Option<Atom>,
__ast_path: &mut AstKindPath,
) -> Option<Atom>
fn fold_opt_atom( &mut self, node: Option<Atom>, __ast_path: &mut AstKindPath, ) -> Option<Atom>
Visit a node of type Option < swc_atoms :: Atom >
.
By default, this method calls [Option < swc_atoms :: Atom >::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_opt_namespace(
&mut self,
node: Option<Namespace>,
__ast_path: &mut AstKindPath,
) -> Option<Namespace>
fn fold_opt_namespace( &mut self, node: Option<Namespace>, __ast_path: &mut AstKindPath, ) -> Option<Namespace>
Visit a node of type Option < Namespace >
.
By default, this method calls [Option < Namespace >::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_processing_instruction(
&mut self,
node: ProcessingInstruction,
__ast_path: &mut AstKindPath,
) -> ProcessingInstruction
fn fold_processing_instruction( &mut self, node: ProcessingInstruction, __ast_path: &mut AstKindPath, ) -> ProcessingInstruction
Visit a node of type ProcessingInstruction
.
By default, this method calls [ProcessingInstruction::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_span(&mut self, node: Span, __ast_path: &mut AstKindPath) -> Span
fn fold_span(&mut self, node: Span, __ast_path: &mut AstKindPath) -> Span
Visit a node of type swc_common :: Span
.
By default, this method calls [swc_common :: Span::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text
fn fold_text(&mut self, node: Text, __ast_path: &mut AstKindPath) -> Text
Visit a node of type Text
.
By default, this method calls [Text::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token
fn fold_token(&mut self, node: Token, __ast_path: &mut AstKindPath) -> Token
Visit a node of type Token
.
By default, this method calls [Token::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.
sourcefn fold_token_and_span(
&mut self,
node: TokenAndSpan,
__ast_path: &mut AstKindPath,
) -> TokenAndSpan
fn fold_token_and_span( &mut self, node: TokenAndSpan, __ast_path: &mut AstKindPath, ) -> TokenAndSpan
Visit a node of type TokenAndSpan
.
By default, this method calls [TokenAndSpan::fold_children_with_ast_path
]. If you want to recurse, you need to call it manually.