From 911d4eaa146ff493636308a3cebd8b21d941bfde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 20 Aug 2024 15:50:11 +0900 Subject: [PATCH] perf(visit): Add linear AST traversal (#9452) **Description:** Babel decorator pass uses `fastTraverse`, and I think we can have one. **Related issue:** - Closes https://github.com/swc-project/swc/issues/9451 --- .changeset/olive-pianos-lay.md | 9 + crates/swc_css_visit/src/generated.rs | 2623 +++++++++++- crates/swc_ecma_visit/src/generated.rs | 3769 ++++++++++++++++- crates/swc_html_visit/src/generated.rs | 183 +- crates/swc_xml_visit/src/generated.rs | 176 +- tools/generate-code/src/generators/visitor.rs | 184 +- 6 files changed, 6926 insertions(+), 18 deletions(-) create mode 100644 .changeset/olive-pianos-lay.md diff --git a/.changeset/olive-pianos-lay.md b/.changeset/olive-pianos-lay.md new file mode 100644 index 00000000000..65a692b1e82 --- /dev/null +++ b/.changeset/olive-pianos-lay.md @@ -0,0 +1,9 @@ +--- +swc_css_visit: patch +swc_ecma_visit: patch +swc_html_visit: patch +swc_xml_visit: patch +swc_core: patch +--- + +perf(visit): Add linear AST traversal diff --git a/crates/swc_css_visit/src/generated.rs b/crates/swc_css_visit/src/generated.rs index 5edde07afea..7cb3ad7e628 100644 --- a/crates/swc_css_visit/src/generated.rs +++ b/crates/swc_css_visit/src/generated.rs @@ -110852,7 +110852,6 @@ pub mod fields { #[doc = "Represents [`WqName::value`]"] Value, } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AstParentKind { AbsoluteColorBase(AbsoluteColorBaseField), @@ -111209,7 +111208,6 @@ pub mod fields { } } } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy)] pub enum AstParentNodeRef<'ast> { AbsoluteColorBase(&'ast AbsoluteColorBase, AbsoluteColorBaseField), @@ -111628,6 +111626,7 @@ pub mod fields { } } } + #[cfg(any(docsrs, feature = "path"))] impl<'ast> AstParentNodeRef<'ast> { #[inline] pub fn kind(&self) -> AstParentKind { @@ -111995,5 +111994,2625 @@ pub mod fields { } } } +impl<'ast> From<&'ast AbsoluteColorBase> for NodeRef<'ast> { + fn from(node: &'ast AbsoluteColorBase) -> Self { + NodeRef::AbsoluteColorBase(node) + } +} +impl<'ast> From<&'ast AlphaValue> for NodeRef<'ast> { + fn from(node: &'ast AlphaValue) -> Self { + NodeRef::AlphaValue(node) + } +} +impl<'ast> From<&'ast AnPlusB> for NodeRef<'ast> { + fn from(node: &'ast AnPlusB) -> Self { + NodeRef::AnPlusB(node) + } +} +impl<'ast> From<&'ast AnPlusBNotation> for NodeRef<'ast> { + fn from(node: &'ast AnPlusBNotation) -> Self { + NodeRef::AnPlusBNotation(node) + } +} +impl<'ast> From<&'ast Angle> for NodeRef<'ast> { + fn from(node: &'ast Angle) -> Self { + NodeRef::Angle(node) + } +} +impl<'ast> From<&'ast AnglePercentage> for NodeRef<'ast> { + fn from(node: &'ast AnglePercentage) -> Self { + NodeRef::AnglePercentage(node) + } +} +impl<'ast> From<&'ast AnyNamespace> for NodeRef<'ast> { + fn from(node: &'ast AnyNamespace) -> Self { + NodeRef::AnyNamespace(node) + } +} +impl<'ast> From<&'ast AtRule> for NodeRef<'ast> { + fn from(node: &'ast AtRule) -> Self { + NodeRef::AtRule(node) + } +} +impl<'ast> From<&'ast AtRuleName> for NodeRef<'ast> { + fn from(node: &'ast AtRuleName) -> Self { + NodeRef::AtRuleName(node) + } +} +impl<'ast> From<&'ast AtRulePrelude> for NodeRef<'ast> { + fn from(node: &'ast AtRulePrelude) -> Self { + NodeRef::AtRulePrelude(node) + } +} +impl<'ast> From<&'ast AttributeSelector> for NodeRef<'ast> { + fn from(node: &'ast AttributeSelector) -> Self { + NodeRef::AttributeSelector(node) + } +} +impl<'ast> From<&'ast AttributeSelectorMatcher> for NodeRef<'ast> { + fn from(node: &'ast AttributeSelectorMatcher) -> Self { + NodeRef::AttributeSelectorMatcher(node) + } +} +impl<'ast> From<&'ast AttributeSelectorMatcherValue> for NodeRef<'ast> { + fn from(node: &'ast AttributeSelectorMatcherValue) -> Self { + NodeRef::AttributeSelectorMatcherValue(node) + } +} +impl<'ast> From<&'ast AttributeSelectorModifier> for NodeRef<'ast> { + fn from(node: &'ast AttributeSelectorModifier) -> Self { + NodeRef::AttributeSelectorModifier(node) + } +} +impl<'ast> From<&'ast AttributeSelectorValue> for NodeRef<'ast> { + fn from(node: &'ast AttributeSelectorValue) -> Self { + NodeRef::AttributeSelectorValue(node) + } +} +impl<'ast> From<&'ast BinOp> for NodeRef<'ast> { + fn from(node: &'ast BinOp) -> Self { + NodeRef::BinOp(node) + } +} +impl<'ast> From<&'ast CalcOperator> for NodeRef<'ast> { + fn from(node: &'ast CalcOperator) -> Self { + NodeRef::CalcOperator(node) + } +} +impl<'ast> From<&'ast CalcOperatorType> for NodeRef<'ast> { + fn from(node: &'ast CalcOperatorType) -> Self { + NodeRef::CalcOperatorType(node) + } +} +impl<'ast> From<&'ast CalcProduct> for NodeRef<'ast> { + fn from(node: &'ast CalcProduct) -> Self { + NodeRef::CalcProduct(node) + } +} +impl<'ast> From<&'ast CalcProductOrOperator> for NodeRef<'ast> { + fn from(node: &'ast CalcProductOrOperator) -> Self { + NodeRef::CalcProductOrOperator(node) + } +} +impl<'ast> From<&'ast CalcSum> for NodeRef<'ast> { + fn from(node: &'ast CalcSum) -> Self { + NodeRef::CalcSum(node) + } +} +impl<'ast> From<&'ast CalcValue> for NodeRef<'ast> { + fn from(node: &'ast CalcValue) -> Self { + NodeRef::CalcValue(node) + } +} +impl<'ast> From<&'ast CalcValueOrOperator> for NodeRef<'ast> { + fn from(node: &'ast CalcValueOrOperator) -> Self { + NodeRef::CalcValueOrOperator(node) + } +} +impl<'ast> From<&'ast ClassSelector> for NodeRef<'ast> { + fn from(node: &'ast ClassSelector) -> Self { + NodeRef::ClassSelector(node) + } +} +impl<'ast> From<&'ast CmykComponent> for NodeRef<'ast> { + fn from(node: &'ast CmykComponent) -> Self { + NodeRef::CmykComponent(node) + } +} +impl<'ast> From<&'ast Color> for NodeRef<'ast> { + fn from(node: &'ast Color) -> Self { + NodeRef::Color(node) + } +} +impl<'ast> From<&'ast ColorProfileName> for NodeRef<'ast> { + fn from(node: &'ast ColorProfileName) -> Self { + NodeRef::ColorProfileName(node) + } +} +impl<'ast> From<&'ast Combinator> for NodeRef<'ast> { + fn from(node: &'ast Combinator) -> Self { + NodeRef::Combinator(node) + } +} +impl<'ast> From<&'ast CombinatorValue> for NodeRef<'ast> { + fn from(node: &'ast CombinatorValue) -> Self { + NodeRef::CombinatorValue(node) + } +} +impl<'ast> From<&'ast ComplexSelector> for NodeRef<'ast> { + fn from(node: &'ast ComplexSelector) -> Self { + NodeRef::ComplexSelector(node) + } +} +impl<'ast> From<&'ast ComplexSelectorChildren> for NodeRef<'ast> { + fn from(node: &'ast ComplexSelectorChildren) -> Self { + NodeRef::ComplexSelectorChildren(node) + } +} +impl<'ast> From<&'ast ComponentValue> for NodeRef<'ast> { + fn from(node: &'ast ComponentValue) -> Self { + NodeRef::ComponentValue(node) + } +} +impl<'ast> From<&'ast CompoundSelector> for NodeRef<'ast> { + fn from(node: &'ast CompoundSelector) -> Self { + NodeRef::CompoundSelector(node) + } +} +impl<'ast> From<&'ast CompoundSelectorList> for NodeRef<'ast> { + fn from(node: &'ast CompoundSelectorList) -> Self { + NodeRef::CompoundSelectorList(node) + } +} +impl<'ast> From<&'ast ContainerCondition> for NodeRef<'ast> { + fn from(node: &'ast ContainerCondition) -> Self { + NodeRef::ContainerCondition(node) + } +} +impl<'ast> From<&'ast ContainerName> for NodeRef<'ast> { + fn from(node: &'ast ContainerName) -> Self { + NodeRef::ContainerName(node) + } +} +impl<'ast> From<&'ast ContainerQuery> for NodeRef<'ast> { + fn from(node: &'ast ContainerQuery) -> Self { + NodeRef::ContainerQuery(node) + } +} +impl<'ast> From<&'ast ContainerQueryAnd> for NodeRef<'ast> { + fn from(node: &'ast ContainerQueryAnd) -> Self { + NodeRef::ContainerQueryAnd(node) + } +} +impl<'ast> From<&'ast ContainerQueryNot> for NodeRef<'ast> { + fn from(node: &'ast ContainerQueryNot) -> Self { + NodeRef::ContainerQueryNot(node) + } +} +impl<'ast> From<&'ast ContainerQueryOr> for NodeRef<'ast> { + fn from(node: &'ast ContainerQueryOr) -> Self { + NodeRef::ContainerQueryOr(node) + } +} +impl<'ast> From<&'ast ContainerQueryType> for NodeRef<'ast> { + fn from(node: &'ast ContainerQueryType) -> Self { + NodeRef::ContainerQueryType(node) + } +} +impl<'ast> From<&'ast CustomHighlightName> for NodeRef<'ast> { + fn from(node: &'ast CustomHighlightName) -> Self { + NodeRef::CustomHighlightName(node) + } +} +impl<'ast> From<&'ast CustomIdent> for NodeRef<'ast> { + fn from(node: &'ast CustomIdent) -> Self { + NodeRef::CustomIdent(node) + } +} +impl<'ast> From<&'ast CustomMediaQuery> for NodeRef<'ast> { + fn from(node: &'ast CustomMediaQuery) -> Self { + NodeRef::CustomMediaQuery(node) + } +} +impl<'ast> From<&'ast CustomMediaQueryMediaType> for NodeRef<'ast> { + fn from(node: &'ast CustomMediaQueryMediaType) -> Self { + NodeRef::CustomMediaQueryMediaType(node) + } +} +impl<'ast> From<&'ast CustomPropertyName> for NodeRef<'ast> { + fn from(node: &'ast CustomPropertyName) -> Self { + NodeRef::CustomPropertyName(node) + } +} +impl<'ast> From<&'ast DashedIdent> for NodeRef<'ast> { + fn from(node: &'ast DashedIdent) -> Self { + NodeRef::DashedIdent(node) + } +} +impl<'ast> From<&'ast Declaration> for NodeRef<'ast> { + fn from(node: &'ast Declaration) -> Self { + NodeRef::Declaration(node) + } +} +impl<'ast> From<&'ast DeclarationName> for NodeRef<'ast> { + fn from(node: &'ast DeclarationName) -> Self { + NodeRef::DeclarationName(node) + } +} +impl<'ast> From<&'ast DeclarationOrAtRule> for NodeRef<'ast> { + fn from(node: &'ast DeclarationOrAtRule) -> Self { + NodeRef::DeclarationOrAtRule(node) + } +} +impl<'ast> From<&'ast Delimiter> for NodeRef<'ast> { + fn from(node: &'ast Delimiter) -> Self { + NodeRef::Delimiter(node) + } +} +impl<'ast> From<&'ast DelimiterValue> for NodeRef<'ast> { + fn from(node: &'ast DelimiterValue) -> Self { + NodeRef::DelimiterValue(node) + } +} +impl<'ast> From<&'ast Dimension> for NodeRef<'ast> { + fn from(node: &'ast Dimension) -> Self { + NodeRef::Dimension(node) + } +} +impl<'ast> From<&'ast DimensionToken> for NodeRef<'ast> { + fn from(node: &'ast DimensionToken) -> Self { + NodeRef::DimensionToken(node) + } +} +impl<'ast> From<&'ast DocumentPrelude> for NodeRef<'ast> { + fn from(node: &'ast DocumentPrelude) -> Self { + NodeRef::DocumentPrelude(node) + } +} +impl<'ast> From<&'ast DocumentPreludeMatchingFunction> for NodeRef<'ast> { + fn from(node: &'ast DocumentPreludeMatchingFunction) -> Self { + NodeRef::DocumentPreludeMatchingFunction(node) + } +} +impl<'ast> From<&'ast ExtensionName> for NodeRef<'ast> { + fn from(node: &'ast ExtensionName) -> Self { + NodeRef::ExtensionName(node) + } +} +impl<'ast> From<&'ast FamilyName> for NodeRef<'ast> { + fn from(node: &'ast FamilyName) -> Self { + NodeRef::FamilyName(node) + } +} +impl<'ast> From<&'ast Flex> for NodeRef<'ast> { + fn from(node: &'ast Flex) -> Self { + NodeRef::Flex(node) + } +} +impl<'ast> From<&'ast FontFeatureValuesPrelude> for NodeRef<'ast> { + fn from(node: &'ast FontFeatureValuesPrelude) -> Self { + NodeRef::FontFeatureValuesPrelude(node) + } +} +impl<'ast> From<&'ast ForgivingComplexSelector> for NodeRef<'ast> { + fn from(node: &'ast ForgivingComplexSelector) -> Self { + NodeRef::ForgivingComplexSelector(node) + } +} +impl<'ast> From<&'ast ForgivingRelativeSelector> for NodeRef<'ast> { + fn from(node: &'ast ForgivingRelativeSelector) -> Self { + NodeRef::ForgivingRelativeSelector(node) + } +} +impl<'ast> From<&'ast ForgivingRelativeSelectorList> for NodeRef<'ast> { + fn from(node: &'ast ForgivingRelativeSelectorList) -> Self { + NodeRef::ForgivingRelativeSelectorList(node) + } +} +impl<'ast> From<&'ast ForgivingSelectorList> for NodeRef<'ast> { + fn from(node: &'ast ForgivingSelectorList) -> Self { + NodeRef::ForgivingSelectorList(node) + } +} +impl<'ast> From<&'ast Frequency> for NodeRef<'ast> { + fn from(node: &'ast Frequency) -> Self { + NodeRef::Frequency(node) + } +} +impl<'ast> From<&'ast FrequencyPercentage> for NodeRef<'ast> { + fn from(node: &'ast FrequencyPercentage) -> Self { + NodeRef::FrequencyPercentage(node) + } +} +impl<'ast> From<&'ast Function> for NodeRef<'ast> { + fn from(node: &'ast Function) -> Self { + NodeRef::Function(node) + } +} +impl<'ast> From<&'ast FunctionName> for NodeRef<'ast> { + fn from(node: &'ast FunctionName) -> Self { + NodeRef::FunctionName(node) + } +} +impl<'ast> From<&'ast GeneralEnclosed> for NodeRef<'ast> { + fn from(node: &'ast GeneralEnclosed) -> Self { + NodeRef::GeneralEnclosed(node) + } +} +impl<'ast> From<&'ast HexColor> for NodeRef<'ast> { + fn from(node: &'ast HexColor) -> Self { + NodeRef::HexColor(node) + } +} +impl<'ast> From<&'ast Hue> for NodeRef<'ast> { + fn from(node: &'ast Hue) -> Self { + NodeRef::Hue(node) + } +} +impl<'ast> From<&'ast IdSelector> for NodeRef<'ast> { + fn from(node: &'ast IdSelector) -> Self { + NodeRef::IdSelector(node) + } +} +impl<'ast> From<&'ast Ident> for NodeRef<'ast> { + fn from(node: &'ast Ident) -> Self { + NodeRef::Ident(node) + } +} +impl<'ast> From<&'ast ImportConditions> for NodeRef<'ast> { + fn from(node: &'ast ImportConditions) -> Self { + NodeRef::ImportConditions(node) + } +} +impl<'ast> From<&'ast ImportHref> for NodeRef<'ast> { + fn from(node: &'ast ImportHref) -> Self { + NodeRef::ImportHref(node) + } +} +impl<'ast> From<&'ast ImportLayerName> for NodeRef<'ast> { + fn from(node: &'ast ImportLayerName) -> Self { + NodeRef::ImportLayerName(node) + } +} +impl<'ast> From<&'ast ImportPrelude> for NodeRef<'ast> { + fn from(node: &'ast ImportPrelude) -> Self { + NodeRef::ImportPrelude(node) + } +} +impl<'ast> From<&'ast ImportantFlag> for NodeRef<'ast> { + fn from(node: &'ast ImportantFlag) -> Self { + NodeRef::ImportantFlag(node) + } +} +impl<'ast> From<&'ast Integer> for NodeRef<'ast> { + fn from(node: &'ast Integer) -> Self { + NodeRef::Integer(node) + } +} +impl<'ast> From<&'ast KeyframeBlock> for NodeRef<'ast> { + fn from(node: &'ast KeyframeBlock) -> Self { + NodeRef::KeyframeBlock(node) + } +} +impl<'ast> From<&'ast KeyframeSelector> for NodeRef<'ast> { + fn from(node: &'ast KeyframeSelector) -> Self { + NodeRef::KeyframeSelector(node) + } +} +impl<'ast> From<&'ast KeyframesName> for NodeRef<'ast> { + fn from(node: &'ast KeyframesName) -> Self { + NodeRef::KeyframesName(node) + } +} +impl<'ast> From<&'ast KeyframesPseudoFunction> for NodeRef<'ast> { + fn from(node: &'ast KeyframesPseudoFunction) -> Self { + NodeRef::KeyframesPseudoFunction(node) + } +} +impl<'ast> From<&'ast KeyframesPseudoPrefix> for NodeRef<'ast> { + fn from(node: &'ast KeyframesPseudoPrefix) -> Self { + NodeRef::KeyframesPseudoPrefix(node) + } +} +impl<'ast> From<&'ast LayerName> for NodeRef<'ast> { + fn from(node: &'ast LayerName) -> Self { + NodeRef::LayerName(node) + } +} +impl<'ast> From<&'ast LayerNameList> for NodeRef<'ast> { + fn from(node: &'ast LayerNameList) -> Self { + NodeRef::LayerNameList(node) + } +} +impl<'ast> From<&'ast LayerPrelude> for NodeRef<'ast> { + fn from(node: &'ast LayerPrelude) -> Self { + NodeRef::LayerPrelude(node) + } +} +impl<'ast> From<&'ast Length> for NodeRef<'ast> { + fn from(node: &'ast Length) -> Self { + NodeRef::Length(node) + } +} +impl<'ast> From<&'ast LengthPercentage> for NodeRef<'ast> { + fn from(node: &'ast LengthPercentage) -> Self { + NodeRef::LengthPercentage(node) + } +} +impl<'ast> From<&'ast ListOfComponentValues> for NodeRef<'ast> { + fn from(node: &'ast ListOfComponentValues) -> Self { + NodeRef::ListOfComponentValues(node) + } +} +impl<'ast> From<&'ast MediaAnd> for NodeRef<'ast> { + fn from(node: &'ast MediaAnd) -> Self { + NodeRef::MediaAnd(node) + } +} +impl<'ast> From<&'ast MediaCondition> for NodeRef<'ast> { + fn from(node: &'ast MediaCondition) -> Self { + NodeRef::MediaCondition(node) + } +} +impl<'ast> From<&'ast MediaConditionAllType> for NodeRef<'ast> { + fn from(node: &'ast MediaConditionAllType) -> Self { + NodeRef::MediaConditionAllType(node) + } +} +impl<'ast> From<&'ast MediaConditionType> for NodeRef<'ast> { + fn from(node: &'ast MediaConditionType) -> Self { + NodeRef::MediaConditionType(node) + } +} +impl<'ast> From<&'ast MediaConditionWithoutOr> for NodeRef<'ast> { + fn from(node: &'ast MediaConditionWithoutOr) -> Self { + NodeRef::MediaConditionWithoutOr(node) + } +} +impl<'ast> From<&'ast MediaConditionWithoutOrType> for NodeRef<'ast> { + fn from(node: &'ast MediaConditionWithoutOrType) -> Self { + NodeRef::MediaConditionWithoutOrType(node) + } +} +impl<'ast> From<&'ast MediaFeature> for NodeRef<'ast> { + fn from(node: &'ast MediaFeature) -> Self { + NodeRef::MediaFeature(node) + } +} +impl<'ast> From<&'ast MediaFeatureBoolean> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureBoolean) -> Self { + NodeRef::MediaFeatureBoolean(node) + } +} +impl<'ast> From<&'ast MediaFeatureName> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureName) -> Self { + NodeRef::MediaFeatureName(node) + } +} +impl<'ast> From<&'ast MediaFeaturePlain> for NodeRef<'ast> { + fn from(node: &'ast MediaFeaturePlain) -> Self { + NodeRef::MediaFeaturePlain(node) + } +} +impl<'ast> From<&'ast MediaFeatureRange> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureRange) -> Self { + NodeRef::MediaFeatureRange(node) + } +} +impl<'ast> From<&'ast MediaFeatureRangeComparison> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureRangeComparison) -> Self { + NodeRef::MediaFeatureRangeComparison(node) + } +} +impl<'ast> From<&'ast MediaFeatureRangeInterval> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureRangeInterval) -> Self { + NodeRef::MediaFeatureRangeInterval(node) + } +} +impl<'ast> From<&'ast MediaFeatureValue> for NodeRef<'ast> { + fn from(node: &'ast MediaFeatureValue) -> Self { + NodeRef::MediaFeatureValue(node) + } +} +impl<'ast> From<&'ast MediaInParens> for NodeRef<'ast> { + fn from(node: &'ast MediaInParens) -> Self { + NodeRef::MediaInParens(node) + } +} +impl<'ast> From<&'ast MediaNot> for NodeRef<'ast> { + fn from(node: &'ast MediaNot) -> Self { + NodeRef::MediaNot(node) + } +} +impl<'ast> From<&'ast MediaOr> for NodeRef<'ast> { + fn from(node: &'ast MediaOr) -> Self { + NodeRef::MediaOr(node) + } +} +impl<'ast> From<&'ast MediaQuery> for NodeRef<'ast> { + fn from(node: &'ast MediaQuery) -> Self { + NodeRef::MediaQuery(node) + } +} +impl<'ast> From<&'ast MediaQueryList> for NodeRef<'ast> { + fn from(node: &'ast MediaQueryList) -> Self { + NodeRef::MediaQueryList(node) + } +} +impl<'ast> From<&'ast MediaType> for NodeRef<'ast> { + fn from(node: &'ast MediaType) -> Self { + NodeRef::MediaType(node) + } +} +impl<'ast> From<&'ast NamedNamespace> for NodeRef<'ast> { + fn from(node: &'ast NamedNamespace) -> Self { + NodeRef::NamedNamespace(node) + } +} +impl<'ast> From<&'ast Namespace> for NodeRef<'ast> { + fn from(node: &'ast Namespace) -> Self { + NodeRef::Namespace(node) + } +} +impl<'ast> From<&'ast NamespacePrefix> for NodeRef<'ast> { + fn from(node: &'ast NamespacePrefix) -> Self { + NodeRef::NamespacePrefix(node) + } +} +impl<'ast> From<&'ast NamespacePrelude> for NodeRef<'ast> { + fn from(node: &'ast NamespacePrelude) -> Self { + NodeRef::NamespacePrelude(node) + } +} +impl<'ast> From<&'ast NamespacePreludeUri> for NodeRef<'ast> { + fn from(node: &'ast NamespacePreludeUri) -> Self { + NodeRef::NamespacePreludeUri(node) + } +} +impl<'ast> From<&'ast NestingSelector> for NodeRef<'ast> { + fn from(node: &'ast NestingSelector) -> Self { + NodeRef::NestingSelector(node) + } +} +impl<'ast> From<&'ast Number> for NodeRef<'ast> { + fn from(node: &'ast Number) -> Self { + NodeRef::Number(node) + } +} +impl<'ast> From<&'ast NumberType> for NodeRef<'ast> { + fn from(node: &'ast NumberType) -> Self { + NodeRef::NumberType(node) + } +} +impl<'ast> From<&'ast PageSelector> for NodeRef<'ast> { + fn from(node: &'ast PageSelector) -> Self { + NodeRef::PageSelector(node) + } +} +impl<'ast> From<&'ast PageSelectorList> for NodeRef<'ast> { + fn from(node: &'ast PageSelectorList) -> Self { + NodeRef::PageSelectorList(node) + } +} +impl<'ast> From<&'ast PageSelectorPseudo> for NodeRef<'ast> { + fn from(node: &'ast PageSelectorPseudo) -> Self { + NodeRef::PageSelectorPseudo(node) + } +} +impl<'ast> From<&'ast PageSelectorType> for NodeRef<'ast> { + fn from(node: &'ast PageSelectorType) -> Self { + NodeRef::PageSelectorType(node) + } +} +impl<'ast> From<&'ast Percentage> for NodeRef<'ast> { + fn from(node: &'ast Percentage) -> Self { + NodeRef::Percentage(node) + } +} +impl<'ast> From<&'ast PseudoClassSelector> for NodeRef<'ast> { + fn from(node: &'ast PseudoClassSelector) -> Self { + NodeRef::PseudoClassSelector(node) + } +} +impl<'ast> From<&'ast PseudoClassSelectorChildren> for NodeRef<'ast> { + fn from(node: &'ast PseudoClassSelectorChildren) -> Self { + NodeRef::PseudoClassSelectorChildren(node) + } +} +impl<'ast> From<&'ast PseudoElementSelector> for NodeRef<'ast> { + fn from(node: &'ast PseudoElementSelector) -> Self { + NodeRef::PseudoElementSelector(node) + } +} +impl<'ast> From<&'ast PseudoElementSelectorChildren> for NodeRef<'ast> { + fn from(node: &'ast PseudoElementSelectorChildren) -> Self { + NodeRef::PseudoElementSelectorChildren(node) + } +} +impl<'ast> From<&'ast QualifiedRule> for NodeRef<'ast> { + fn from(node: &'ast QualifiedRule) -> Self { + NodeRef::QualifiedRule(node) + } +} +impl<'ast> From<&'ast QualifiedRulePrelude> for NodeRef<'ast> { + fn from(node: &'ast QualifiedRulePrelude) -> Self { + NodeRef::QualifiedRulePrelude(node) + } +} +impl<'ast> From<&'ast QueryInParens> for NodeRef<'ast> { + fn from(node: &'ast QueryInParens) -> Self { + NodeRef::QueryInParens(node) + } +} +impl<'ast> From<&'ast Ratio> for NodeRef<'ast> { + fn from(node: &'ast Ratio) -> Self { + NodeRef::Ratio(node) + } +} +impl<'ast> From<&'ast RelativeSelector> for NodeRef<'ast> { + fn from(node: &'ast RelativeSelector) -> Self { + NodeRef::RelativeSelector(node) + } +} +impl<'ast> From<&'ast RelativeSelectorList> for NodeRef<'ast> { + fn from(node: &'ast RelativeSelectorList) -> Self { + NodeRef::RelativeSelectorList(node) + } +} +impl<'ast> From<&'ast Resolution> for NodeRef<'ast> { + fn from(node: &'ast Resolution) -> Self { + NodeRef::Resolution(node) + } +} +impl<'ast> From<&'ast Rule> for NodeRef<'ast> { + fn from(node: &'ast Rule) -> Self { + NodeRef::Rule(node) + } +} +impl<'ast> From<&'ast ScopeRange> for NodeRef<'ast> { + fn from(node: &'ast ScopeRange) -> Self { + NodeRef::ScopeRange(node) + } +} +impl<'ast> From<&'ast SelectorList> for NodeRef<'ast> { + fn from(node: &'ast SelectorList) -> Self { + NodeRef::SelectorList(node) + } +} +impl<'ast> From<&'ast SequenceOfCustomIdents> for NodeRef<'ast> { + fn from(node: &'ast SequenceOfCustomIdents) -> Self { + NodeRef::SequenceOfCustomIdents(node) + } +} +impl<'ast> From<&'ast SimpleBlock> for NodeRef<'ast> { + fn from(node: &'ast SimpleBlock) -> Self { + NodeRef::SimpleBlock(node) + } +} +impl<'ast> From<&'ast SizeFeature> for NodeRef<'ast> { + fn from(node: &'ast SizeFeature) -> Self { + NodeRef::SizeFeature(node) + } +} +impl<'ast> From<&'ast SizeFeatureBoolean> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureBoolean) -> Self { + NodeRef::SizeFeatureBoolean(node) + } +} +impl<'ast> From<&'ast SizeFeatureName> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureName) -> Self { + NodeRef::SizeFeatureName(node) + } +} +impl<'ast> From<&'ast SizeFeaturePlain> for NodeRef<'ast> { + fn from(node: &'ast SizeFeaturePlain) -> Self { + NodeRef::SizeFeaturePlain(node) + } +} +impl<'ast> From<&'ast SizeFeatureRange> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureRange) -> Self { + NodeRef::SizeFeatureRange(node) + } +} +impl<'ast> From<&'ast SizeFeatureRangeComparison> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureRangeComparison) -> Self { + NodeRef::SizeFeatureRangeComparison(node) + } +} +impl<'ast> From<&'ast SizeFeatureRangeInterval> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureRangeInterval) -> Self { + NodeRef::SizeFeatureRangeInterval(node) + } +} +impl<'ast> From<&'ast SizeFeatureValue> for NodeRef<'ast> { + fn from(node: &'ast SizeFeatureValue) -> Self { + NodeRef::SizeFeatureValue(node) + } +} +impl<'ast> From<&'ast Str> for NodeRef<'ast> { + fn from(node: &'ast Str) -> Self { + NodeRef::Str(node) + } +} +impl<'ast> From<&'ast StyleBlock> for NodeRef<'ast> { + fn from(node: &'ast StyleBlock) -> Self { + NodeRef::StyleBlock(node) + } +} +impl<'ast> From<&'ast Stylesheet> for NodeRef<'ast> { + fn from(node: &'ast Stylesheet) -> Self { + NodeRef::Stylesheet(node) + } +} +impl<'ast> From<&'ast SubclassSelector> for NodeRef<'ast> { + fn from(node: &'ast SubclassSelector) -> Self { + NodeRef::SubclassSelector(node) + } +} +impl<'ast> From<&'ast SupportsAnd> for NodeRef<'ast> { + fn from(node: &'ast SupportsAnd) -> Self { + NodeRef::SupportsAnd(node) + } +} +impl<'ast> From<&'ast SupportsCondition> for NodeRef<'ast> { + fn from(node: &'ast SupportsCondition) -> Self { + NodeRef::SupportsCondition(node) + } +} +impl<'ast> From<&'ast SupportsConditionType> for NodeRef<'ast> { + fn from(node: &'ast SupportsConditionType) -> Self { + NodeRef::SupportsConditionType(node) + } +} +impl<'ast> From<&'ast SupportsFeature> for NodeRef<'ast> { + fn from(node: &'ast SupportsFeature) -> Self { + NodeRef::SupportsFeature(node) + } +} +impl<'ast> From<&'ast SupportsInParens> for NodeRef<'ast> { + fn from(node: &'ast SupportsInParens) -> Self { + NodeRef::SupportsInParens(node) + } +} +impl<'ast> From<&'ast SupportsNot> for NodeRef<'ast> { + fn from(node: &'ast SupportsNot) -> Self { + NodeRef::SupportsNot(node) + } +} +impl<'ast> From<&'ast SupportsOr> for NodeRef<'ast> { + fn from(node: &'ast SupportsOr) -> Self { + NodeRef::SupportsOr(node) + } +} +impl<'ast> From<&'ast TagNameSelector> for NodeRef<'ast> { + fn from(node: &'ast TagNameSelector) -> Self { + NodeRef::TagNameSelector(node) + } +} +impl<'ast> From<&'ast Time> for NodeRef<'ast> { + fn from(node: &'ast Time) -> Self { + NodeRef::Time(node) + } +} +impl<'ast> From<&'ast TimePercentage> for NodeRef<'ast> { + fn from(node: &'ast TimePercentage) -> Self { + NodeRef::TimePercentage(node) + } +} +impl<'ast> From<&'ast Token> for NodeRef<'ast> { + fn from(node: &'ast Token) -> Self { + NodeRef::Token(node) + } +} +impl<'ast> From<&'ast TokenAndSpan> for NodeRef<'ast> { + fn from(node: &'ast TokenAndSpan) -> Self { + NodeRef::TokenAndSpan(node) + } +} +impl<'ast> From<&'ast TypeSelector> for NodeRef<'ast> { + fn from(node: &'ast TypeSelector) -> Self { + NodeRef::TypeSelector(node) + } +} +impl<'ast> From<&'ast UnicodeRange> for NodeRef<'ast> { + fn from(node: &'ast UnicodeRange) -> Self { + NodeRef::UnicodeRange(node) + } +} +impl<'ast> From<&'ast UniversalSelector> for NodeRef<'ast> { + fn from(node: &'ast UniversalSelector) -> Self { + NodeRef::UniversalSelector(node) + } +} +impl<'ast> From<&'ast UnknownDimension> for NodeRef<'ast> { + fn from(node: &'ast UnknownDimension) -> Self { + NodeRef::UnknownDimension(node) + } +} +impl<'ast> From<&'ast Url> for NodeRef<'ast> { + fn from(node: &'ast Url) -> Self { + NodeRef::Url(node) + } +} +impl<'ast> From<&'ast UrlKeyValue> for NodeRef<'ast> { + fn from(node: &'ast UrlKeyValue) -> Self { + NodeRef::UrlKeyValue(node) + } +} +impl<'ast> From<&'ast UrlModifier> for NodeRef<'ast> { + fn from(node: &'ast UrlModifier) -> Self { + NodeRef::UrlModifier(node) + } +} +impl<'ast> From<&'ast UrlValue> for NodeRef<'ast> { + fn from(node: &'ast UrlValue) -> Self { + NodeRef::UrlValue(node) + } +} +impl<'ast> From<&'ast UrlValueRaw> for NodeRef<'ast> { + fn from(node: &'ast UrlValueRaw) -> Self { + NodeRef::UrlValueRaw(node) + } +} +impl<'ast> From<&'ast WqName> for NodeRef<'ast> { + fn from(node: &'ast WqName) -> Self { + NodeRef::WqName(node) + } +} +#[derive(Debug, Clone, Copy)] +pub enum NodeRef<'ast> { + AbsoluteColorBase(&'ast AbsoluteColorBase), + AlphaValue(&'ast AlphaValue), + AnPlusB(&'ast AnPlusB), + AnPlusBNotation(&'ast AnPlusBNotation), + Angle(&'ast Angle), + AnglePercentage(&'ast AnglePercentage), + AnyNamespace(&'ast AnyNamespace), + AtRule(&'ast AtRule), + AtRuleName(&'ast AtRuleName), + AtRulePrelude(&'ast AtRulePrelude), + AttributeSelector(&'ast AttributeSelector), + AttributeSelectorMatcher(&'ast AttributeSelectorMatcher), + AttributeSelectorMatcherValue(&'ast AttributeSelectorMatcherValue), + AttributeSelectorModifier(&'ast AttributeSelectorModifier), + AttributeSelectorValue(&'ast AttributeSelectorValue), + BinOp(&'ast BinOp), + CalcOperator(&'ast CalcOperator), + CalcOperatorType(&'ast CalcOperatorType), + CalcProduct(&'ast CalcProduct), + CalcProductOrOperator(&'ast CalcProductOrOperator), + CalcSum(&'ast CalcSum), + CalcValue(&'ast CalcValue), + CalcValueOrOperator(&'ast CalcValueOrOperator), + ClassSelector(&'ast ClassSelector), + CmykComponent(&'ast CmykComponent), + Color(&'ast Color), + ColorProfileName(&'ast ColorProfileName), + Combinator(&'ast Combinator), + CombinatorValue(&'ast CombinatorValue), + ComplexSelector(&'ast ComplexSelector), + ComplexSelectorChildren(&'ast ComplexSelectorChildren), + ComponentValue(&'ast ComponentValue), + CompoundSelector(&'ast CompoundSelector), + CompoundSelectorList(&'ast CompoundSelectorList), + ContainerCondition(&'ast ContainerCondition), + ContainerName(&'ast ContainerName), + ContainerQuery(&'ast ContainerQuery), + ContainerQueryAnd(&'ast ContainerQueryAnd), + ContainerQueryNot(&'ast ContainerQueryNot), + ContainerQueryOr(&'ast ContainerQueryOr), + ContainerQueryType(&'ast ContainerQueryType), + CustomHighlightName(&'ast CustomHighlightName), + CustomIdent(&'ast CustomIdent), + CustomMediaQuery(&'ast CustomMediaQuery), + CustomMediaQueryMediaType(&'ast CustomMediaQueryMediaType), + CustomPropertyName(&'ast CustomPropertyName), + DashedIdent(&'ast DashedIdent), + Declaration(&'ast Declaration), + DeclarationName(&'ast DeclarationName), + DeclarationOrAtRule(&'ast DeclarationOrAtRule), + Delimiter(&'ast Delimiter), + DelimiterValue(&'ast DelimiterValue), + Dimension(&'ast Dimension), + DimensionToken(&'ast DimensionToken), + DocumentPrelude(&'ast DocumentPrelude), + DocumentPreludeMatchingFunction(&'ast DocumentPreludeMatchingFunction), + ExtensionName(&'ast ExtensionName), + FamilyName(&'ast FamilyName), + Flex(&'ast Flex), + FontFeatureValuesPrelude(&'ast FontFeatureValuesPrelude), + ForgivingComplexSelector(&'ast ForgivingComplexSelector), + ForgivingRelativeSelector(&'ast ForgivingRelativeSelector), + ForgivingRelativeSelectorList(&'ast ForgivingRelativeSelectorList), + ForgivingSelectorList(&'ast ForgivingSelectorList), + Frequency(&'ast Frequency), + FrequencyPercentage(&'ast FrequencyPercentage), + Function(&'ast Function), + FunctionName(&'ast FunctionName), + GeneralEnclosed(&'ast GeneralEnclosed), + HexColor(&'ast HexColor), + Hue(&'ast Hue), + IdSelector(&'ast IdSelector), + Ident(&'ast Ident), + ImportConditions(&'ast ImportConditions), + ImportHref(&'ast ImportHref), + ImportLayerName(&'ast ImportLayerName), + ImportPrelude(&'ast ImportPrelude), + ImportantFlag(&'ast ImportantFlag), + Integer(&'ast Integer), + KeyframeBlock(&'ast KeyframeBlock), + KeyframeSelector(&'ast KeyframeSelector), + KeyframesName(&'ast KeyframesName), + KeyframesPseudoFunction(&'ast KeyframesPseudoFunction), + KeyframesPseudoPrefix(&'ast KeyframesPseudoPrefix), + LayerName(&'ast LayerName), + LayerNameList(&'ast LayerNameList), + LayerPrelude(&'ast LayerPrelude), + Length(&'ast Length), + LengthPercentage(&'ast LengthPercentage), + ListOfComponentValues(&'ast ListOfComponentValues), + MediaAnd(&'ast MediaAnd), + MediaCondition(&'ast MediaCondition), + MediaConditionAllType(&'ast MediaConditionAllType), + MediaConditionType(&'ast MediaConditionType), + MediaConditionWithoutOr(&'ast MediaConditionWithoutOr), + MediaConditionWithoutOrType(&'ast MediaConditionWithoutOrType), + MediaFeature(&'ast MediaFeature), + MediaFeatureBoolean(&'ast MediaFeatureBoolean), + MediaFeatureName(&'ast MediaFeatureName), + MediaFeaturePlain(&'ast MediaFeaturePlain), + MediaFeatureRange(&'ast MediaFeatureRange), + MediaFeatureRangeComparison(&'ast MediaFeatureRangeComparison), + MediaFeatureRangeInterval(&'ast MediaFeatureRangeInterval), + MediaFeatureValue(&'ast MediaFeatureValue), + MediaInParens(&'ast MediaInParens), + MediaNot(&'ast MediaNot), + MediaOr(&'ast MediaOr), + MediaQuery(&'ast MediaQuery), + MediaQueryList(&'ast MediaQueryList), + MediaType(&'ast MediaType), + NamedNamespace(&'ast NamedNamespace), + Namespace(&'ast Namespace), + NamespacePrefix(&'ast NamespacePrefix), + NamespacePrelude(&'ast NamespacePrelude), + NamespacePreludeUri(&'ast NamespacePreludeUri), + NestingSelector(&'ast NestingSelector), + Number(&'ast Number), + NumberType(&'ast NumberType), + PageSelector(&'ast PageSelector), + PageSelectorList(&'ast PageSelectorList), + PageSelectorPseudo(&'ast PageSelectorPseudo), + PageSelectorType(&'ast PageSelectorType), + Percentage(&'ast Percentage), + PseudoClassSelector(&'ast PseudoClassSelector), + PseudoClassSelectorChildren(&'ast PseudoClassSelectorChildren), + PseudoElementSelector(&'ast PseudoElementSelector), + PseudoElementSelectorChildren(&'ast PseudoElementSelectorChildren), + QualifiedRule(&'ast QualifiedRule), + QualifiedRulePrelude(&'ast QualifiedRulePrelude), + QueryInParens(&'ast QueryInParens), + Ratio(&'ast Ratio), + RelativeSelector(&'ast RelativeSelector), + RelativeSelectorList(&'ast RelativeSelectorList), + Resolution(&'ast Resolution), + Rule(&'ast Rule), + ScopeRange(&'ast ScopeRange), + SelectorList(&'ast SelectorList), + SequenceOfCustomIdents(&'ast SequenceOfCustomIdents), + SimpleBlock(&'ast SimpleBlock), + SizeFeature(&'ast SizeFeature), + SizeFeatureBoolean(&'ast SizeFeatureBoolean), + SizeFeatureName(&'ast SizeFeatureName), + SizeFeaturePlain(&'ast SizeFeaturePlain), + SizeFeatureRange(&'ast SizeFeatureRange), + SizeFeatureRangeComparison(&'ast SizeFeatureRangeComparison), + SizeFeatureRangeInterval(&'ast SizeFeatureRangeInterval), + SizeFeatureValue(&'ast SizeFeatureValue), + Str(&'ast Str), + StyleBlock(&'ast StyleBlock), + Stylesheet(&'ast Stylesheet), + SubclassSelector(&'ast SubclassSelector), + SupportsAnd(&'ast SupportsAnd), + SupportsCondition(&'ast SupportsCondition), + SupportsConditionType(&'ast SupportsConditionType), + SupportsFeature(&'ast SupportsFeature), + SupportsInParens(&'ast SupportsInParens), + SupportsNot(&'ast SupportsNot), + SupportsOr(&'ast SupportsOr), + TagNameSelector(&'ast TagNameSelector), + Time(&'ast Time), + TimePercentage(&'ast TimePercentage), + Token(&'ast Token), + TokenAndSpan(&'ast TokenAndSpan), + TypeSelector(&'ast TypeSelector), + UnicodeRange(&'ast UnicodeRange), + UniversalSelector(&'ast UniversalSelector), + UnknownDimension(&'ast UnknownDimension), + Url(&'ast Url), + UrlKeyValue(&'ast UrlKeyValue), + UrlModifier(&'ast UrlModifier), + UrlValue(&'ast UrlValue), + UrlValueRaw(&'ast UrlValueRaw), + WqName(&'ast WqName), +} +impl<'ast> NodeRef<'ast> { + #[allow(unreachable_patterns)] + pub fn raw_children(&'ast self) -> Box>> { + match self { + NodeRef::AbsoluteColorBase(node) => match node { + AbsoluteColorBase::HexColor(v0) => { + Box::new(::std::iter::once(NodeRef::HexColor(v0))) + } + AbsoluteColorBase::NamedColorOrTransparent(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + AbsoluteColorBase::Function(v0) => { + Box::new(::std::iter::once(NodeRef::Function(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AlphaValue(node) => match node { + AlphaValue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + AlphaValue::Percentage(v0) => Box::new(::std::iter::once(NodeRef::Percentage(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AnPlusB(node) => match node { + AnPlusB::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + AnPlusB::AnPlusBNotation(v0) => { + Box::new(::std::iter::once(NodeRef::AnPlusBNotation(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AnPlusBNotation(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Angle(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::AnglePercentage(node) => match node { + AnglePercentage::Angle(v0) => Box::new(::std::iter::once(NodeRef::Angle(v0))), + AnglePercentage::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AnyNamespace(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::AtRule(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::AtRuleName(&node.name))) + .chain(node.prelude.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::AtRulePrelude(&item)) + })) + .chain( + node.block + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::SimpleBlock(&item))), + ); + Box::new(iterator) + } + NodeRef::AtRuleName(node) => match node { + AtRuleName::DashedIdent(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + AtRuleName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AtRulePrelude(node) => match node { + AtRulePrelude::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + AtRulePrelude::CharsetPrelude(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + AtRulePrelude::PropertyPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::CustomPropertyName(v0))) + } + AtRulePrelude::CounterStylePrelude(v0) => { + Box::new(::std::iter::once(NodeRef::CustomIdent(v0))) + } + AtRulePrelude::ColorProfilePrelude(v0) => { + Box::new(::std::iter::once(NodeRef::ColorProfileName(v0))) + } + AtRulePrelude::DocumentPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::DocumentPrelude(v0))) + } + AtRulePrelude::FontPaletteValuesPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + AtRulePrelude::FontFeatureValuesPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::FontFeatureValuesPrelude(v0))) + } + AtRulePrelude::NestPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::SelectorList(v0))) + } + AtRulePrelude::KeyframesPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::KeyframesName(v0))) + } + AtRulePrelude::ImportPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::ImportPrelude(v0))) + } + AtRulePrelude::NamespacePrelude(v0) => { + Box::new(::std::iter::once(NodeRef::NamespacePrelude(v0))) + } + AtRulePrelude::MediaPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::MediaQueryList(v0))) + } + AtRulePrelude::SupportsPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsCondition(v0))) + } + AtRulePrelude::PagePrelude(v0) => { + Box::new(::std::iter::once(NodeRef::PageSelectorList(v0))) + } + AtRulePrelude::LayerPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::LayerPrelude(v0))) + } + AtRulePrelude::ContainerPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::ContainerCondition(v0))) + } + AtRulePrelude::CustomMediaPrelude(v0) => { + Box::new(::std::iter::once(NodeRef::CustomMediaQuery(v0))) + } + AtRulePrelude::ScopePrelude(v0) => { + Box::new(::std::iter::once(NodeRef::ScopeRange(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AttributeSelector(node) => { + let iterator = + ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::WqName(&node.name))) + .chain(node.matcher.iter().flat_map(|item| { + ::std::iter::once(NodeRef::AttributeSelectorMatcher(&item)) + })) + .chain(node.value.iter().flat_map(|item| { + ::std::iter::once(NodeRef::AttributeSelectorValue(&item)) + })) + .chain(node.modifier.iter().flat_map(|item| { + ::std::iter::once(NodeRef::AttributeSelectorModifier(&item)) + })); + Box::new(iterator) + } + NodeRef::AttributeSelectorMatcher(node) => { + let iterator = ::std::iter::empty::>().chain(::std::iter::once( + NodeRef::AttributeSelectorMatcherValue(&node.value), + )); + Box::new(iterator) + } + NodeRef::AttributeSelectorMatcherValue(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AttributeSelectorModifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.value))); + Box::new(iterator) + } + NodeRef::AttributeSelectorValue(node) => match node { + AttributeSelectorValue::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + AttributeSelectorValue::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::BinOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CalcOperator(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::CalcOperatorType(&node.value))); + Box::new(iterator) + } + NodeRef::CalcOperatorType(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CalcProduct(node) => { + let iterator = ::std::iter::empty::>().chain( + node.expressions + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::CalcValueOrOperator(&item))), + ); + Box::new(iterator) + } + NodeRef::CalcProductOrOperator(node) => match node { + CalcProductOrOperator::Product(v0) => { + Box::new(::std::iter::once(NodeRef::CalcProduct(v0))) + } + CalcProductOrOperator::Operator(v0) => { + Box::new(::std::iter::once(NodeRef::CalcOperator(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CalcSum(node) => { + let iterator = ::std::iter::empty::>().chain( + node.expressions + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::CalcProductOrOperator(&item))), + ); + Box::new(iterator) + } + NodeRef::CalcValue(node) => match node { + CalcValue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + CalcValue::Dimension(v0) => Box::new(::std::iter::once(NodeRef::Dimension(v0))), + CalcValue::Percentage(v0) => Box::new(::std::iter::once(NodeRef::Percentage(v0))), + CalcValue::Constant(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + CalcValue::Sum(v0) => Box::new(::std::iter::once(NodeRef::CalcSum(v0))), + CalcValue::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CalcValueOrOperator(node) => match node { + CalcValueOrOperator::Value(v0) => { + Box::new(::std::iter::once(NodeRef::CalcValue(v0))) + } + CalcValueOrOperator::Operator(v0) => { + Box::new(::std::iter::once(NodeRef::CalcOperator(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ClassSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.text))); + Box::new(iterator) + } + NodeRef::CmykComponent(node) => match node { + CmykComponent::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + CmykComponent::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + CmykComponent::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Color(node) => match node { + Color::AbsoluteColorBase(v0) => { + Box::new(::std::iter::once(NodeRef::AbsoluteColorBase(v0))) + } + Color::CurrentColorOrSystemColor(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + Color::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ColorProfileName(node) => match node { + ColorProfileName::DashedIdent(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + ColorProfileName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Combinator(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::CombinatorValue(&node.value))); + Box::new(iterator) + } + NodeRef::CombinatorValue(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ComplexSelector(node) => { + let iterator = + ::std::iter::empty::>().chain(node.children.iter().flat_map( + |item| ::std::iter::once(NodeRef::ComplexSelectorChildren(&item)), + )); + Box::new(iterator) + } + NodeRef::ComplexSelectorChildren(node) => match node { + ComplexSelectorChildren::CompoundSelector(v0) => { + Box::new(::std::iter::once(NodeRef::CompoundSelector(v0))) + } + ComplexSelectorChildren::Combinator(v0) => { + Box::new(::std::iter::once(NodeRef::Combinator(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ComponentValue(node) => match node { + ComponentValue::PreservedToken(v0) => { + Box::new(::std::iter::once(NodeRef::TokenAndSpan(v0))) + } + ComponentValue::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + ComponentValue::SimpleBlock(v0) => { + Box::new(::std::iter::once(NodeRef::SimpleBlock(v0))) + } + ComponentValue::AtRule(v0) => Box::new(::std::iter::once(NodeRef::AtRule(v0))), + ComponentValue::QualifiedRule(v0) => { + Box::new(::std::iter::once(NodeRef::QualifiedRule(v0))) + } + ComponentValue::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + ComponentValue::KeyframeBlock(v0) => { + Box::new(::std::iter::once(NodeRef::KeyframeBlock(v0))) + } + ComponentValue::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + ComponentValue::DashedIdent(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + ComponentValue::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + ComponentValue::Url(v0) => Box::new(::std::iter::once(NodeRef::Url(v0))), + ComponentValue::Integer(v0) => Box::new(::std::iter::once(NodeRef::Integer(v0))), + ComponentValue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + ComponentValue::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + ComponentValue::Dimension(v0) => { + Box::new(::std::iter::once(NodeRef::Dimension(v0))) + } + ComponentValue::LengthPercentage(v0) => { + Box::new(::std::iter::once(NodeRef::LengthPercentage(v0))) + } + ComponentValue::FrequencyPercentage(v0) => { + Box::new(::std::iter::once(NodeRef::FrequencyPercentage(v0))) + } + ComponentValue::AnglePercentage(v0) => { + Box::new(::std::iter::once(NodeRef::AnglePercentage(v0))) + } + ComponentValue::TimePercentage(v0) => { + Box::new(::std::iter::once(NodeRef::TimePercentage(v0))) + } + ComponentValue::Ratio(v0) => Box::new(::std::iter::once(NodeRef::Ratio(v0))), + ComponentValue::UnicodeRange(v0) => { + Box::new(::std::iter::once(NodeRef::UnicodeRange(v0))) + } + ComponentValue::Color(v0) => Box::new(::std::iter::once(NodeRef::Color(v0))), + ComponentValue::AlphaValue(v0) => { + Box::new(::std::iter::once(NodeRef::AlphaValue(v0))) + } + ComponentValue::Hue(v0) => Box::new(::std::iter::once(NodeRef::Hue(v0))), + ComponentValue::CmykComponent(v0) => { + Box::new(::std::iter::once(NodeRef::CmykComponent(v0))) + } + ComponentValue::Delimiter(v0) => { + Box::new(::std::iter::once(NodeRef::Delimiter(v0))) + } + ComponentValue::CalcSum(v0) => Box::new(::std::iter::once(NodeRef::CalcSum(v0))), + ComponentValue::ComplexSelector(v0) => { + Box::new(::std::iter::once(NodeRef::ComplexSelector(v0))) + } + ComponentValue::LayerName(v0) => { + Box::new(::std::iter::once(NodeRef::LayerName(v0))) + } + ComponentValue::SupportsCondition(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsCondition(v0))) + } + ComponentValue::Declaration(v0) => { + Box::new(::std::iter::once(NodeRef::Declaration(v0))) + } + ComponentValue::IdSelector(v0) => { + Box::new(::std::iter::once(NodeRef::IdSelector(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CompoundSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.nesting_selector + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::NestingSelector(&item))), + ) + .chain(node.type_selector.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TypeSelector(&item)) + })) + .chain( + node.subclass_selectors + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::SubclassSelector(&item))), + ); + Box::new(iterator) + } + NodeRef::CompoundSelectorList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::CompoundSelector(&item))), + ); + Box::new(iterator) + } + NodeRef::ContainerCondition(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.name + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ContainerName(&item))), + ) + .chain(::std::iter::once(NodeRef::ContainerQuery(&node.query))); + Box::new(iterator) + } + NodeRef::ContainerName(node) => match node { + ContainerName::CustomIdent(v0) => { + Box::new(::std::iter::once(NodeRef::CustomIdent(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ContainerQuery(node) => { + let iterator = ::std::iter::empty::>().chain( + node.queries + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ContainerQueryType(&item))), + ); + Box::new(iterator) + } + NodeRef::ContainerQueryAnd(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::QueryInParens(&node.query))); + Box::new(iterator) + } + NodeRef::ContainerQueryNot(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::QueryInParens(&node.query))); + Box::new(iterator) + } + NodeRef::ContainerQueryOr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::QueryInParens(&node.query))); + Box::new(iterator) + } + NodeRef::ContainerQueryType(node) => match node { + ContainerQueryType::Not(v0) => { + Box::new(::std::iter::once(NodeRef::ContainerQueryNot(v0))) + } + ContainerQueryType::And(v0) => { + Box::new(::std::iter::once(NodeRef::ContainerQueryAnd(v0))) + } + ContainerQueryType::Or(v0) => { + Box::new(::std::iter::once(NodeRef::ContainerQueryOr(v0))) + } + ContainerQueryType::QueryInParens(v0) => { + Box::new(::std::iter::once(NodeRef::QueryInParens(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CustomHighlightName(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::CustomIdent(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::CustomMediaQuery(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ExtensionName(&node.name))) + .chain(::std::iter::once(NodeRef::CustomMediaQueryMediaType( + &node.media, + ))); + Box::new(iterator) + } + NodeRef::CustomMediaQueryMediaType(node) => match node { + CustomMediaQueryMediaType::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + CustomMediaQueryMediaType::MediaQueryList(v0) => { + Box::new(::std::iter::once(NodeRef::MediaQueryList(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CustomPropertyName(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::DashedIdent(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Declaration(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::DeclarationName(&node.name))) + .chain( + node.value + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ComponentValue(&item))), + ) + .chain( + node.important + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ImportantFlag(&item))), + ); + Box::new(iterator) + } + NodeRef::DeclarationName(node) => match node { + DeclarationName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + DeclarationName::DashedIdent(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::DeclarationOrAtRule(node) => match node { + DeclarationOrAtRule::Declaration(v0) => { + Box::new(::std::iter::once(NodeRef::Declaration(v0))) + } + DeclarationOrAtRule::AtRule(v0) => Box::new(::std::iter::once(NodeRef::AtRule(v0))), + DeclarationOrAtRule::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Delimiter(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::DelimiterValue(&node.value))); + Box::new(iterator) + } + NodeRef::DelimiterValue(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Dimension(node) => match node { + Dimension::Length(v0) => Box::new(::std::iter::once(NodeRef::Length(v0))), + Dimension::Angle(v0) => Box::new(::std::iter::once(NodeRef::Angle(v0))), + Dimension::Time(v0) => Box::new(::std::iter::once(NodeRef::Time(v0))), + Dimension::Frequency(v0) => Box::new(::std::iter::once(NodeRef::Frequency(v0))), + Dimension::Resolution(v0) => Box::new(::std::iter::once(NodeRef::Resolution(v0))), + Dimension::Flex(v0) => Box::new(::std::iter::once(NodeRef::Flex(v0))), + Dimension::UnknownDimension(v0) => { + Box::new(::std::iter::once(NodeRef::UnknownDimension(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::DimensionToken(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::NumberType(&node.type_flag))); + Box::new(iterator) + } + NodeRef::DocumentPrelude(node) => { + let iterator = ::std::iter::empty::>().chain( + node.matching_functions.iter().flat_map(|item| { + ::std::iter::once(NodeRef::DocumentPreludeMatchingFunction(&item)) + }), + ); + Box::new(iterator) + } + NodeRef::DocumentPreludeMatchingFunction(node) => match node { + DocumentPreludeMatchingFunction::Url(v0) => { + Box::new(::std::iter::once(NodeRef::Url(v0))) + } + DocumentPreludeMatchingFunction::Function(v0) => { + Box::new(::std::iter::once(NodeRef::Function(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ExtensionName(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::FamilyName(node) => match node { + FamilyName::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + FamilyName::SequenceOfCustomIdents(v0) => { + Box::new(::std::iter::once(NodeRef::SequenceOfCustomIdents(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Flex(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::FontFeatureValuesPrelude(node) => { + let iterator = ::std::iter::empty::>().chain( + node.font_family + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::FamilyName(&item))), + ); + Box::new(iterator) + } + NodeRef::ForgivingComplexSelector(node) => match node { + ForgivingComplexSelector::ComplexSelector(v0) => { + Box::new(::std::iter::once(NodeRef::ComplexSelector(v0))) + } + ForgivingComplexSelector::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ForgivingRelativeSelector(node) => match node { + ForgivingRelativeSelector::RelativeSelector(v0) => { + Box::new(::std::iter::once(NodeRef::RelativeSelector(v0))) + } + ForgivingRelativeSelector::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ForgivingRelativeSelectorList(node) => { + let iterator = + ::std::iter::empty::>().chain(node.children.iter().flat_map( + |item| ::std::iter::once(NodeRef::ForgivingRelativeSelector(&item)), + )); + Box::new(iterator) + } + NodeRef::ForgivingSelectorList(node) => { + let iterator = + ::std::iter::empty::>().chain(node.children.iter().flat_map( + |item| ::std::iter::once(NodeRef::ForgivingComplexSelector(&item)), + )); + Box::new(iterator) + } + NodeRef::Frequency(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::FrequencyPercentage(node) => match node { + FrequencyPercentage::Frequency(v0) => { + Box::new(::std::iter::once(NodeRef::Frequency(v0))) + } + FrequencyPercentage::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Function(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::FunctionName(&node.name))) + .chain( + node.value + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ComponentValue(&item))), + ); + Box::new(iterator) + } + NodeRef::FunctionName(node) => match node { + FunctionName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + FunctionName::DashedIdent(v0) => { + Box::new(::std::iter::once(NodeRef::DashedIdent(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::GeneralEnclosed(node) => match node { + GeneralEnclosed::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + GeneralEnclosed::SimpleBlock(v0) => { + Box::new(::std::iter::once(NodeRef::SimpleBlock(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::HexColor(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Hue(node) => match node { + Hue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + Hue::Angle(v0) => Box::new(::std::iter::once(NodeRef::Angle(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::IdSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.text))); + Box::new(iterator) + } + NodeRef::Ident(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::ImportConditions(node) => { + let iterator = ::std::iter::empty::>() + .chain(node.supports.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Function(&item)) + })) + .chain(node.media.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::MediaQueryList(&item)) + })); + Box::new(iterator) + } + NodeRef::ImportHref(node) => match node { + ImportHref::Url(v0) => Box::new(::std::iter::once(NodeRef::Url(v0))), + ImportHref::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ImportLayerName(node) => match node { + ImportLayerName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + ImportLayerName::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ImportPrelude(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.href; + ::std::iter::once(NodeRef::ImportHref(&item)) + }) + .chain(node.layer_name.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::ImportLayerName(&item)) + })) + .chain(node.import_conditions.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::ImportConditions(&item)) + })); + Box::new(iterator) + } + NodeRef::ImportantFlag(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.value))); + Box::new(iterator) + } + NodeRef::Integer(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::KeyframeBlock(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.prelude + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::KeyframeSelector(&item))), + ) + .chain(::std::iter::once(NodeRef::SimpleBlock(&node.block))); + Box::new(iterator) + } + NodeRef::KeyframeSelector(node) => match node { + KeyframeSelector::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + KeyframeSelector::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::KeyframesName(node) => match node { + KeyframesName::CustomIdent(v0) => { + Box::new(::std::iter::once(NodeRef::CustomIdent(v0))) + } + KeyframesName::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + KeyframesName::PseudoPrefix(v0) => { + Box::new(::std::iter::once(NodeRef::KeyframesPseudoPrefix(v0))) + } + KeyframesName::PseudoFunction(v0) => { + Box::new(::std::iter::once(NodeRef::KeyframesPseudoFunction(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::KeyframesPseudoFunction(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.pseudo))) + .chain(::std::iter::once(NodeRef::KeyframesName(&node.name))); + Box::new(iterator) + } + NodeRef::KeyframesPseudoPrefix(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.pseudo))) + .chain(::std::iter::once(NodeRef::KeyframesName(&node.name))); + Box::new(iterator) + } + NodeRef::LayerName(node) => { + let iterator = ::std::iter::empty::>().chain( + node.name + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ); + Box::new(iterator) + } + NodeRef::LayerNameList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.name_list + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::LayerName(&item))), + ); + Box::new(iterator) + } + NodeRef::LayerPrelude(node) => match node { + LayerPrelude::Name(v0) => Box::new(::std::iter::once(NodeRef::LayerName(v0))), + LayerPrelude::NameList(v0) => { + Box::new(::std::iter::once(NodeRef::LayerNameList(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Length(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::LengthPercentage(node) => match node { + LengthPercentage::Length(v0) => Box::new(::std::iter::once(NodeRef::Length(v0))), + LengthPercentage::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ListOfComponentValues(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ComponentValue(&item))), + ); + Box::new(iterator) + } + NodeRef::MediaAnd(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::MediaInParens(&node.condition))); + Box::new(iterator) + } + NodeRef::MediaCondition(node) => { + let iterator = ::std::iter::empty::>().chain( + node.conditions + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::MediaConditionAllType(&item))), + ); + Box::new(iterator) + } + NodeRef::MediaConditionAllType(node) => match node { + MediaConditionAllType::Not(v0) => { + Box::new(::std::iter::once(NodeRef::MediaNot(v0))) + } + MediaConditionAllType::And(v0) => { + Box::new(::std::iter::once(NodeRef::MediaAnd(v0))) + } + MediaConditionAllType::Or(v0) => Box::new(::std::iter::once(NodeRef::MediaOr(v0))), + MediaConditionAllType::MediaInParens(v0) => { + Box::new(::std::iter::once(NodeRef::MediaInParens(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaConditionType(node) => match node { + MediaConditionType::All(v0) => { + Box::new(::std::iter::once(NodeRef::MediaCondition(v0))) + } + MediaConditionType::WithoutOr(v0) => { + Box::new(::std::iter::once(NodeRef::MediaConditionWithoutOr(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaConditionWithoutOr(node) => { + let iterator = + ::std::iter::empty::>().chain(node.conditions.iter().flat_map( + |item| ::std::iter::once(NodeRef::MediaConditionWithoutOrType(&item)), + )); + Box::new(iterator) + } + NodeRef::MediaConditionWithoutOrType(node) => match node { + MediaConditionWithoutOrType::Not(v0) => { + Box::new(::std::iter::once(NodeRef::MediaNot(v0))) + } + MediaConditionWithoutOrType::And(v0) => { + Box::new(::std::iter::once(NodeRef::MediaAnd(v0))) + } + MediaConditionWithoutOrType::MediaInParens(v0) => { + Box::new(::std::iter::once(NodeRef::MediaInParens(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaFeature(node) => match node { + MediaFeature::Plain(v0) => { + Box::new(::std::iter::once(NodeRef::MediaFeaturePlain(v0))) + } + MediaFeature::Boolean(v0) => { + Box::new(::std::iter::once(NodeRef::MediaFeatureBoolean(v0))) + } + MediaFeature::Range(v0) => { + Box::new(::std::iter::once(NodeRef::MediaFeatureRange(v0))) + } + MediaFeature::RangeInterval(v0) => { + Box::new(::std::iter::once(NodeRef::MediaFeatureRangeInterval(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaFeatureBoolean(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::MediaFeatureName(&node.name))); + Box::new(iterator) + } + NodeRef::MediaFeatureName(node) => match node { + MediaFeatureName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + MediaFeatureName::ExtensionName(v0) => { + Box::new(::std::iter::once(NodeRef::ExtensionName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaFeaturePlain(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::MediaFeatureName(&node.name))) + .chain({ + let item = &*node.value; + ::std::iter::once(NodeRef::MediaFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::MediaFeatureRange(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::MediaFeatureValue(&item)) + }) + .chain(::std::iter::once(NodeRef::MediaFeatureRangeComparison( + &node.comparison, + ))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::MediaFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::MediaFeatureRangeComparison(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaFeatureRangeInterval(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::MediaFeatureValue(&item)) + }) + .chain(::std::iter::once(NodeRef::MediaFeatureRangeComparison( + &node.left_comparison, + ))) + .chain(::std::iter::once(NodeRef::MediaFeatureName(&node.name))) + .chain(::std::iter::once(NodeRef::MediaFeatureRangeComparison( + &node.right_comparison, + ))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::MediaFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::MediaFeatureValue(node) => match node { + MediaFeatureValue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + MediaFeatureValue::Dimension(v0) => { + Box::new(::std::iter::once(NodeRef::Dimension(v0))) + } + MediaFeatureValue::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + MediaFeatureValue::Ratio(v0) => Box::new(::std::iter::once(NodeRef::Ratio(v0))), + MediaFeatureValue::Function(v0) => { + Box::new(::std::iter::once(NodeRef::Function(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaInParens(node) => match node { + MediaInParens::MediaCondition(v0) => { + Box::new(::std::iter::once(NodeRef::MediaCondition(v0))) + } + MediaInParens::Feature(v0) => { + Box::new(::std::iter::once(NodeRef::MediaFeature(v0))) + } + MediaInParens::GeneralEnclosed(v0) => { + Box::new(::std::iter::once(NodeRef::GeneralEnclosed(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MediaNot(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::MediaInParens(&node.condition))); + Box::new(iterator) + } + NodeRef::MediaOr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(::std::iter::once(NodeRef::MediaInParens(&node.condition))); + Box::new(iterator) + } + NodeRef::MediaQuery(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.modifier + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain( + node.media_type + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::MediaType(&item))), + ) + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain(node.condition.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::MediaConditionType(&item)) + })); + Box::new(iterator) + } + NodeRef::MediaQueryList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.queries + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::MediaQuery(&item))), + ); + Box::new(iterator) + } + NodeRef::MediaType(node) => match node { + MediaType::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::NamedNamespace(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.name))); + Box::new(iterator) + } + NodeRef::Namespace(node) => match node { + Namespace::Named(v0) => Box::new(::std::iter::once(NodeRef::NamedNamespace(v0))), + Namespace::Any(v0) => Box::new(::std::iter::once(NodeRef::AnyNamespace(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::NamespacePrefix(node) => { + let iterator = ::std::iter::empty::>().chain( + node.namespace + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Namespace(&item))), + ); + Box::new(iterator) + } + NodeRef::NamespacePrelude(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.prefix + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.uri; + ::std::iter::once(NodeRef::NamespacePreludeUri(&item)) + }); + Box::new(iterator) + } + NodeRef::NamespacePreludeUri(node) => match node { + NamespacePreludeUri::Url(v0) => Box::new(::std::iter::once(NodeRef::Url(v0))), + NamespacePreludeUri::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::NestingSelector(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Number(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::NumberType(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::PageSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.page_type + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::PageSelectorType(&item))), + ) + .chain(node.pseudos.iter().flat_map(|item| { + item.iter() + .flat_map(|item| ::std::iter::once(NodeRef::PageSelectorPseudo(&item))) + })); + Box::new(iterator) + } + NodeRef::PageSelectorList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.selectors + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::PageSelector(&item))), + ); + Box::new(iterator) + } + NodeRef::PageSelectorPseudo(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.value))); + Box::new(iterator) + } + NodeRef::PageSelectorType(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.value))); + Box::new(iterator) + } + NodeRef::Percentage(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))); + Box::new(iterator) + } + NodeRef::PseudoClassSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.name))) + .chain(node.children.iter().flat_map(|item| { + item.iter().flat_map(|item| { + ::std::iter::once(NodeRef::PseudoClassSelectorChildren(&item)) + }) + })); + Box::new(iterator) + } + NodeRef::PseudoClassSelectorChildren(node) => match node { + PseudoClassSelectorChildren::PreservedToken(v0) => { + Box::new(::std::iter::once(NodeRef::TokenAndSpan(v0))) + } + PseudoClassSelectorChildren::AnPlusB(v0) => { + Box::new(::std::iter::once(NodeRef::AnPlusB(v0))) + } + PseudoClassSelectorChildren::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + PseudoClassSelectorChildren::Str(v0) => { + Box::new(::std::iter::once(NodeRef::Str(v0))) + } + PseudoClassSelectorChildren::Delimiter(v0) => { + Box::new(::std::iter::once(NodeRef::Delimiter(v0))) + } + PseudoClassSelectorChildren::ComplexSelector(v0) => { + Box::new(::std::iter::once(NodeRef::ComplexSelector(v0))) + } + PseudoClassSelectorChildren::SelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::SelectorList(v0))) + } + PseudoClassSelectorChildren::ForgivingSelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::ForgivingSelectorList(v0))) + } + PseudoClassSelectorChildren::CompoundSelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::CompoundSelectorList(v0))) + } + PseudoClassSelectorChildren::RelativeSelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::RelativeSelectorList(v0))) + } + PseudoClassSelectorChildren::ForgivingRelativeSelectorList(v0) => Box::new( + ::std::iter::once(NodeRef::ForgivingRelativeSelectorList(v0)), + ), + PseudoClassSelectorChildren::CompoundSelector(v0) => { + Box::new(::std::iter::once(NodeRef::CompoundSelector(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::PseudoElementSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.name))) + .chain(node.children.iter().flat_map(|item| { + item.iter().flat_map(|item| { + ::std::iter::once(NodeRef::PseudoElementSelectorChildren(&item)) + }) + })); + Box::new(iterator) + } + NodeRef::PseudoElementSelectorChildren(node) => match node { + PseudoElementSelectorChildren::PreservedToken(v0) => { + Box::new(::std::iter::once(NodeRef::TokenAndSpan(v0))) + } + PseudoElementSelectorChildren::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::Ident(v0))) + } + PseudoElementSelectorChildren::CompoundSelector(v0) => { + Box::new(::std::iter::once(NodeRef::CompoundSelector(v0))) + } + PseudoElementSelectorChildren::CustomHighlightName(v0) => { + Box::new(::std::iter::once(NodeRef::CustomHighlightName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::QualifiedRule(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::QualifiedRulePrelude( + &node.prelude, + ))) + .chain(::std::iter::once(NodeRef::SimpleBlock(&node.block))); + Box::new(iterator) + } + NodeRef::QualifiedRulePrelude(node) => match node { + QualifiedRulePrelude::SelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::SelectorList(v0))) + } + QualifiedRulePrelude::RelativeSelectorList(v0) => { + Box::new(::std::iter::once(NodeRef::RelativeSelectorList(v0))) + } + QualifiedRulePrelude::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::QueryInParens(node) => match node { + QueryInParens::ContainerQuery(v0) => { + Box::new(::std::iter::once(NodeRef::ContainerQuery(v0))) + } + QueryInParens::SizeFeature(v0) => { + Box::new(::std::iter::once(NodeRef::SizeFeature(v0))) + } + QueryInParens::GeneralEnclosed(v0) => { + Box::new(::std::iter::once(NodeRef::GeneralEnclosed(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Ratio(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.left))) + .chain( + node.right + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Number(&item))), + ); + Box::new(iterator) + } + NodeRef::RelativeSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.combinator + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Combinator(&item))), + ) + .chain(::std::iter::once(NodeRef::ComplexSelector(&node.selector))); + Box::new(iterator) + } + NodeRef::RelativeSelectorList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::RelativeSelector(&item))), + ); + Box::new(iterator) + } + NodeRef::Resolution(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::Rule(node) => match node { + Rule::QualifiedRule(v0) => Box::new(::std::iter::once(NodeRef::QualifiedRule(v0))), + Rule::AtRule(v0) => Box::new(::std::iter::once(NodeRef::AtRule(v0))), + Rule::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ScopeRange(node) => { + let iterator = + ::std::iter::empty::>() + .chain(node.scope_start.iter().flat_map(|item| { + ::std::iter::once(NodeRef::ForgivingSelectorList(&item)) + })) + .chain(node.scope_end.iter().flat_map(|item| { + ::std::iter::once(NodeRef::ForgivingSelectorList(&item)) + })); + Box::new(iterator) + } + NodeRef::SelectorList(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ComplexSelector(&item))), + ); + Box::new(iterator) + } + NodeRef::SequenceOfCustomIdents(node) => { + let iterator = ::std::iter::empty::>().chain( + node.value + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::CustomIdent(&item))), + ); + Box::new(iterator) + } + NodeRef::SimpleBlock(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TokenAndSpan(&node.name))) + .chain( + node.value + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ComponentValue(&item))), + ); + Box::new(iterator) + } + NodeRef::SizeFeature(node) => match node { + SizeFeature::Plain(v0) => { + Box::new(::std::iter::once(NodeRef::SizeFeaturePlain(v0))) + } + SizeFeature::Boolean(v0) => { + Box::new(::std::iter::once(NodeRef::SizeFeatureBoolean(v0))) + } + SizeFeature::Range(v0) => { + Box::new(::std::iter::once(NodeRef::SizeFeatureRange(v0))) + } + SizeFeature::RangeInterval(v0) => { + Box::new(::std::iter::once(NodeRef::SizeFeatureRangeInterval(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SizeFeatureBoolean(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::SizeFeatureName(&node.name))); + Box::new(iterator) + } + NodeRef::SizeFeatureName(node) => match node { + SizeFeatureName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SizeFeaturePlain(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::SizeFeatureName(&node.name))) + .chain({ + let item = &*node.value; + ::std::iter::once(NodeRef::SizeFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::SizeFeatureRange(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::SizeFeatureValue(&item)) + }) + .chain(::std::iter::once(NodeRef::SizeFeatureRangeComparison( + &node.comparison, + ))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::SizeFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::SizeFeatureRangeComparison(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SizeFeatureRangeInterval(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::SizeFeatureValue(&item)) + }) + .chain(::std::iter::once(NodeRef::SizeFeatureRangeComparison( + &node.left_comparison, + ))) + .chain(::std::iter::once(NodeRef::SizeFeatureName(&node.name))) + .chain(::std::iter::once(NodeRef::SizeFeatureRangeComparison( + &node.right_comparison, + ))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::SizeFeatureValue(&item)) + }); + Box::new(iterator) + } + NodeRef::SizeFeatureValue(node) => match node { + SizeFeatureValue::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + SizeFeatureValue::Dimension(v0) => { + Box::new(::std::iter::once(NodeRef::Dimension(v0))) + } + SizeFeatureValue::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + SizeFeatureValue::Ratio(v0) => Box::new(::std::iter::once(NodeRef::Ratio(v0))), + SizeFeatureValue::Function(v0) => { + Box::new(::std::iter::once(NodeRef::Function(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Str(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::StyleBlock(node) => match node { + StyleBlock::AtRule(v0) => Box::new(::std::iter::once(NodeRef::AtRule(v0))), + StyleBlock::Declaration(v0) => { + Box::new(::std::iter::once(NodeRef::Declaration(v0))) + } + StyleBlock::QualifiedRule(v0) => { + Box::new(::std::iter::once(NodeRef::QualifiedRule(v0))) + } + StyleBlock::ListOfComponentValues(v0) => { + Box::new(::std::iter::once(NodeRef::ListOfComponentValues(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Stylesheet(node) => { + let iterator = ::std::iter::empty::>().chain( + node.rules + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Rule(&item))), + ); + Box::new(iterator) + } + NodeRef::SubclassSelector(node) => match node { + SubclassSelector::Id(v0) => Box::new(::std::iter::once(NodeRef::IdSelector(v0))), + SubclassSelector::Class(v0) => { + Box::new(::std::iter::once(NodeRef::ClassSelector(v0))) + } + SubclassSelector::Attribute(v0) => { + Box::new(::std::iter::once(NodeRef::AttributeSelector(v0))) + } + SubclassSelector::PseudoClass(v0) => { + Box::new(::std::iter::once(NodeRef::PseudoClassSelector(v0))) + } + SubclassSelector::PseudoElement(v0) => { + Box::new(::std::iter::once(NodeRef::PseudoElementSelector(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SupportsAnd(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.condition; + ::std::iter::once(NodeRef::SupportsInParens(&item)) + }); + Box::new(iterator) + } + NodeRef::SupportsCondition(node) => { + let iterator = ::std::iter::empty::>().chain( + node.conditions + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::SupportsConditionType(&item))), + ); + Box::new(iterator) + } + NodeRef::SupportsConditionType(node) => match node { + SupportsConditionType::Not(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsNot(v0))) + } + SupportsConditionType::And(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsAnd(v0))) + } + SupportsConditionType::Or(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsOr(v0))) + } + SupportsConditionType::SupportsInParens(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsInParens(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SupportsFeature(node) => match node { + SupportsFeature::Declaration(v0) => { + Box::new(::std::iter::once(NodeRef::Declaration(v0))) + } + SupportsFeature::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SupportsInParens(node) => match node { + SupportsInParens::SupportsCondition(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsCondition(v0))) + } + SupportsInParens::Feature(v0) => { + Box::new(::std::iter::once(NodeRef::SupportsFeature(v0))) + } + SupportsInParens::GeneralEnclosed(v0) => { + Box::new(::std::iter::once(NodeRef::GeneralEnclosed(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SupportsNot(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.condition; + ::std::iter::once(NodeRef::SupportsInParens(&item)) + }); + Box::new(iterator) + } + NodeRef::SupportsOr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.keyword + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.condition; + ::std::iter::once(NodeRef::SupportsInParens(&item)) + }); + Box::new(iterator) + } + NodeRef::TagNameSelector(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::WqName(&node.name))); + Box::new(iterator) + } + NodeRef::Time(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::TimePercentage(node) => match node { + TimePercentage::Time(v0) => Box::new(::std::iter::once(NodeRef::Time(v0))), + TimePercentage::Percentage(v0) => { + Box::new(::std::iter::once(NodeRef::Percentage(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Token(node) => match node { + Token::Dimension(v0) => Box::new(::std::iter::once(NodeRef::DimensionToken(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TokenAndSpan(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Token(&node.token))); + Box::new(iterator) + } + NodeRef::TypeSelector(node) => match node { + TypeSelector::TagName(v0) => { + Box::new(::std::iter::once(NodeRef::TagNameSelector(v0))) + } + TypeSelector::Universal(v0) => { + Box::new(::std::iter::once(NodeRef::UniversalSelector(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::UnicodeRange(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::UniversalSelector(node) => { + let iterator = ::std::iter::empty::>().chain( + node.prefix + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::NamespacePrefix(&item))), + ); + Box::new(iterator) + } + NodeRef::UnknownDimension(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Number(&node.value))) + .chain(::std::iter::once(NodeRef::Ident(&node.unit))); + Box::new(iterator) + } + NodeRef::Url(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.name))) + .chain(node.value.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::UrlValue(&item)) + })) + .chain(node.modifiers.iter().flat_map(|item| { + item.iter() + .flat_map(|item| ::std::iter::once(NodeRef::UrlModifier(&item))) + })); + Box::new(iterator) + } + NodeRef::UrlKeyValue(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::UrlModifier(node) => match node { + UrlModifier::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + UrlModifier::Function(v0) => Box::new(::std::iter::once(NodeRef::Function(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::UrlValue(node) => match node { + UrlValue::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + UrlValue::Raw(v0) => Box::new(::std::iter::once(NodeRef::UrlValueRaw(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::UrlValueRaw(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::WqName(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.prefix + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::NamespacePrefix(&item))), + ) + .chain(::std::iter::once(NodeRef::Ident(&node.value))); + Box::new(iterator) + } + } + } +} #[cfg(any(docsrs, feature = "path"))] pub use self::fields::{AstParentKind, AstParentNodeRef}; diff --git a/crates/swc_ecma_visit/src/generated.rs b/crates/swc_ecma_visit/src/generated.rs index b8d1f79a4ca..249cde5aa78 100644 --- a/crates/swc_ecma_visit/src/generated.rs +++ b/crates/swc_ecma_visit/src/generated.rs @@ -140378,7 +140378,6 @@ pub mod fields { #[doc = "Represents [`YieldExpr::delegate`]"] Delegate, } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AstParentKind { Accessibility(AccessibilityField), @@ -140861,7 +140860,6 @@ pub mod fields { } } } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy)] pub enum AstParentNodeRef<'ast> { Accessibility(&'ast Accessibility, AccessibilityField), @@ -141362,6 +141360,7 @@ pub mod fields { } } } + #[cfg(any(docsrs, feature = "path"))] impl<'ast> AstParentNodeRef<'ast> { #[inline] pub fn kind(&self) -> AstParentKind { @@ -141744,5 +141743,3771 @@ pub mod fields { } } } +impl<'ast> From<&'ast Accessibility> for NodeRef<'ast> { + fn from(node: &'ast Accessibility) -> Self { + NodeRef::Accessibility(node) + } +} +impl<'ast> From<&'ast ArrayLit> for NodeRef<'ast> { + fn from(node: &'ast ArrayLit) -> Self { + NodeRef::ArrayLit(node) + } +} +impl<'ast> From<&'ast ArrayPat> for NodeRef<'ast> { + fn from(node: &'ast ArrayPat) -> Self { + NodeRef::ArrayPat(node) + } +} +impl<'ast> From<&'ast ArrowExpr> for NodeRef<'ast> { + fn from(node: &'ast ArrowExpr) -> Self { + NodeRef::ArrowExpr(node) + } +} +impl<'ast> From<&'ast AssignExpr> for NodeRef<'ast> { + fn from(node: &'ast AssignExpr) -> Self { + NodeRef::AssignExpr(node) + } +} +impl<'ast> From<&'ast AssignOp> for NodeRef<'ast> { + fn from(node: &'ast AssignOp) -> Self { + NodeRef::AssignOp(node) + } +} +impl<'ast> From<&'ast AssignPat> for NodeRef<'ast> { + fn from(node: &'ast AssignPat) -> Self { + NodeRef::AssignPat(node) + } +} +impl<'ast> From<&'ast AssignPatProp> for NodeRef<'ast> { + fn from(node: &'ast AssignPatProp) -> Self { + NodeRef::AssignPatProp(node) + } +} +impl<'ast> From<&'ast AssignProp> for NodeRef<'ast> { + fn from(node: &'ast AssignProp) -> Self { + NodeRef::AssignProp(node) + } +} +impl<'ast> From<&'ast AssignTarget> for NodeRef<'ast> { + fn from(node: &'ast AssignTarget) -> Self { + NodeRef::AssignTarget(node) + } +} +impl<'ast> From<&'ast AssignTargetPat> for NodeRef<'ast> { + fn from(node: &'ast AssignTargetPat) -> Self { + NodeRef::AssignTargetPat(node) + } +} +impl<'ast> From<&'ast AutoAccessor> for NodeRef<'ast> { + fn from(node: &'ast AutoAccessor) -> Self { + NodeRef::AutoAccessor(node) + } +} +impl<'ast> From<&'ast AwaitExpr> for NodeRef<'ast> { + fn from(node: &'ast AwaitExpr) -> Self { + NodeRef::AwaitExpr(node) + } +} +impl<'ast> From<&'ast BigInt> for NodeRef<'ast> { + fn from(node: &'ast BigInt) -> Self { + NodeRef::BigInt(node) + } +} +impl<'ast> From<&'ast BinExpr> for NodeRef<'ast> { + fn from(node: &'ast BinExpr) -> Self { + NodeRef::BinExpr(node) + } +} +impl<'ast> From<&'ast BinaryOp> for NodeRef<'ast> { + fn from(node: &'ast BinaryOp) -> Self { + NodeRef::BinaryOp(node) + } +} +impl<'ast> From<&'ast BindingIdent> for NodeRef<'ast> { + fn from(node: &'ast BindingIdent) -> Self { + NodeRef::BindingIdent(node) + } +} +impl<'ast> From<&'ast BlockStmt> for NodeRef<'ast> { + fn from(node: &'ast BlockStmt) -> Self { + NodeRef::BlockStmt(node) + } +} +impl<'ast> From<&'ast BlockStmtOrExpr> for NodeRef<'ast> { + fn from(node: &'ast BlockStmtOrExpr) -> Self { + NodeRef::BlockStmtOrExpr(node) + } +} +impl<'ast> From<&'ast Bool> for NodeRef<'ast> { + fn from(node: &'ast Bool) -> Self { + NodeRef::Bool(node) + } +} +impl<'ast> From<&'ast BreakStmt> for NodeRef<'ast> { + fn from(node: &'ast BreakStmt) -> Self { + NodeRef::BreakStmt(node) + } +} +impl<'ast> From<&'ast CallExpr> for NodeRef<'ast> { + fn from(node: &'ast CallExpr) -> Self { + NodeRef::CallExpr(node) + } +} +impl<'ast> From<&'ast Callee> for NodeRef<'ast> { + fn from(node: &'ast Callee) -> Self { + NodeRef::Callee(node) + } +} +impl<'ast> From<&'ast CatchClause> for NodeRef<'ast> { + fn from(node: &'ast CatchClause) -> Self { + NodeRef::CatchClause(node) + } +} +impl<'ast> From<&'ast Class> for NodeRef<'ast> { + fn from(node: &'ast Class) -> Self { + NodeRef::Class(node) + } +} +impl<'ast> From<&'ast ClassDecl> for NodeRef<'ast> { + fn from(node: &'ast ClassDecl) -> Self { + NodeRef::ClassDecl(node) + } +} +impl<'ast> From<&'ast ClassExpr> for NodeRef<'ast> { + fn from(node: &'ast ClassExpr) -> Self { + NodeRef::ClassExpr(node) + } +} +impl<'ast> From<&'ast ClassMember> for NodeRef<'ast> { + fn from(node: &'ast ClassMember) -> Self { + NodeRef::ClassMember(node) + } +} +impl<'ast> From<&'ast ClassMethod> for NodeRef<'ast> { + fn from(node: &'ast ClassMethod) -> Self { + NodeRef::ClassMethod(node) + } +} +impl<'ast> From<&'ast ClassProp> for NodeRef<'ast> { + fn from(node: &'ast ClassProp) -> Self { + NodeRef::ClassProp(node) + } +} +impl<'ast> From<&'ast ComputedPropName> for NodeRef<'ast> { + fn from(node: &'ast ComputedPropName) -> Self { + NodeRef::ComputedPropName(node) + } +} +impl<'ast> From<&'ast CondExpr> for NodeRef<'ast> { + fn from(node: &'ast CondExpr) -> Self { + NodeRef::CondExpr(node) + } +} +impl<'ast> From<&'ast Constructor> for NodeRef<'ast> { + fn from(node: &'ast Constructor) -> Self { + NodeRef::Constructor(node) + } +} +impl<'ast> From<&'ast ContinueStmt> for NodeRef<'ast> { + fn from(node: &'ast ContinueStmt) -> Self { + NodeRef::ContinueStmt(node) + } +} +impl<'ast> From<&'ast DebuggerStmt> for NodeRef<'ast> { + fn from(node: &'ast DebuggerStmt) -> Self { + NodeRef::DebuggerStmt(node) + } +} +impl<'ast> From<&'ast Decl> for NodeRef<'ast> { + fn from(node: &'ast Decl) -> Self { + NodeRef::Decl(node) + } +} +impl<'ast> From<&'ast Decorator> for NodeRef<'ast> { + fn from(node: &'ast Decorator) -> Self { + NodeRef::Decorator(node) + } +} +impl<'ast> From<&'ast DefaultDecl> for NodeRef<'ast> { + fn from(node: &'ast DefaultDecl) -> Self { + NodeRef::DefaultDecl(node) + } +} +impl<'ast> From<&'ast DoWhileStmt> for NodeRef<'ast> { + fn from(node: &'ast DoWhileStmt) -> Self { + NodeRef::DoWhileStmt(node) + } +} +impl<'ast> From<&'ast EmptyStmt> for NodeRef<'ast> { + fn from(node: &'ast EmptyStmt) -> Self { + NodeRef::EmptyStmt(node) + } +} +impl<'ast> From<&'ast EsVersion> for NodeRef<'ast> { + fn from(node: &'ast EsVersion) -> Self { + NodeRef::EsVersion(node) + } +} +impl<'ast> From<&'ast ExportAll> for NodeRef<'ast> { + fn from(node: &'ast ExportAll) -> Self { + NodeRef::ExportAll(node) + } +} +impl<'ast> From<&'ast ExportDecl> for NodeRef<'ast> { + fn from(node: &'ast ExportDecl) -> Self { + NodeRef::ExportDecl(node) + } +} +impl<'ast> From<&'ast ExportDefaultDecl> for NodeRef<'ast> { + fn from(node: &'ast ExportDefaultDecl) -> Self { + NodeRef::ExportDefaultDecl(node) + } +} +impl<'ast> From<&'ast ExportDefaultExpr> for NodeRef<'ast> { + fn from(node: &'ast ExportDefaultExpr) -> Self { + NodeRef::ExportDefaultExpr(node) + } +} +impl<'ast> From<&'ast ExportDefaultSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ExportDefaultSpecifier) -> Self { + NodeRef::ExportDefaultSpecifier(node) + } +} +impl<'ast> From<&'ast ExportNamedSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ExportNamedSpecifier) -> Self { + NodeRef::ExportNamedSpecifier(node) + } +} +impl<'ast> From<&'ast ExportNamespaceSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ExportNamespaceSpecifier) -> Self { + NodeRef::ExportNamespaceSpecifier(node) + } +} +impl<'ast> From<&'ast ExportSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ExportSpecifier) -> Self { + NodeRef::ExportSpecifier(node) + } +} +impl<'ast> From<&'ast Expr> for NodeRef<'ast> { + fn from(node: &'ast Expr) -> Self { + NodeRef::Expr(node) + } +} +impl<'ast> From<&'ast ExprOrSpread> for NodeRef<'ast> { + fn from(node: &'ast ExprOrSpread) -> Self { + NodeRef::ExprOrSpread(node) + } +} +impl<'ast> From<&'ast ExprStmt> for NodeRef<'ast> { + fn from(node: &'ast ExprStmt) -> Self { + NodeRef::ExprStmt(node) + } +} +impl<'ast> From<&'ast FnDecl> for NodeRef<'ast> { + fn from(node: &'ast FnDecl) -> Self { + NodeRef::FnDecl(node) + } +} +impl<'ast> From<&'ast FnExpr> for NodeRef<'ast> { + fn from(node: &'ast FnExpr) -> Self { + NodeRef::FnExpr(node) + } +} +impl<'ast> From<&'ast ForHead> for NodeRef<'ast> { + fn from(node: &'ast ForHead) -> Self { + NodeRef::ForHead(node) + } +} +impl<'ast> From<&'ast ForInStmt> for NodeRef<'ast> { + fn from(node: &'ast ForInStmt) -> Self { + NodeRef::ForInStmt(node) + } +} +impl<'ast> From<&'ast ForOfStmt> for NodeRef<'ast> { + fn from(node: &'ast ForOfStmt) -> Self { + NodeRef::ForOfStmt(node) + } +} +impl<'ast> From<&'ast ForStmt> for NodeRef<'ast> { + fn from(node: &'ast ForStmt) -> Self { + NodeRef::ForStmt(node) + } +} +impl<'ast> From<&'ast Function> for NodeRef<'ast> { + fn from(node: &'ast Function) -> Self { + NodeRef::Function(node) + } +} +impl<'ast> From<&'ast GetterProp> for NodeRef<'ast> { + fn from(node: &'ast GetterProp) -> Self { + NodeRef::GetterProp(node) + } +} +impl<'ast> From<&'ast Ident> for NodeRef<'ast> { + fn from(node: &'ast Ident) -> Self { + NodeRef::Ident(node) + } +} +impl<'ast> From<&'ast IdentName> for NodeRef<'ast> { + fn from(node: &'ast IdentName) -> Self { + NodeRef::IdentName(node) + } +} +impl<'ast> From<&'ast IfStmt> for NodeRef<'ast> { + fn from(node: &'ast IfStmt) -> Self { + NodeRef::IfStmt(node) + } +} +impl<'ast> From<&'ast Import> for NodeRef<'ast> { + fn from(node: &'ast Import) -> Self { + NodeRef::Import(node) + } +} +impl<'ast> From<&'ast ImportDecl> for NodeRef<'ast> { + fn from(node: &'ast ImportDecl) -> Self { + NodeRef::ImportDecl(node) + } +} +impl<'ast> From<&'ast ImportDefaultSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ImportDefaultSpecifier) -> Self { + NodeRef::ImportDefaultSpecifier(node) + } +} +impl<'ast> From<&'ast ImportNamedSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ImportNamedSpecifier) -> Self { + NodeRef::ImportNamedSpecifier(node) + } +} +impl<'ast> From<&'ast ImportPhase> for NodeRef<'ast> { + fn from(node: &'ast ImportPhase) -> Self { + NodeRef::ImportPhase(node) + } +} +impl<'ast> From<&'ast ImportSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ImportSpecifier) -> Self { + NodeRef::ImportSpecifier(node) + } +} +impl<'ast> From<&'ast ImportStarAsSpecifier> for NodeRef<'ast> { + fn from(node: &'ast ImportStarAsSpecifier) -> Self { + NodeRef::ImportStarAsSpecifier(node) + } +} +impl<'ast> From<&'ast ImportWith> for NodeRef<'ast> { + fn from(node: &'ast ImportWith) -> Self { + NodeRef::ImportWith(node) + } +} +impl<'ast> From<&'ast ImportWithItem> for NodeRef<'ast> { + fn from(node: &'ast ImportWithItem) -> Self { + NodeRef::ImportWithItem(node) + } +} +impl<'ast> From<&'ast Invalid> for NodeRef<'ast> { + fn from(node: &'ast Invalid) -> Self { + NodeRef::Invalid(node) + } +} +impl<'ast> From<&'ast JSXAttr> for NodeRef<'ast> { + fn from(node: &'ast JSXAttr) -> Self { + NodeRef::JSXAttr(node) + } +} +impl<'ast> From<&'ast JSXAttrName> for NodeRef<'ast> { + fn from(node: &'ast JSXAttrName) -> Self { + NodeRef::JSXAttrName(node) + } +} +impl<'ast> From<&'ast JSXAttrOrSpread> for NodeRef<'ast> { + fn from(node: &'ast JSXAttrOrSpread) -> Self { + NodeRef::JSXAttrOrSpread(node) + } +} +impl<'ast> From<&'ast JSXAttrValue> for NodeRef<'ast> { + fn from(node: &'ast JSXAttrValue) -> Self { + NodeRef::JSXAttrValue(node) + } +} +impl<'ast> From<&'ast JSXClosingElement> for NodeRef<'ast> { + fn from(node: &'ast JSXClosingElement) -> Self { + NodeRef::JSXClosingElement(node) + } +} +impl<'ast> From<&'ast JSXClosingFragment> for NodeRef<'ast> { + fn from(node: &'ast JSXClosingFragment) -> Self { + NodeRef::JSXClosingFragment(node) + } +} +impl<'ast> From<&'ast JSXElement> for NodeRef<'ast> { + fn from(node: &'ast JSXElement) -> Self { + NodeRef::JSXElement(node) + } +} +impl<'ast> From<&'ast JSXElementChild> for NodeRef<'ast> { + fn from(node: &'ast JSXElementChild) -> Self { + NodeRef::JSXElementChild(node) + } +} +impl<'ast> From<&'ast JSXElementName> for NodeRef<'ast> { + fn from(node: &'ast JSXElementName) -> Self { + NodeRef::JSXElementName(node) + } +} +impl<'ast> From<&'ast JSXEmptyExpr> for NodeRef<'ast> { + fn from(node: &'ast JSXEmptyExpr) -> Self { + NodeRef::JSXEmptyExpr(node) + } +} +impl<'ast> From<&'ast JSXExpr> for NodeRef<'ast> { + fn from(node: &'ast JSXExpr) -> Self { + NodeRef::JSXExpr(node) + } +} +impl<'ast> From<&'ast JSXExprContainer> for NodeRef<'ast> { + fn from(node: &'ast JSXExprContainer) -> Self { + NodeRef::JSXExprContainer(node) + } +} +impl<'ast> From<&'ast JSXFragment> for NodeRef<'ast> { + fn from(node: &'ast JSXFragment) -> Self { + NodeRef::JSXFragment(node) + } +} +impl<'ast> From<&'ast JSXMemberExpr> for NodeRef<'ast> { + fn from(node: &'ast JSXMemberExpr) -> Self { + NodeRef::JSXMemberExpr(node) + } +} +impl<'ast> From<&'ast JSXNamespacedName> for NodeRef<'ast> { + fn from(node: &'ast JSXNamespacedName) -> Self { + NodeRef::JSXNamespacedName(node) + } +} +impl<'ast> From<&'ast JSXObject> for NodeRef<'ast> { + fn from(node: &'ast JSXObject) -> Self { + NodeRef::JSXObject(node) + } +} +impl<'ast> From<&'ast JSXOpeningElement> for NodeRef<'ast> { + fn from(node: &'ast JSXOpeningElement) -> Self { + NodeRef::JSXOpeningElement(node) + } +} +impl<'ast> From<&'ast JSXOpeningFragment> for NodeRef<'ast> { + fn from(node: &'ast JSXOpeningFragment) -> Self { + NodeRef::JSXOpeningFragment(node) + } +} +impl<'ast> From<&'ast JSXSpreadChild> for NodeRef<'ast> { + fn from(node: &'ast JSXSpreadChild) -> Self { + NodeRef::JSXSpreadChild(node) + } +} +impl<'ast> From<&'ast JSXText> for NodeRef<'ast> { + fn from(node: &'ast JSXText) -> Self { + NodeRef::JSXText(node) + } +} +impl<'ast> From<&'ast Key> for NodeRef<'ast> { + fn from(node: &'ast Key) -> Self { + NodeRef::Key(node) + } +} +impl<'ast> From<&'ast KeyValuePatProp> for NodeRef<'ast> { + fn from(node: &'ast KeyValuePatProp) -> Self { + NodeRef::KeyValuePatProp(node) + } +} +impl<'ast> From<&'ast KeyValueProp> for NodeRef<'ast> { + fn from(node: &'ast KeyValueProp) -> Self { + NodeRef::KeyValueProp(node) + } +} +impl<'ast> From<&'ast LabeledStmt> for NodeRef<'ast> { + fn from(node: &'ast LabeledStmt) -> Self { + NodeRef::LabeledStmt(node) + } +} +impl<'ast> From<&'ast Lit> for NodeRef<'ast> { + fn from(node: &'ast Lit) -> Self { + NodeRef::Lit(node) + } +} +impl<'ast> From<&'ast MemberExpr> for NodeRef<'ast> { + fn from(node: &'ast MemberExpr) -> Self { + NodeRef::MemberExpr(node) + } +} +impl<'ast> From<&'ast MemberProp> for NodeRef<'ast> { + fn from(node: &'ast MemberProp) -> Self { + NodeRef::MemberProp(node) + } +} +impl<'ast> From<&'ast MetaPropExpr> for NodeRef<'ast> { + fn from(node: &'ast MetaPropExpr) -> Self { + NodeRef::MetaPropExpr(node) + } +} +impl<'ast> From<&'ast MetaPropKind> for NodeRef<'ast> { + fn from(node: &'ast MetaPropKind) -> Self { + NodeRef::MetaPropKind(node) + } +} +impl<'ast> From<&'ast MethodKind> for NodeRef<'ast> { + fn from(node: &'ast MethodKind) -> Self { + NodeRef::MethodKind(node) + } +} +impl<'ast> From<&'ast MethodProp> for NodeRef<'ast> { + fn from(node: &'ast MethodProp) -> Self { + NodeRef::MethodProp(node) + } +} +impl<'ast> From<&'ast Module> for NodeRef<'ast> { + fn from(node: &'ast Module) -> Self { + NodeRef::Module(node) + } +} +impl<'ast> From<&'ast ModuleDecl> for NodeRef<'ast> { + fn from(node: &'ast ModuleDecl) -> Self { + NodeRef::ModuleDecl(node) + } +} +impl<'ast> From<&'ast ModuleExportName> for NodeRef<'ast> { + fn from(node: &'ast ModuleExportName) -> Self { + NodeRef::ModuleExportName(node) + } +} +impl<'ast> From<&'ast ModuleItem> for NodeRef<'ast> { + fn from(node: &'ast ModuleItem) -> Self { + NodeRef::ModuleItem(node) + } +} +impl<'ast> From<&'ast NamedExport> for NodeRef<'ast> { + fn from(node: &'ast NamedExport) -> Self { + NodeRef::NamedExport(node) + } +} +impl<'ast> From<&'ast NewExpr> for NodeRef<'ast> { + fn from(node: &'ast NewExpr) -> Self { + NodeRef::NewExpr(node) + } +} +impl<'ast> From<&'ast Null> for NodeRef<'ast> { + fn from(node: &'ast Null) -> Self { + NodeRef::Null(node) + } +} +impl<'ast> From<&'ast Number> for NodeRef<'ast> { + fn from(node: &'ast Number) -> Self { + NodeRef::Number(node) + } +} +impl<'ast> From<&'ast ObjectLit> for NodeRef<'ast> { + fn from(node: &'ast ObjectLit) -> Self { + NodeRef::ObjectLit(node) + } +} +impl<'ast> From<&'ast ObjectPat> for NodeRef<'ast> { + fn from(node: &'ast ObjectPat) -> Self { + NodeRef::ObjectPat(node) + } +} +impl<'ast> From<&'ast ObjectPatProp> for NodeRef<'ast> { + fn from(node: &'ast ObjectPatProp) -> Self { + NodeRef::ObjectPatProp(node) + } +} +impl<'ast> From<&'ast OptCall> for NodeRef<'ast> { + fn from(node: &'ast OptCall) -> Self { + NodeRef::OptCall(node) + } +} +impl<'ast> From<&'ast OptChainBase> for NodeRef<'ast> { + fn from(node: &'ast OptChainBase) -> Self { + NodeRef::OptChainBase(node) + } +} +impl<'ast> From<&'ast OptChainExpr> for NodeRef<'ast> { + fn from(node: &'ast OptChainExpr) -> Self { + NodeRef::OptChainExpr(node) + } +} +impl<'ast> From<&'ast Param> for NodeRef<'ast> { + fn from(node: &'ast Param) -> Self { + NodeRef::Param(node) + } +} +impl<'ast> From<&'ast ParamOrTsParamProp> for NodeRef<'ast> { + fn from(node: &'ast ParamOrTsParamProp) -> Self { + NodeRef::ParamOrTsParamProp(node) + } +} +impl<'ast> From<&'ast ParenExpr> for NodeRef<'ast> { + fn from(node: &'ast ParenExpr) -> Self { + NodeRef::ParenExpr(node) + } +} +impl<'ast> From<&'ast Pat> for NodeRef<'ast> { + fn from(node: &'ast Pat) -> Self { + NodeRef::Pat(node) + } +} +impl<'ast> From<&'ast PrivateMethod> for NodeRef<'ast> { + fn from(node: &'ast PrivateMethod) -> Self { + NodeRef::PrivateMethod(node) + } +} +impl<'ast> From<&'ast PrivateName> for NodeRef<'ast> { + fn from(node: &'ast PrivateName) -> Self { + NodeRef::PrivateName(node) + } +} +impl<'ast> From<&'ast PrivateProp> for NodeRef<'ast> { + fn from(node: &'ast PrivateProp) -> Self { + NodeRef::PrivateProp(node) + } +} +impl<'ast> From<&'ast Program> for NodeRef<'ast> { + fn from(node: &'ast Program) -> Self { + NodeRef::Program(node) + } +} +impl<'ast> From<&'ast Prop> for NodeRef<'ast> { + fn from(node: &'ast Prop) -> Self { + NodeRef::Prop(node) + } +} +impl<'ast> From<&'ast PropName> for NodeRef<'ast> { + fn from(node: &'ast PropName) -> Self { + NodeRef::PropName(node) + } +} +impl<'ast> From<&'ast PropOrSpread> for NodeRef<'ast> { + fn from(node: &'ast PropOrSpread) -> Self { + NodeRef::PropOrSpread(node) + } +} +impl<'ast> From<&'ast Regex> for NodeRef<'ast> { + fn from(node: &'ast Regex) -> Self { + NodeRef::Regex(node) + } +} +impl<'ast> From<&'ast RestPat> for NodeRef<'ast> { + fn from(node: &'ast RestPat) -> Self { + NodeRef::RestPat(node) + } +} +impl<'ast> From<&'ast ReturnStmt> for NodeRef<'ast> { + fn from(node: &'ast ReturnStmt) -> Self { + NodeRef::ReturnStmt(node) + } +} +impl<'ast> From<&'ast Script> for NodeRef<'ast> { + fn from(node: &'ast Script) -> Self { + NodeRef::Script(node) + } +} +impl<'ast> From<&'ast SeqExpr> for NodeRef<'ast> { + fn from(node: &'ast SeqExpr) -> Self { + NodeRef::SeqExpr(node) + } +} +impl<'ast> From<&'ast SetterProp> for NodeRef<'ast> { + fn from(node: &'ast SetterProp) -> Self { + NodeRef::SetterProp(node) + } +} +impl<'ast> From<&'ast SimpleAssignTarget> for NodeRef<'ast> { + fn from(node: &'ast SimpleAssignTarget) -> Self { + NodeRef::SimpleAssignTarget(node) + } +} +impl<'ast> From<&'ast SpreadElement> for NodeRef<'ast> { + fn from(node: &'ast SpreadElement) -> Self { + NodeRef::SpreadElement(node) + } +} +impl<'ast> From<&'ast StaticBlock> for NodeRef<'ast> { + fn from(node: &'ast StaticBlock) -> Self { + NodeRef::StaticBlock(node) + } +} +impl<'ast> From<&'ast Stmt> for NodeRef<'ast> { + fn from(node: &'ast Stmt) -> Self { + NodeRef::Stmt(node) + } +} +impl<'ast> From<&'ast Str> for NodeRef<'ast> { + fn from(node: &'ast Str) -> Self { + NodeRef::Str(node) + } +} +impl<'ast> From<&'ast Super> for NodeRef<'ast> { + fn from(node: &'ast Super) -> Self { + NodeRef::Super(node) + } +} +impl<'ast> From<&'ast SuperProp> for NodeRef<'ast> { + fn from(node: &'ast SuperProp) -> Self { + NodeRef::SuperProp(node) + } +} +impl<'ast> From<&'ast SuperPropExpr> for NodeRef<'ast> { + fn from(node: &'ast SuperPropExpr) -> Self { + NodeRef::SuperPropExpr(node) + } +} +impl<'ast> From<&'ast SwitchCase> for NodeRef<'ast> { + fn from(node: &'ast SwitchCase) -> Self { + NodeRef::SwitchCase(node) + } +} +impl<'ast> From<&'ast SwitchStmt> for NodeRef<'ast> { + fn from(node: &'ast SwitchStmt) -> Self { + NodeRef::SwitchStmt(node) + } +} +impl<'ast> From<&'ast TaggedTpl> for NodeRef<'ast> { + fn from(node: &'ast TaggedTpl) -> Self { + NodeRef::TaggedTpl(node) + } +} +impl<'ast> From<&'ast ThisExpr> for NodeRef<'ast> { + fn from(node: &'ast ThisExpr) -> Self { + NodeRef::ThisExpr(node) + } +} +impl<'ast> From<&'ast ThrowStmt> for NodeRef<'ast> { + fn from(node: &'ast ThrowStmt) -> Self { + NodeRef::ThrowStmt(node) + } +} +impl<'ast> From<&'ast Tpl> for NodeRef<'ast> { + fn from(node: &'ast Tpl) -> Self { + NodeRef::Tpl(node) + } +} +impl<'ast> From<&'ast TplElement> for NodeRef<'ast> { + fn from(node: &'ast TplElement) -> Self { + NodeRef::TplElement(node) + } +} +impl<'ast> From<&'ast TruePlusMinus> for NodeRef<'ast> { + fn from(node: &'ast TruePlusMinus) -> Self { + NodeRef::TruePlusMinus(node) + } +} +impl<'ast> From<&'ast TryStmt> for NodeRef<'ast> { + fn from(node: &'ast TryStmt) -> Self { + NodeRef::TryStmt(node) + } +} +impl<'ast> From<&'ast TsArrayType> for NodeRef<'ast> { + fn from(node: &'ast TsArrayType) -> Self { + NodeRef::TsArrayType(node) + } +} +impl<'ast> From<&'ast TsAsExpr> for NodeRef<'ast> { + fn from(node: &'ast TsAsExpr) -> Self { + NodeRef::TsAsExpr(node) + } +} +impl<'ast> From<&'ast TsCallSignatureDecl> for NodeRef<'ast> { + fn from(node: &'ast TsCallSignatureDecl) -> Self { + NodeRef::TsCallSignatureDecl(node) + } +} +impl<'ast> From<&'ast TsConditionalType> for NodeRef<'ast> { + fn from(node: &'ast TsConditionalType) -> Self { + NodeRef::TsConditionalType(node) + } +} +impl<'ast> From<&'ast TsConstAssertion> for NodeRef<'ast> { + fn from(node: &'ast TsConstAssertion) -> Self { + NodeRef::TsConstAssertion(node) + } +} +impl<'ast> From<&'ast TsConstructSignatureDecl> for NodeRef<'ast> { + fn from(node: &'ast TsConstructSignatureDecl) -> Self { + NodeRef::TsConstructSignatureDecl(node) + } +} +impl<'ast> From<&'ast TsConstructorType> for NodeRef<'ast> { + fn from(node: &'ast TsConstructorType) -> Self { + NodeRef::TsConstructorType(node) + } +} +impl<'ast> From<&'ast TsEntityName> for NodeRef<'ast> { + fn from(node: &'ast TsEntityName) -> Self { + NodeRef::TsEntityName(node) + } +} +impl<'ast> From<&'ast TsEnumDecl> for NodeRef<'ast> { + fn from(node: &'ast TsEnumDecl) -> Self { + NodeRef::TsEnumDecl(node) + } +} +impl<'ast> From<&'ast TsEnumMember> for NodeRef<'ast> { + fn from(node: &'ast TsEnumMember) -> Self { + NodeRef::TsEnumMember(node) + } +} +impl<'ast> From<&'ast TsEnumMemberId> for NodeRef<'ast> { + fn from(node: &'ast TsEnumMemberId) -> Self { + NodeRef::TsEnumMemberId(node) + } +} +impl<'ast> From<&'ast TsExportAssignment> for NodeRef<'ast> { + fn from(node: &'ast TsExportAssignment) -> Self { + NodeRef::TsExportAssignment(node) + } +} +impl<'ast> From<&'ast TsExprWithTypeArgs> for NodeRef<'ast> { + fn from(node: &'ast TsExprWithTypeArgs) -> Self { + NodeRef::TsExprWithTypeArgs(node) + } +} +impl<'ast> From<&'ast TsExternalModuleRef> for NodeRef<'ast> { + fn from(node: &'ast TsExternalModuleRef) -> Self { + NodeRef::TsExternalModuleRef(node) + } +} +impl<'ast> From<&'ast TsFnOrConstructorType> for NodeRef<'ast> { + fn from(node: &'ast TsFnOrConstructorType) -> Self { + NodeRef::TsFnOrConstructorType(node) + } +} +impl<'ast> From<&'ast TsFnParam> for NodeRef<'ast> { + fn from(node: &'ast TsFnParam) -> Self { + NodeRef::TsFnParam(node) + } +} +impl<'ast> From<&'ast TsFnType> for NodeRef<'ast> { + fn from(node: &'ast TsFnType) -> Self { + NodeRef::TsFnType(node) + } +} +impl<'ast> From<&'ast TsGetterSignature> for NodeRef<'ast> { + fn from(node: &'ast TsGetterSignature) -> Self { + NodeRef::TsGetterSignature(node) + } +} +impl<'ast> From<&'ast TsImportEqualsDecl> for NodeRef<'ast> { + fn from(node: &'ast TsImportEqualsDecl) -> Self { + NodeRef::TsImportEqualsDecl(node) + } +} +impl<'ast> From<&'ast TsImportType> for NodeRef<'ast> { + fn from(node: &'ast TsImportType) -> Self { + NodeRef::TsImportType(node) + } +} +impl<'ast> From<&'ast TsIndexSignature> for NodeRef<'ast> { + fn from(node: &'ast TsIndexSignature) -> Self { + NodeRef::TsIndexSignature(node) + } +} +impl<'ast> From<&'ast TsIndexedAccessType> for NodeRef<'ast> { + fn from(node: &'ast TsIndexedAccessType) -> Self { + NodeRef::TsIndexedAccessType(node) + } +} +impl<'ast> From<&'ast TsInferType> for NodeRef<'ast> { + fn from(node: &'ast TsInferType) -> Self { + NodeRef::TsInferType(node) + } +} +impl<'ast> From<&'ast TsInstantiation> for NodeRef<'ast> { + fn from(node: &'ast TsInstantiation) -> Self { + NodeRef::TsInstantiation(node) + } +} +impl<'ast> From<&'ast TsInterfaceBody> for NodeRef<'ast> { + fn from(node: &'ast TsInterfaceBody) -> Self { + NodeRef::TsInterfaceBody(node) + } +} +impl<'ast> From<&'ast TsInterfaceDecl> for NodeRef<'ast> { + fn from(node: &'ast TsInterfaceDecl) -> Self { + NodeRef::TsInterfaceDecl(node) + } +} +impl<'ast> From<&'ast TsIntersectionType> for NodeRef<'ast> { + fn from(node: &'ast TsIntersectionType) -> Self { + NodeRef::TsIntersectionType(node) + } +} +impl<'ast> From<&'ast TsKeywordType> for NodeRef<'ast> { + fn from(node: &'ast TsKeywordType) -> Self { + NodeRef::TsKeywordType(node) + } +} +impl<'ast> From<&'ast TsKeywordTypeKind> for NodeRef<'ast> { + fn from(node: &'ast TsKeywordTypeKind) -> Self { + NodeRef::TsKeywordTypeKind(node) + } +} +impl<'ast> From<&'ast TsLit> for NodeRef<'ast> { + fn from(node: &'ast TsLit) -> Self { + NodeRef::TsLit(node) + } +} +impl<'ast> From<&'ast TsLitType> for NodeRef<'ast> { + fn from(node: &'ast TsLitType) -> Self { + NodeRef::TsLitType(node) + } +} +impl<'ast> From<&'ast TsMappedType> for NodeRef<'ast> { + fn from(node: &'ast TsMappedType) -> Self { + NodeRef::TsMappedType(node) + } +} +impl<'ast> From<&'ast TsMethodSignature> for NodeRef<'ast> { + fn from(node: &'ast TsMethodSignature) -> Self { + NodeRef::TsMethodSignature(node) + } +} +impl<'ast> From<&'ast TsModuleBlock> for NodeRef<'ast> { + fn from(node: &'ast TsModuleBlock) -> Self { + NodeRef::TsModuleBlock(node) + } +} +impl<'ast> From<&'ast TsModuleDecl> for NodeRef<'ast> { + fn from(node: &'ast TsModuleDecl) -> Self { + NodeRef::TsModuleDecl(node) + } +} +impl<'ast> From<&'ast TsModuleName> for NodeRef<'ast> { + fn from(node: &'ast TsModuleName) -> Self { + NodeRef::TsModuleName(node) + } +} +impl<'ast> From<&'ast TsModuleRef> for NodeRef<'ast> { + fn from(node: &'ast TsModuleRef) -> Self { + NodeRef::TsModuleRef(node) + } +} +impl<'ast> From<&'ast TsNamespaceBody> for NodeRef<'ast> { + fn from(node: &'ast TsNamespaceBody) -> Self { + NodeRef::TsNamespaceBody(node) + } +} +impl<'ast> From<&'ast TsNamespaceDecl> for NodeRef<'ast> { + fn from(node: &'ast TsNamespaceDecl) -> Self { + NodeRef::TsNamespaceDecl(node) + } +} +impl<'ast> From<&'ast TsNamespaceExportDecl> for NodeRef<'ast> { + fn from(node: &'ast TsNamespaceExportDecl) -> Self { + NodeRef::TsNamespaceExportDecl(node) + } +} +impl<'ast> From<&'ast TsNonNullExpr> for NodeRef<'ast> { + fn from(node: &'ast TsNonNullExpr) -> Self { + NodeRef::TsNonNullExpr(node) + } +} +impl<'ast> From<&'ast TsOptionalType> for NodeRef<'ast> { + fn from(node: &'ast TsOptionalType) -> Self { + NodeRef::TsOptionalType(node) + } +} +impl<'ast> From<&'ast TsParamProp> for NodeRef<'ast> { + fn from(node: &'ast TsParamProp) -> Self { + NodeRef::TsParamProp(node) + } +} +impl<'ast> From<&'ast TsParamPropParam> for NodeRef<'ast> { + fn from(node: &'ast TsParamPropParam) -> Self { + NodeRef::TsParamPropParam(node) + } +} +impl<'ast> From<&'ast TsParenthesizedType> for NodeRef<'ast> { + fn from(node: &'ast TsParenthesizedType) -> Self { + NodeRef::TsParenthesizedType(node) + } +} +impl<'ast> From<&'ast TsPropertySignature> for NodeRef<'ast> { + fn from(node: &'ast TsPropertySignature) -> Self { + NodeRef::TsPropertySignature(node) + } +} +impl<'ast> From<&'ast TsQualifiedName> for NodeRef<'ast> { + fn from(node: &'ast TsQualifiedName) -> Self { + NodeRef::TsQualifiedName(node) + } +} +impl<'ast> From<&'ast TsRestType> for NodeRef<'ast> { + fn from(node: &'ast TsRestType) -> Self { + NodeRef::TsRestType(node) + } +} +impl<'ast> From<&'ast TsSatisfiesExpr> for NodeRef<'ast> { + fn from(node: &'ast TsSatisfiesExpr) -> Self { + NodeRef::TsSatisfiesExpr(node) + } +} +impl<'ast> From<&'ast TsSetterSignature> for NodeRef<'ast> { + fn from(node: &'ast TsSetterSignature) -> Self { + NodeRef::TsSetterSignature(node) + } +} +impl<'ast> From<&'ast TsThisType> for NodeRef<'ast> { + fn from(node: &'ast TsThisType) -> Self { + NodeRef::TsThisType(node) + } +} +impl<'ast> From<&'ast TsThisTypeOrIdent> for NodeRef<'ast> { + fn from(node: &'ast TsThisTypeOrIdent) -> Self { + NodeRef::TsThisTypeOrIdent(node) + } +} +impl<'ast> From<&'ast TsTplLitType> for NodeRef<'ast> { + fn from(node: &'ast TsTplLitType) -> Self { + NodeRef::TsTplLitType(node) + } +} +impl<'ast> From<&'ast TsTupleElement> for NodeRef<'ast> { + fn from(node: &'ast TsTupleElement) -> Self { + NodeRef::TsTupleElement(node) + } +} +impl<'ast> From<&'ast TsTupleType> for NodeRef<'ast> { + fn from(node: &'ast TsTupleType) -> Self { + NodeRef::TsTupleType(node) + } +} +impl<'ast> From<&'ast TsType> for NodeRef<'ast> { + fn from(node: &'ast TsType) -> Self { + NodeRef::TsType(node) + } +} +impl<'ast> From<&'ast TsTypeAliasDecl> for NodeRef<'ast> { + fn from(node: &'ast TsTypeAliasDecl) -> Self { + NodeRef::TsTypeAliasDecl(node) + } +} +impl<'ast> From<&'ast TsTypeAnn> for NodeRef<'ast> { + fn from(node: &'ast TsTypeAnn) -> Self { + NodeRef::TsTypeAnn(node) + } +} +impl<'ast> From<&'ast TsTypeAssertion> for NodeRef<'ast> { + fn from(node: &'ast TsTypeAssertion) -> Self { + NodeRef::TsTypeAssertion(node) + } +} +impl<'ast> From<&'ast TsTypeElement> for NodeRef<'ast> { + fn from(node: &'ast TsTypeElement) -> Self { + NodeRef::TsTypeElement(node) + } +} +impl<'ast> From<&'ast TsTypeLit> for NodeRef<'ast> { + fn from(node: &'ast TsTypeLit) -> Self { + NodeRef::TsTypeLit(node) + } +} +impl<'ast> From<&'ast TsTypeOperator> for NodeRef<'ast> { + fn from(node: &'ast TsTypeOperator) -> Self { + NodeRef::TsTypeOperator(node) + } +} +impl<'ast> From<&'ast TsTypeOperatorOp> for NodeRef<'ast> { + fn from(node: &'ast TsTypeOperatorOp) -> Self { + NodeRef::TsTypeOperatorOp(node) + } +} +impl<'ast> From<&'ast TsTypeParam> for NodeRef<'ast> { + fn from(node: &'ast TsTypeParam) -> Self { + NodeRef::TsTypeParam(node) + } +} +impl<'ast> From<&'ast TsTypeParamDecl> for NodeRef<'ast> { + fn from(node: &'ast TsTypeParamDecl) -> Self { + NodeRef::TsTypeParamDecl(node) + } +} +impl<'ast> From<&'ast TsTypeParamInstantiation> for NodeRef<'ast> { + fn from(node: &'ast TsTypeParamInstantiation) -> Self { + NodeRef::TsTypeParamInstantiation(node) + } +} +impl<'ast> From<&'ast TsTypePredicate> for NodeRef<'ast> { + fn from(node: &'ast TsTypePredicate) -> Self { + NodeRef::TsTypePredicate(node) + } +} +impl<'ast> From<&'ast TsTypeQuery> for NodeRef<'ast> { + fn from(node: &'ast TsTypeQuery) -> Self { + NodeRef::TsTypeQuery(node) + } +} +impl<'ast> From<&'ast TsTypeQueryExpr> for NodeRef<'ast> { + fn from(node: &'ast TsTypeQueryExpr) -> Self { + NodeRef::TsTypeQueryExpr(node) + } +} +impl<'ast> From<&'ast TsTypeRef> for NodeRef<'ast> { + fn from(node: &'ast TsTypeRef) -> Self { + NodeRef::TsTypeRef(node) + } +} +impl<'ast> From<&'ast TsUnionOrIntersectionType> for NodeRef<'ast> { + fn from(node: &'ast TsUnionOrIntersectionType) -> Self { + NodeRef::TsUnionOrIntersectionType(node) + } +} +impl<'ast> From<&'ast TsUnionType> for NodeRef<'ast> { + fn from(node: &'ast TsUnionType) -> Self { + NodeRef::TsUnionType(node) + } +} +impl<'ast> From<&'ast UnaryExpr> for NodeRef<'ast> { + fn from(node: &'ast UnaryExpr) -> Self { + NodeRef::UnaryExpr(node) + } +} +impl<'ast> From<&'ast UnaryOp> for NodeRef<'ast> { + fn from(node: &'ast UnaryOp) -> Self { + NodeRef::UnaryOp(node) + } +} +impl<'ast> From<&'ast UpdateExpr> for NodeRef<'ast> { + fn from(node: &'ast UpdateExpr) -> Self { + NodeRef::UpdateExpr(node) + } +} +impl<'ast> From<&'ast UpdateOp> for NodeRef<'ast> { + fn from(node: &'ast UpdateOp) -> Self { + NodeRef::UpdateOp(node) + } +} +impl<'ast> From<&'ast UsingDecl> for NodeRef<'ast> { + fn from(node: &'ast UsingDecl) -> Self { + NodeRef::UsingDecl(node) + } +} +impl<'ast> From<&'ast VarDecl> for NodeRef<'ast> { + fn from(node: &'ast VarDecl) -> Self { + NodeRef::VarDecl(node) + } +} +impl<'ast> From<&'ast VarDeclKind> for NodeRef<'ast> { + fn from(node: &'ast VarDeclKind) -> Self { + NodeRef::VarDeclKind(node) + } +} +impl<'ast> From<&'ast VarDeclOrExpr> for NodeRef<'ast> { + fn from(node: &'ast VarDeclOrExpr) -> Self { + NodeRef::VarDeclOrExpr(node) + } +} +impl<'ast> From<&'ast VarDeclarator> for NodeRef<'ast> { + fn from(node: &'ast VarDeclarator) -> Self { + NodeRef::VarDeclarator(node) + } +} +impl<'ast> From<&'ast WhileStmt> for NodeRef<'ast> { + fn from(node: &'ast WhileStmt) -> Self { + NodeRef::WhileStmt(node) + } +} +impl<'ast> From<&'ast WithStmt> for NodeRef<'ast> { + fn from(node: &'ast WithStmt) -> Self { + NodeRef::WithStmt(node) + } +} +impl<'ast> From<&'ast YieldExpr> for NodeRef<'ast> { + fn from(node: &'ast YieldExpr) -> Self { + NodeRef::YieldExpr(node) + } +} +#[derive(Debug, Clone, Copy)] +pub enum NodeRef<'ast> { + Accessibility(&'ast Accessibility), + ArrayLit(&'ast ArrayLit), + ArrayPat(&'ast ArrayPat), + ArrowExpr(&'ast ArrowExpr), + AssignExpr(&'ast AssignExpr), + AssignOp(&'ast AssignOp), + AssignPat(&'ast AssignPat), + AssignPatProp(&'ast AssignPatProp), + AssignProp(&'ast AssignProp), + AssignTarget(&'ast AssignTarget), + AssignTargetPat(&'ast AssignTargetPat), + AutoAccessor(&'ast AutoAccessor), + AwaitExpr(&'ast AwaitExpr), + BigInt(&'ast BigInt), + BinExpr(&'ast BinExpr), + BinaryOp(&'ast BinaryOp), + BindingIdent(&'ast BindingIdent), + BlockStmt(&'ast BlockStmt), + BlockStmtOrExpr(&'ast BlockStmtOrExpr), + Bool(&'ast Bool), + BreakStmt(&'ast BreakStmt), + CallExpr(&'ast CallExpr), + Callee(&'ast Callee), + CatchClause(&'ast CatchClause), + Class(&'ast Class), + ClassDecl(&'ast ClassDecl), + ClassExpr(&'ast ClassExpr), + ClassMember(&'ast ClassMember), + ClassMethod(&'ast ClassMethod), + ClassProp(&'ast ClassProp), + ComputedPropName(&'ast ComputedPropName), + CondExpr(&'ast CondExpr), + Constructor(&'ast Constructor), + ContinueStmt(&'ast ContinueStmt), + DebuggerStmt(&'ast DebuggerStmt), + Decl(&'ast Decl), + Decorator(&'ast Decorator), + DefaultDecl(&'ast DefaultDecl), + DoWhileStmt(&'ast DoWhileStmt), + EmptyStmt(&'ast EmptyStmt), + EsVersion(&'ast EsVersion), + ExportAll(&'ast ExportAll), + ExportDecl(&'ast ExportDecl), + ExportDefaultDecl(&'ast ExportDefaultDecl), + ExportDefaultExpr(&'ast ExportDefaultExpr), + ExportDefaultSpecifier(&'ast ExportDefaultSpecifier), + ExportNamedSpecifier(&'ast ExportNamedSpecifier), + ExportNamespaceSpecifier(&'ast ExportNamespaceSpecifier), + ExportSpecifier(&'ast ExportSpecifier), + Expr(&'ast Expr), + ExprOrSpread(&'ast ExprOrSpread), + ExprStmt(&'ast ExprStmt), + FnDecl(&'ast FnDecl), + FnExpr(&'ast FnExpr), + ForHead(&'ast ForHead), + ForInStmt(&'ast ForInStmt), + ForOfStmt(&'ast ForOfStmt), + ForStmt(&'ast ForStmt), + Function(&'ast Function), + GetterProp(&'ast GetterProp), + Ident(&'ast Ident), + IdentName(&'ast IdentName), + IfStmt(&'ast IfStmt), + Import(&'ast Import), + ImportDecl(&'ast ImportDecl), + ImportDefaultSpecifier(&'ast ImportDefaultSpecifier), + ImportNamedSpecifier(&'ast ImportNamedSpecifier), + ImportPhase(&'ast ImportPhase), + ImportSpecifier(&'ast ImportSpecifier), + ImportStarAsSpecifier(&'ast ImportStarAsSpecifier), + ImportWith(&'ast ImportWith), + ImportWithItem(&'ast ImportWithItem), + Invalid(&'ast Invalid), + JSXAttr(&'ast JSXAttr), + JSXAttrName(&'ast JSXAttrName), + JSXAttrOrSpread(&'ast JSXAttrOrSpread), + JSXAttrValue(&'ast JSXAttrValue), + JSXClosingElement(&'ast JSXClosingElement), + JSXClosingFragment(&'ast JSXClosingFragment), + JSXElement(&'ast JSXElement), + JSXElementChild(&'ast JSXElementChild), + JSXElementName(&'ast JSXElementName), + JSXEmptyExpr(&'ast JSXEmptyExpr), + JSXExpr(&'ast JSXExpr), + JSXExprContainer(&'ast JSXExprContainer), + JSXFragment(&'ast JSXFragment), + JSXMemberExpr(&'ast JSXMemberExpr), + JSXNamespacedName(&'ast JSXNamespacedName), + JSXObject(&'ast JSXObject), + JSXOpeningElement(&'ast JSXOpeningElement), + JSXOpeningFragment(&'ast JSXOpeningFragment), + JSXSpreadChild(&'ast JSXSpreadChild), + JSXText(&'ast JSXText), + Key(&'ast Key), + KeyValuePatProp(&'ast KeyValuePatProp), + KeyValueProp(&'ast KeyValueProp), + LabeledStmt(&'ast LabeledStmt), + Lit(&'ast Lit), + MemberExpr(&'ast MemberExpr), + MemberProp(&'ast MemberProp), + MetaPropExpr(&'ast MetaPropExpr), + MetaPropKind(&'ast MetaPropKind), + MethodKind(&'ast MethodKind), + MethodProp(&'ast MethodProp), + Module(&'ast Module), + ModuleDecl(&'ast ModuleDecl), + ModuleExportName(&'ast ModuleExportName), + ModuleItem(&'ast ModuleItem), + NamedExport(&'ast NamedExport), + NewExpr(&'ast NewExpr), + Null(&'ast Null), + Number(&'ast Number), + ObjectLit(&'ast ObjectLit), + ObjectPat(&'ast ObjectPat), + ObjectPatProp(&'ast ObjectPatProp), + OptCall(&'ast OptCall), + OptChainBase(&'ast OptChainBase), + OptChainExpr(&'ast OptChainExpr), + Param(&'ast Param), + ParamOrTsParamProp(&'ast ParamOrTsParamProp), + ParenExpr(&'ast ParenExpr), + Pat(&'ast Pat), + PrivateMethod(&'ast PrivateMethod), + PrivateName(&'ast PrivateName), + PrivateProp(&'ast PrivateProp), + Program(&'ast Program), + Prop(&'ast Prop), + PropName(&'ast PropName), + PropOrSpread(&'ast PropOrSpread), + Regex(&'ast Regex), + RestPat(&'ast RestPat), + ReturnStmt(&'ast ReturnStmt), + Script(&'ast Script), + SeqExpr(&'ast SeqExpr), + SetterProp(&'ast SetterProp), + SimpleAssignTarget(&'ast SimpleAssignTarget), + SpreadElement(&'ast SpreadElement), + StaticBlock(&'ast StaticBlock), + Stmt(&'ast Stmt), + Str(&'ast Str), + Super(&'ast Super), + SuperProp(&'ast SuperProp), + SuperPropExpr(&'ast SuperPropExpr), + SwitchCase(&'ast SwitchCase), + SwitchStmt(&'ast SwitchStmt), + TaggedTpl(&'ast TaggedTpl), + ThisExpr(&'ast ThisExpr), + ThrowStmt(&'ast ThrowStmt), + Tpl(&'ast Tpl), + TplElement(&'ast TplElement), + TruePlusMinus(&'ast TruePlusMinus), + TryStmt(&'ast TryStmt), + TsArrayType(&'ast TsArrayType), + TsAsExpr(&'ast TsAsExpr), + TsCallSignatureDecl(&'ast TsCallSignatureDecl), + TsConditionalType(&'ast TsConditionalType), + TsConstAssertion(&'ast TsConstAssertion), + TsConstructSignatureDecl(&'ast TsConstructSignatureDecl), + TsConstructorType(&'ast TsConstructorType), + TsEntityName(&'ast TsEntityName), + TsEnumDecl(&'ast TsEnumDecl), + TsEnumMember(&'ast TsEnumMember), + TsEnumMemberId(&'ast TsEnumMemberId), + TsExportAssignment(&'ast TsExportAssignment), + TsExprWithTypeArgs(&'ast TsExprWithTypeArgs), + TsExternalModuleRef(&'ast TsExternalModuleRef), + TsFnOrConstructorType(&'ast TsFnOrConstructorType), + TsFnParam(&'ast TsFnParam), + TsFnType(&'ast TsFnType), + TsGetterSignature(&'ast TsGetterSignature), + TsImportEqualsDecl(&'ast TsImportEqualsDecl), + TsImportType(&'ast TsImportType), + TsIndexSignature(&'ast TsIndexSignature), + TsIndexedAccessType(&'ast TsIndexedAccessType), + TsInferType(&'ast TsInferType), + TsInstantiation(&'ast TsInstantiation), + TsInterfaceBody(&'ast TsInterfaceBody), + TsInterfaceDecl(&'ast TsInterfaceDecl), + TsIntersectionType(&'ast TsIntersectionType), + TsKeywordType(&'ast TsKeywordType), + TsKeywordTypeKind(&'ast TsKeywordTypeKind), + TsLit(&'ast TsLit), + TsLitType(&'ast TsLitType), + TsMappedType(&'ast TsMappedType), + TsMethodSignature(&'ast TsMethodSignature), + TsModuleBlock(&'ast TsModuleBlock), + TsModuleDecl(&'ast TsModuleDecl), + TsModuleName(&'ast TsModuleName), + TsModuleRef(&'ast TsModuleRef), + TsNamespaceBody(&'ast TsNamespaceBody), + TsNamespaceDecl(&'ast TsNamespaceDecl), + TsNamespaceExportDecl(&'ast TsNamespaceExportDecl), + TsNonNullExpr(&'ast TsNonNullExpr), + TsOptionalType(&'ast TsOptionalType), + TsParamProp(&'ast TsParamProp), + TsParamPropParam(&'ast TsParamPropParam), + TsParenthesizedType(&'ast TsParenthesizedType), + TsPropertySignature(&'ast TsPropertySignature), + TsQualifiedName(&'ast TsQualifiedName), + TsRestType(&'ast TsRestType), + TsSatisfiesExpr(&'ast TsSatisfiesExpr), + TsSetterSignature(&'ast TsSetterSignature), + TsThisType(&'ast TsThisType), + TsThisTypeOrIdent(&'ast TsThisTypeOrIdent), + TsTplLitType(&'ast TsTplLitType), + TsTupleElement(&'ast TsTupleElement), + TsTupleType(&'ast TsTupleType), + TsType(&'ast TsType), + TsTypeAliasDecl(&'ast TsTypeAliasDecl), + TsTypeAnn(&'ast TsTypeAnn), + TsTypeAssertion(&'ast TsTypeAssertion), + TsTypeElement(&'ast TsTypeElement), + TsTypeLit(&'ast TsTypeLit), + TsTypeOperator(&'ast TsTypeOperator), + TsTypeOperatorOp(&'ast TsTypeOperatorOp), + TsTypeParam(&'ast TsTypeParam), + TsTypeParamDecl(&'ast TsTypeParamDecl), + TsTypeParamInstantiation(&'ast TsTypeParamInstantiation), + TsTypePredicate(&'ast TsTypePredicate), + TsTypeQuery(&'ast TsTypeQuery), + TsTypeQueryExpr(&'ast TsTypeQueryExpr), + TsTypeRef(&'ast TsTypeRef), + TsUnionOrIntersectionType(&'ast TsUnionOrIntersectionType), + TsUnionType(&'ast TsUnionType), + UnaryExpr(&'ast UnaryExpr), + UnaryOp(&'ast UnaryOp), + UpdateExpr(&'ast UpdateExpr), + UpdateOp(&'ast UpdateOp), + UsingDecl(&'ast UsingDecl), + VarDecl(&'ast VarDecl), + VarDeclKind(&'ast VarDeclKind), + VarDeclOrExpr(&'ast VarDeclOrExpr), + VarDeclarator(&'ast VarDeclarator), + WhileStmt(&'ast WhileStmt), + WithStmt(&'ast WithStmt), + YieldExpr(&'ast YieldExpr), +} +impl<'ast> NodeRef<'ast> { + #[allow(unreachable_patterns)] + pub fn raw_children(&'ast self) -> Box>> { + match self { + NodeRef::Accessibility(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ArrayLit(node) => { + let iterator = ::std::iter::empty::>().chain( + node.elems.iter().flat_map(|item| { + item.iter() + .flat_map(|item| ::std::iter::once(NodeRef::ExprOrSpread(&item))) + }), + ); + Box::new(iterator) + } + NodeRef::ArrayPat(node) => { + let iterator = ::std::iter::empty::>() + .chain(node.elems.iter().flat_map(|item| { + item.iter() + .flat_map(|item| ::std::iter::once(NodeRef::Pat(&item))) + })) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::ArrowExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Pat(&item))), + ) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::BlockStmtOrExpr(&item)) + }) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain(node.return_type.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::AssignExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::AssignOp(&node.op))) + .chain(::std::iter::once(NodeRef::AssignTarget(&node.left))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::AssignOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AssignPat(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::Pat(&item)) + }) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::AssignPatProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::BindingIdent(&node.key))) + .chain(node.value.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })); + Box::new(iterator) + } + NodeRef::AssignProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.key))) + .chain({ + let item = &*node.value; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::AssignTarget(node) => match node { + AssignTarget::Simple(v0) => { + Box::new(::std::iter::once(NodeRef::SimpleAssignTarget(v0))) + } + AssignTarget::Pat(v0) => Box::new(::std::iter::once(NodeRef::AssignTargetPat(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AssignTargetPat(node) => match node { + AssignTargetPat::Array(v0) => Box::new(::std::iter::once(NodeRef::ArrayPat(v0))), + AssignTargetPat::Object(v0) => Box::new(::std::iter::once(NodeRef::ObjectPat(v0))), + AssignTargetPat::Invalid(v0) => Box::new(::std::iter::once(NodeRef::Invalid(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::AutoAccessor(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Key(&node.key))) + .chain(node.value.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::AwaitExpr(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.arg; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::BigInt(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::BinExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::BinaryOp(&node.op))) + .chain({ + let item = &*node.left; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::BinaryOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::BindingIdent(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::BlockStmt(node) => { + let iterator = ::std::iter::empty::>().chain( + node.stmts + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Stmt(&item))), + ); + Box::new(iterator) + } + NodeRef::BlockStmtOrExpr(node) => match node { + BlockStmtOrExpr::BlockStmt(v0) => { + Box::new(::std::iter::once(NodeRef::BlockStmt(v0))) + } + BlockStmtOrExpr::Expr(v0) => Box::new(::std::iter::once(NodeRef::Expr(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Bool(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::BreakStmt(node) => { + let iterator = ::std::iter::empty::>().chain( + node.label + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ); + Box::new(iterator) + } + NodeRef::CallExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Callee(&node.callee))) + .chain( + node.args + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ExprOrSpread(&item))), + ) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::Callee(node) => match node { + Callee::Super(v0) => Box::new(::std::iter::once(NodeRef::Super(v0))), + Callee::Import(v0) => Box::new(::std::iter::once(NodeRef::Import(v0))), + Callee::Expr(v0) => Box::new(::std::iter::once(NodeRef::Expr(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::CatchClause(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.param + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Pat(&item))), + ) + .chain(::std::iter::once(NodeRef::BlockStmt(&node.body))); + Box::new(iterator) + } + NodeRef::Class(node) => { + let iterator = + ::std::iter::empty::>() + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ClassMember(&item))), + ) + .chain(node.super_class.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain(node.super_type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })) + .chain(node.implements.iter().flat_map(|item| { + ::std::iter::once(NodeRef::TsExprWithTypeArgs(&item)) + })); + Box::new(iterator) + } + NodeRef::ClassDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.ident))) + .chain({ + let item = &*node.class; + ::std::iter::once(NodeRef::Class(&item)) + }); + Box::new(iterator) + } + NodeRef::ClassExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.ident + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.class; + ::std::iter::once(NodeRef::Class(&item)) + }); + Box::new(iterator) + } + NodeRef::ClassMember(node) => match node { + ClassMember::Constructor(v0) => { + Box::new(::std::iter::once(NodeRef::Constructor(v0))) + } + ClassMember::Method(v0) => Box::new(::std::iter::once(NodeRef::ClassMethod(v0))), + ClassMember::PrivateMethod(v0) => { + Box::new(::std::iter::once(NodeRef::PrivateMethod(v0))) + } + ClassMember::ClassProp(v0) => Box::new(::std::iter::once(NodeRef::ClassProp(v0))), + ClassMember::PrivateProp(v0) => { + Box::new(::std::iter::once(NodeRef::PrivateProp(v0))) + } + ClassMember::TsIndexSignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsIndexSignature(v0))) + } + ClassMember::Empty(v0) => Box::new(::std::iter::once(NodeRef::EmptyStmt(v0))), + ClassMember::StaticBlock(v0) => { + Box::new(::std::iter::once(NodeRef::StaticBlock(v0))) + } + ClassMember::AutoAccessor(v0) => { + Box::new(::std::iter::once(NodeRef::AutoAccessor(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ClassMethod(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain({ + let item = &*node.function; + ::std::iter::once(NodeRef::Function(&item)) + }) + .chain(::std::iter::once(NodeRef::MethodKind(&node.kind))) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::ClassProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain(node.value.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::ComputedPropName(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::CondExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.test; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.cons; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.alt; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::Constructor(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ParamOrTsParamProp(&item))), + ) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::BlockStmt(&item))), + ) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::ContinueStmt(node) => { + let iterator = ::std::iter::empty::>().chain( + node.label + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ); + Box::new(iterator) + } + NodeRef::DebuggerStmt(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Decl(node) => match node { + Decl::Class(v0) => Box::new(::std::iter::once(NodeRef::ClassDecl(v0))), + Decl::Fn(v0) => Box::new(::std::iter::once(NodeRef::FnDecl(v0))), + Decl::Var(v0) => Box::new(::std::iter::once(NodeRef::VarDecl(v0))), + Decl::Using(v0) => Box::new(::std::iter::once(NodeRef::UsingDecl(v0))), + Decl::TsInterface(v0) => Box::new(::std::iter::once(NodeRef::TsInterfaceDecl(v0))), + Decl::TsTypeAlias(v0) => Box::new(::std::iter::once(NodeRef::TsTypeAliasDecl(v0))), + Decl::TsEnum(v0) => Box::new(::std::iter::once(NodeRef::TsEnumDecl(v0))), + Decl::TsModule(v0) => Box::new(::std::iter::once(NodeRef::TsModuleDecl(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Decorator(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::DefaultDecl(node) => match node { + DefaultDecl::Class(v0) => Box::new(::std::iter::once(NodeRef::ClassExpr(v0))), + DefaultDecl::Fn(v0) => Box::new(::std::iter::once(NodeRef::FnExpr(v0))), + DefaultDecl::TsInterfaceDecl(v0) => { + Box::new(::std::iter::once(NodeRef::TsInterfaceDecl(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::DoWhileStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.test; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::EmptyStmt(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::EsVersion(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ExportAll(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.src; + ::std::iter::once(NodeRef::Str(&item)) + }) + .chain(node.with.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::ObjectLit(&item)) + })); + Box::new(iterator) + } + NodeRef::ExportDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Decl(&node.decl))); + Box::new(iterator) + } + NodeRef::ExportDefaultDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::DefaultDecl(&node.decl))); + Box::new(iterator) + } + NodeRef::ExportDefaultExpr(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::ExportDefaultSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.exported))); + Box::new(iterator) + } + NodeRef::ExportNamedSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ModuleExportName(&node.orig))) + .chain( + node.exported + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ModuleExportName(&item))), + ); + Box::new(iterator) + } + NodeRef::ExportNamespaceSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ModuleExportName(&node.name))); + Box::new(iterator) + } + NodeRef::ExportSpecifier(node) => match node { + ExportSpecifier::Namespace(v0) => { + Box::new(::std::iter::once(NodeRef::ExportNamespaceSpecifier(v0))) + } + ExportSpecifier::Default(v0) => { + Box::new(::std::iter::once(NodeRef::ExportDefaultSpecifier(v0))) + } + ExportSpecifier::Named(v0) => { + Box::new(::std::iter::once(NodeRef::ExportNamedSpecifier(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Expr(node) => match node { + Expr::This(v0) => Box::new(::std::iter::once(NodeRef::ThisExpr(v0))), + Expr::Array(v0) => Box::new(::std::iter::once(NodeRef::ArrayLit(v0))), + Expr::Object(v0) => Box::new(::std::iter::once(NodeRef::ObjectLit(v0))), + Expr::Fn(v0) => Box::new(::std::iter::once(NodeRef::FnExpr(v0))), + Expr::Unary(v0) => Box::new(::std::iter::once(NodeRef::UnaryExpr(v0))), + Expr::Update(v0) => Box::new(::std::iter::once(NodeRef::UpdateExpr(v0))), + Expr::Bin(v0) => Box::new(::std::iter::once(NodeRef::BinExpr(v0))), + Expr::Assign(v0) => Box::new(::std::iter::once(NodeRef::AssignExpr(v0))), + Expr::Member(v0) => Box::new(::std::iter::once(NodeRef::MemberExpr(v0))), + Expr::SuperProp(v0) => Box::new(::std::iter::once(NodeRef::SuperPropExpr(v0))), + Expr::Cond(v0) => Box::new(::std::iter::once(NodeRef::CondExpr(v0))), + Expr::Call(v0) => Box::new(::std::iter::once(NodeRef::CallExpr(v0))), + Expr::New(v0) => Box::new(::std::iter::once(NodeRef::NewExpr(v0))), + Expr::Seq(v0) => Box::new(::std::iter::once(NodeRef::SeqExpr(v0))), + Expr::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + Expr::Lit(v0) => Box::new(::std::iter::once(NodeRef::Lit(v0))), + Expr::Tpl(v0) => Box::new(::std::iter::once(NodeRef::Tpl(v0))), + Expr::TaggedTpl(v0) => Box::new(::std::iter::once(NodeRef::TaggedTpl(v0))), + Expr::Arrow(v0) => Box::new(::std::iter::once(NodeRef::ArrowExpr(v0))), + Expr::Class(v0) => Box::new(::std::iter::once(NodeRef::ClassExpr(v0))), + Expr::Yield(v0) => Box::new(::std::iter::once(NodeRef::YieldExpr(v0))), + Expr::MetaProp(v0) => Box::new(::std::iter::once(NodeRef::MetaPropExpr(v0))), + Expr::Await(v0) => Box::new(::std::iter::once(NodeRef::AwaitExpr(v0))), + Expr::Paren(v0) => Box::new(::std::iter::once(NodeRef::ParenExpr(v0))), + Expr::JSXMember(v0) => Box::new(::std::iter::once(NodeRef::JSXMemberExpr(v0))), + Expr::JSXNamespacedName(v0) => { + Box::new(::std::iter::once(NodeRef::JSXNamespacedName(v0))) + } + Expr::JSXEmpty(v0) => Box::new(::std::iter::once(NodeRef::JSXEmptyExpr(v0))), + Expr::JSXElement(v0) => Box::new(::std::iter::once(NodeRef::JSXElement(v0))), + Expr::JSXFragment(v0) => Box::new(::std::iter::once(NodeRef::JSXFragment(v0))), + Expr::TsTypeAssertion(v0) => { + Box::new(::std::iter::once(NodeRef::TsTypeAssertion(v0))) + } + Expr::TsConstAssertion(v0) => { + Box::new(::std::iter::once(NodeRef::TsConstAssertion(v0))) + } + Expr::TsNonNull(v0) => Box::new(::std::iter::once(NodeRef::TsNonNullExpr(v0))), + Expr::TsAs(v0) => Box::new(::std::iter::once(NodeRef::TsAsExpr(v0))), + Expr::TsInstantiation(v0) => { + Box::new(::std::iter::once(NodeRef::TsInstantiation(v0))) + } + Expr::TsSatisfies(v0) => Box::new(::std::iter::once(NodeRef::TsSatisfiesExpr(v0))), + Expr::PrivateName(v0) => Box::new(::std::iter::once(NodeRef::PrivateName(v0))), + Expr::OptChain(v0) => Box::new(::std::iter::once(NodeRef::OptChainExpr(v0))), + Expr::Invalid(v0) => Box::new(::std::iter::once(NodeRef::Invalid(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ExprOrSpread(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::ExprStmt(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::FnDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.ident))) + .chain({ + let item = &*node.function; + ::std::iter::once(NodeRef::Function(&item)) + }); + Box::new(iterator) + } + NodeRef::FnExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.ident + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Ident(&item))), + ) + .chain({ + let item = &*node.function; + ::std::iter::once(NodeRef::Function(&item)) + }); + Box::new(iterator) + } + NodeRef::ForHead(node) => match node { + ForHead::VarDecl(v0) => Box::new(::std::iter::once(NodeRef::VarDecl(v0))), + ForHead::UsingDecl(v0) => Box::new(::std::iter::once(NodeRef::UsingDecl(v0))), + ForHead::Pat(v0) => Box::new(::std::iter::once(NodeRef::Pat(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ForInStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ForHead(&node.left))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::ForOfStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ForHead(&node.left))) + .chain({ + let item = &*node.right; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::ForStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.init + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::VarDeclOrExpr(&item))), + ) + .chain(node.test.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain(node.update.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::Function(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Param(&item))), + ) + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::BlockStmt(&item))), + ) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain(node.return_type.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::GetterProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::BlockStmt(&item))), + ); + Box::new(iterator) + } + NodeRef::Ident(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::IdentName(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::IfStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.test; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.cons; + ::std::iter::once(NodeRef::Stmt(&item)) + }) + .chain(node.alt.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Stmt(&item)) + })); + Box::new(iterator) + } + NodeRef::Import(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::ImportPhase(&node.phase))); + Box::new(iterator) + } + NodeRef::ImportDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.specifiers + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ImportSpecifier(&item))), + ) + .chain({ + let item = &*node.src; + ::std::iter::once(NodeRef::Str(&item)) + }) + .chain(node.with.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::ObjectLit(&item)) + })) + .chain(::std::iter::once(NodeRef::ImportPhase(&node.phase))); + Box::new(iterator) + } + NodeRef::ImportDefaultSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.local))); + Box::new(iterator) + } + NodeRef::ImportNamedSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.local))) + .chain( + node.imported + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ModuleExportName(&item))), + ); + Box::new(iterator) + } + NodeRef::ImportPhase(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ImportSpecifier(node) => match node { + ImportSpecifier::Named(v0) => { + Box::new(::std::iter::once(NodeRef::ImportNamedSpecifier(v0))) + } + ImportSpecifier::Default(v0) => { + Box::new(::std::iter::once(NodeRef::ImportDefaultSpecifier(v0))) + } + ImportSpecifier::Namespace(v0) => { + Box::new(::std::iter::once(NodeRef::ImportStarAsSpecifier(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ImportStarAsSpecifier(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.local))); + Box::new(iterator) + } + NodeRef::ImportWith(node) => { + let iterator = ::std::iter::empty::>().chain( + node.values + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ImportWithItem(&item))), + ); + Box::new(iterator) + } + NodeRef::ImportWithItem(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::IdentName(&node.key))) + .chain(::std::iter::once(NodeRef::Str(&node.value))); + Box::new(iterator) + } + NodeRef::Invalid(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::JSXAttr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXAttrName(&node.name))) + .chain( + node.value + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::JSXAttrValue(&item))), + ); + Box::new(iterator) + } + NodeRef::JSXAttrName(node) => match node { + JSXAttrName::Ident(v0) => Box::new(::std::iter::once(NodeRef::IdentName(v0))), + JSXAttrName::JSXNamespacedName(v0) => { + Box::new(::std::iter::once(NodeRef::JSXNamespacedName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXAttrOrSpread(node) => match node { + JSXAttrOrSpread::JSXAttr(v0) => Box::new(::std::iter::once(NodeRef::JSXAttr(v0))), + JSXAttrOrSpread::SpreadElement(v0) => { + Box::new(::std::iter::once(NodeRef::SpreadElement(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXAttrValue(node) => match node { + JSXAttrValue::Lit(v0) => Box::new(::std::iter::once(NodeRef::Lit(v0))), + JSXAttrValue::JSXExprContainer(v0) => { + Box::new(::std::iter::once(NodeRef::JSXExprContainer(v0))) + } + JSXAttrValue::JSXElement(v0) => { + Box::new(::std::iter::once(NodeRef::JSXElement(v0))) + } + JSXAttrValue::JSXFragment(v0) => { + Box::new(::std::iter::once(NodeRef::JSXFragment(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXClosingElement(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXElementName(&node.name))); + Box::new(iterator) + } + NodeRef::JSXClosingFragment(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::JSXElement(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXOpeningElement(&node.opening))) + .chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::JSXElementChild(&item))), + ) + .chain( + node.closing + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::JSXClosingElement(&item))), + ); + Box::new(iterator) + } + NodeRef::JSXElementChild(node) => match node { + JSXElementChild::JSXText(v0) => Box::new(::std::iter::once(NodeRef::JSXText(v0))), + JSXElementChild::JSXExprContainer(v0) => { + Box::new(::std::iter::once(NodeRef::JSXExprContainer(v0))) + } + JSXElementChild::JSXSpreadChild(v0) => { + Box::new(::std::iter::once(NodeRef::JSXSpreadChild(v0))) + } + JSXElementChild::JSXElement(v0) => { + Box::new(::std::iter::once(NodeRef::JSXElement(v0))) + } + JSXElementChild::JSXFragment(v0) => { + Box::new(::std::iter::once(NodeRef::JSXFragment(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXElementName(node) => match node { + JSXElementName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + JSXElementName::JSXMemberExpr(v0) => { + Box::new(::std::iter::once(NodeRef::JSXMemberExpr(v0))) + } + JSXElementName::JSXNamespacedName(v0) => { + Box::new(::std::iter::once(NodeRef::JSXNamespacedName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXEmptyExpr(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::JSXExpr(node) => match node { + JSXExpr::JSXEmptyExpr(v0) => Box::new(::std::iter::once(NodeRef::JSXEmptyExpr(v0))), + JSXExpr::Expr(v0) => Box::new(::std::iter::once(NodeRef::Expr(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXExprContainer(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXExpr(&node.expr))); + Box::new(iterator) + } + NodeRef::JSXFragment(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXOpeningFragment( + &node.opening, + ))) + .chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::JSXElementChild(&item))), + ) + .chain(::std::iter::once(NodeRef::JSXClosingFragment( + &node.closing, + ))); + Box::new(iterator) + } + NodeRef::JSXMemberExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXObject(&node.obj))) + .chain(::std::iter::once(NodeRef::IdentName(&node.prop))); + Box::new(iterator) + } + NodeRef::JSXNamespacedName(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::IdentName(&node.ns))) + .chain(::std::iter::once(NodeRef::IdentName(&node.name))); + Box::new(iterator) + } + NodeRef::JSXObject(node) => match node { + JSXObject::JSXMemberExpr(v0) => { + Box::new(::std::iter::once(NodeRef::JSXMemberExpr(v0))) + } + JSXObject::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::JSXOpeningElement(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::JSXElementName(&node.name))) + .chain( + node.attrs + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::JSXAttrOrSpread(&item))), + ) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::JSXOpeningFragment(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::JSXSpreadChild(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::JSXText(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Key(node) => match node { + Key::Private(v0) => Box::new(::std::iter::once(NodeRef::PrivateName(v0))), + Key::Public(v0) => Box::new(::std::iter::once(NodeRef::PropName(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::KeyValuePatProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain({ + let item = &*node.value; + ::std::iter::once(NodeRef::Pat(&item)) + }); + Box::new(iterator) + } + NodeRef::KeyValueProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain({ + let item = &*node.value; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::LabeledStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.label))) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::Lit(node) => match node { + Lit::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + Lit::Bool(v0) => Box::new(::std::iter::once(NodeRef::Bool(v0))), + Lit::Null(v0) => Box::new(::std::iter::once(NodeRef::Null(v0))), + Lit::Num(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + Lit::BigInt(v0) => Box::new(::std::iter::once(NodeRef::BigInt(v0))), + Lit::Regex(v0) => Box::new(::std::iter::once(NodeRef::Regex(v0))), + Lit::JSXText(v0) => Box::new(::std::iter::once(NodeRef::JSXText(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MemberExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.obj; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(::std::iter::once(NodeRef::MemberProp(&node.prop))); + Box::new(iterator) + } + NodeRef::MemberProp(node) => match node { + MemberProp::Ident(v0) => Box::new(::std::iter::once(NodeRef::IdentName(v0))), + MemberProp::PrivateName(v0) => { + Box::new(::std::iter::once(NodeRef::PrivateName(v0))) + } + MemberProp::Computed(v0) => { + Box::new(::std::iter::once(NodeRef::ComputedPropName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MetaPropExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::MetaPropKind(&node.kind))); + Box::new(iterator) + } + NodeRef::MetaPropKind(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MethodKind(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::MethodProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain({ + let item = &*node.function; + ::std::iter::once(NodeRef::Function(&item)) + }); + Box::new(iterator) + } + NodeRef::Module(node) => { + let iterator = ::std::iter::empty::>().chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ModuleItem(&item))), + ); + Box::new(iterator) + } + NodeRef::ModuleDecl(node) => match node { + ModuleDecl::Import(v0) => Box::new(::std::iter::once(NodeRef::ImportDecl(v0))), + ModuleDecl::ExportDecl(v0) => Box::new(::std::iter::once(NodeRef::ExportDecl(v0))), + ModuleDecl::ExportNamed(v0) => { + Box::new(::std::iter::once(NodeRef::NamedExport(v0))) + } + ModuleDecl::ExportDefaultDecl(v0) => { + Box::new(::std::iter::once(NodeRef::ExportDefaultDecl(v0))) + } + ModuleDecl::ExportDefaultExpr(v0) => { + Box::new(::std::iter::once(NodeRef::ExportDefaultExpr(v0))) + } + ModuleDecl::ExportAll(v0) => Box::new(::std::iter::once(NodeRef::ExportAll(v0))), + ModuleDecl::TsImportEquals(v0) => { + Box::new(::std::iter::once(NodeRef::TsImportEqualsDecl(v0))) + } + ModuleDecl::TsExportAssignment(v0) => { + Box::new(::std::iter::once(NodeRef::TsExportAssignment(v0))) + } + ModuleDecl::TsNamespaceExport(v0) => { + Box::new(::std::iter::once(NodeRef::TsNamespaceExportDecl(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ModuleExportName(node) => match node { + ModuleExportName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + ModuleExportName::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ModuleItem(node) => match node { + ModuleItem::ModuleDecl(v0) => Box::new(::std::iter::once(NodeRef::ModuleDecl(v0))), + ModuleItem::Stmt(v0) => Box::new(::std::iter::once(NodeRef::Stmt(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::NamedExport(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.specifiers + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ExportSpecifier(&item))), + ) + .chain(node.src.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Str(&item)) + })) + .chain(node.with.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::ObjectLit(&item)) + })); + Box::new(iterator) + } + NodeRef::NewExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.callee; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(node.args.iter().flat_map(|item| { + item.iter() + .flat_map(|item| ::std::iter::once(NodeRef::ExprOrSpread(&item))) + })) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::Null(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Number(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::ObjectLit(node) => { + let iterator = ::std::iter::empty::>().chain( + node.props + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::PropOrSpread(&item))), + ); + Box::new(iterator) + } + NodeRef::ObjectPat(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.props + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ObjectPatProp(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::ObjectPatProp(node) => match node { + ObjectPatProp::KeyValue(v0) => { + Box::new(::std::iter::once(NodeRef::KeyValuePatProp(v0))) + } + ObjectPatProp::Assign(v0) => { + Box::new(::std::iter::once(NodeRef::AssignPatProp(v0))) + } + ObjectPatProp::Rest(v0) => Box::new(::std::iter::once(NodeRef::RestPat(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::OptCall(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.callee; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain( + node.args + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ExprOrSpread(&item))), + ) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::OptChainBase(node) => match node { + OptChainBase::Member(v0) => Box::new(::std::iter::once(NodeRef::MemberExpr(v0))), + OptChainBase::Call(v0) => Box::new(::std::iter::once(NodeRef::OptCall(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::OptChainExpr(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.base; + ::std::iter::once(NodeRef::OptChainBase(&item)) + }); + Box::new(iterator) + } + NodeRef::Param(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain(::std::iter::once(NodeRef::Pat(&node.pat))); + Box::new(iterator) + } + NodeRef::ParamOrTsParamProp(node) => match node { + ParamOrTsParamProp::TsParamProp(v0) => { + Box::new(::std::iter::once(NodeRef::TsParamProp(v0))) + } + ParamOrTsParamProp::Param(v0) => Box::new(::std::iter::once(NodeRef::Param(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ParenExpr(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::Pat(node) => match node { + Pat::Ident(v0) => Box::new(::std::iter::once(NodeRef::BindingIdent(v0))), + Pat::Array(v0) => Box::new(::std::iter::once(NodeRef::ArrayPat(v0))), + Pat::Rest(v0) => Box::new(::std::iter::once(NodeRef::RestPat(v0))), + Pat::Object(v0) => Box::new(::std::iter::once(NodeRef::ObjectPat(v0))), + Pat::Assign(v0) => Box::new(::std::iter::once(NodeRef::AssignPat(v0))), + Pat::Invalid(v0) => Box::new(::std::iter::once(NodeRef::Invalid(v0))), + Pat::Expr(v0) => Box::new(::std::iter::once(NodeRef::Expr(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::PrivateMethod(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PrivateName(&node.key))) + .chain({ + let item = &*node.function; + ::std::iter::once(NodeRef::Function(&item)) + }) + .chain(::std::iter::once(NodeRef::MethodKind(&node.kind))) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::PrivateName(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::PrivateProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PrivateName(&node.key))) + .chain(node.value.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ); + Box::new(iterator) + } + NodeRef::Program(node) => match node { + Program::Module(v0) => Box::new(::std::iter::once(NodeRef::Module(v0))), + Program::Script(v0) => Box::new(::std::iter::once(NodeRef::Script(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Prop(node) => match node { + Prop::Shorthand(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + Prop::KeyValue(v0) => Box::new(::std::iter::once(NodeRef::KeyValueProp(v0))), + Prop::Assign(v0) => Box::new(::std::iter::once(NodeRef::AssignProp(v0))), + Prop::Getter(v0) => Box::new(::std::iter::once(NodeRef::GetterProp(v0))), + Prop::Setter(v0) => Box::new(::std::iter::once(NodeRef::SetterProp(v0))), + Prop::Method(v0) => Box::new(::std::iter::once(NodeRef::MethodProp(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::PropName(node) => match node { + PropName::Ident(v0) => Box::new(::std::iter::once(NodeRef::IdentName(v0))), + PropName::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + PropName::Num(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + PropName::Computed(v0) => { + Box::new(::std::iter::once(NodeRef::ComputedPropName(v0))) + } + PropName::BigInt(v0) => Box::new(::std::iter::once(NodeRef::BigInt(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::PropOrSpread(node) => match node { + PropOrSpread::Spread(v0) => Box::new(::std::iter::once(NodeRef::SpreadElement(v0))), + PropOrSpread::Prop(v0) => Box::new(::std::iter::once(NodeRef::Prop(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Regex(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::RestPat(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.arg; + ::std::iter::once(NodeRef::Pat(&item)) + }) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::ReturnStmt(node) => { + let iterator = + ::std::iter::empty::>().chain(node.arg.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })); + Box::new(iterator) + } + NodeRef::Script(node) => { + let iterator = ::std::iter::empty::>().chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Stmt(&item))), + ); + Box::new(iterator) + } + NodeRef::SeqExpr(node) => { + let iterator = ::std::iter::empty::>().chain( + node.exprs.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + }), + ); + Box::new(iterator) + } + NodeRef::SetterProp(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::PropName(&node.key))) + .chain( + node.this_param + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Pat(&item))), + ) + .chain({ + let item = &*node.param; + ::std::iter::once(NodeRef::Pat(&item)) + }) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::BlockStmt(&item))), + ); + Box::new(iterator) + } + NodeRef::SimpleAssignTarget(node) => match node { + SimpleAssignTarget::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::BindingIdent(v0))) + } + SimpleAssignTarget::Member(v0) => { + Box::new(::std::iter::once(NodeRef::MemberExpr(v0))) + } + SimpleAssignTarget::SuperProp(v0) => { + Box::new(::std::iter::once(NodeRef::SuperPropExpr(v0))) + } + SimpleAssignTarget::Paren(v0) => { + Box::new(::std::iter::once(NodeRef::ParenExpr(v0))) + } + SimpleAssignTarget::OptChain(v0) => { + Box::new(::std::iter::once(NodeRef::OptChainExpr(v0))) + } + SimpleAssignTarget::TsAs(v0) => Box::new(::std::iter::once(NodeRef::TsAsExpr(v0))), + SimpleAssignTarget::TsSatisfies(v0) => { + Box::new(::std::iter::once(NodeRef::TsSatisfiesExpr(v0))) + } + SimpleAssignTarget::TsNonNull(v0) => { + Box::new(::std::iter::once(NodeRef::TsNonNullExpr(v0))) + } + SimpleAssignTarget::TsTypeAssertion(v0) => { + Box::new(::std::iter::once(NodeRef::TsTypeAssertion(v0))) + } + SimpleAssignTarget::TsInstantiation(v0) => { + Box::new(::std::iter::once(NodeRef::TsInstantiation(v0))) + } + SimpleAssignTarget::Invalid(v0) => { + Box::new(::std::iter::once(NodeRef::Invalid(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SpreadElement(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::StaticBlock(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::BlockStmt(&node.body))); + Box::new(iterator) + } + NodeRef::Stmt(node) => match node { + Stmt::Block(v0) => Box::new(::std::iter::once(NodeRef::BlockStmt(v0))), + Stmt::Empty(v0) => Box::new(::std::iter::once(NodeRef::EmptyStmt(v0))), + Stmt::Debugger(v0) => Box::new(::std::iter::once(NodeRef::DebuggerStmt(v0))), + Stmt::With(v0) => Box::new(::std::iter::once(NodeRef::WithStmt(v0))), + Stmt::Return(v0) => Box::new(::std::iter::once(NodeRef::ReturnStmt(v0))), + Stmt::Labeled(v0) => Box::new(::std::iter::once(NodeRef::LabeledStmt(v0))), + Stmt::Break(v0) => Box::new(::std::iter::once(NodeRef::BreakStmt(v0))), + Stmt::Continue(v0) => Box::new(::std::iter::once(NodeRef::ContinueStmt(v0))), + Stmt::If(v0) => Box::new(::std::iter::once(NodeRef::IfStmt(v0))), + Stmt::Switch(v0) => Box::new(::std::iter::once(NodeRef::SwitchStmt(v0))), + Stmt::Throw(v0) => Box::new(::std::iter::once(NodeRef::ThrowStmt(v0))), + Stmt::Try(v0) => Box::new(::std::iter::once(NodeRef::TryStmt(v0))), + Stmt::While(v0) => Box::new(::std::iter::once(NodeRef::WhileStmt(v0))), + Stmt::DoWhile(v0) => Box::new(::std::iter::once(NodeRef::DoWhileStmt(v0))), + Stmt::For(v0) => Box::new(::std::iter::once(NodeRef::ForStmt(v0))), + Stmt::ForIn(v0) => Box::new(::std::iter::once(NodeRef::ForInStmt(v0))), + Stmt::ForOf(v0) => Box::new(::std::iter::once(NodeRef::ForOfStmt(v0))), + Stmt::Decl(v0) => Box::new(::std::iter::once(NodeRef::Decl(v0))), + Stmt::Expr(v0) => Box::new(::std::iter::once(NodeRef::ExprStmt(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Str(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Super(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::SuperProp(node) => match node { + SuperProp::Ident(v0) => Box::new(::std::iter::once(NodeRef::IdentName(v0))), + SuperProp::Computed(v0) => { + Box::new(::std::iter::once(NodeRef::ComputedPropName(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::SuperPropExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Super(&node.obj))) + .chain(::std::iter::once(NodeRef::SuperProp(&node.prop))); + Box::new(iterator) + } + NodeRef::SwitchCase(node) => { + let iterator = ::std::iter::empty::>() + .chain(node.test.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain( + node.cons + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Stmt(&item))), + ); + Box::new(iterator) + } + NodeRef::SwitchStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.discriminant; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain( + node.cases + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::SwitchCase(&item))), + ); + Box::new(iterator) + } + NodeRef::TaggedTpl(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.tag; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })) + .chain({ + let item = &*node.tpl; + ::std::iter::once(NodeRef::Tpl(&item)) + }); + Box::new(iterator) + } + NodeRef::ThisExpr(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::ThrowStmt(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.arg; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::Tpl(node) => { + let iterator = ::std::iter::empty::>() + .chain(node.exprs.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })) + .chain( + node.quasis + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TplElement(&item))), + ); + Box::new(iterator) + } + NodeRef::TplElement(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::TruePlusMinus(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TryStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::BlockStmt(&node.block))) + .chain( + node.handler + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::CatchClause(&item))), + ) + .chain( + node.finalizer + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::BlockStmt(&item))), + ); + Box::new(iterator) + } + NodeRef::TsArrayType(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.elem_type; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsAsExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsCallSignatureDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })); + Box::new(iterator) + } + NodeRef::TsConditionalType(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.check_type; + ::std::iter::once(NodeRef::TsType(&item)) + }) + .chain({ + let item = &*node.extends_type; + ::std::iter::once(NodeRef::TsType(&item)) + }) + .chain({ + let item = &*node.true_type; + ::std::iter::once(NodeRef::TsType(&item)) + }) + .chain({ + let item = &*node.false_type; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsConstAssertion(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::TsConstructSignatureDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })); + Box::new(iterator) + } + NodeRef::TsConstructorType(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + }); + Box::new(iterator) + } + NodeRef::TsEntityName(node) => match node { + TsEntityName::TsQualifiedName(v0) => { + Box::new(::std::iter::once(NodeRef::TsQualifiedName(v0))) + } + TsEntityName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsEnumDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain( + node.members + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsEnumMember(&item))), + ); + Box::new(iterator) + } + NodeRef::TsEnumMember(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsEnumMemberId(&node.id))) + .chain(node.init.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })); + Box::new(iterator) + } + NodeRef::TsEnumMemberId(node) => match node { + TsEnumMemberId::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + TsEnumMemberId::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsExportAssignment(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::TsExprWithTypeArgs(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::TsExternalModuleRef(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Str(&node.expr))); + Box::new(iterator) + } + NodeRef::TsFnOrConstructorType(node) => match node { + TsFnOrConstructorType::TsFnType(v0) => { + Box::new(::std::iter::once(NodeRef::TsFnType(v0))) + } + TsFnOrConstructorType::TsConstructorType(v0) => { + Box::new(::std::iter::once(NodeRef::TsConstructorType(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsFnParam(node) => match node { + TsFnParam::Ident(v0) => Box::new(::std::iter::once(NodeRef::BindingIdent(v0))), + TsFnParam::Array(v0) => Box::new(::std::iter::once(NodeRef::ArrayPat(v0))), + TsFnParam::Rest(v0) => Box::new(::std::iter::once(NodeRef::RestPat(v0))), + TsFnParam::Object(v0) => Box::new(::std::iter::once(NodeRef::ObjectPat(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsFnType(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + }); + Box::new(iterator) + } + NodeRef::TsGetterSignature(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.key; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::TsImportEqualsDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain(::std::iter::once(NodeRef::TsModuleRef(&node.module_ref))); + Box::new(iterator) + } + NodeRef::TsImportType(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Str(&node.arg))) + .chain( + node.qualifier + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsEntityName(&item))), + ) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::TsIndexSignature(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::TsIndexedAccessType(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.obj_type; + ::std::iter::once(NodeRef::TsType(&item)) + }) + .chain({ + let item = &*node.index_type; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsInferType(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsTypeParam(&node.type_param))); + Box::new(iterator) + } + NodeRef::TsInstantiation(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.type_args; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + }); + Box::new(iterator) + } + NodeRef::TsInterfaceBody(node) => { + let iterator = ::std::iter::empty::>().chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsTypeElement(&item))), + ); + Box::new(iterator) + } + NodeRef::TsInterfaceDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain( + node.extends + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsExprWithTypeArgs(&item))), + ) + .chain(::std::iter::once(NodeRef::TsInterfaceBody(&node.body))); + Box::new(iterator) + } + NodeRef::TsIntersectionType(node) => { + let iterator = ::std::iter::empty::>().chain( + node.types.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + }), + ); + Box::new(iterator) + } + NodeRef::TsKeywordType(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsKeywordTypeKind(&node.kind))); + Box::new(iterator) + } + NodeRef::TsKeywordTypeKind(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsLit(node) => match node { + TsLit::Number(v0) => Box::new(::std::iter::once(NodeRef::Number(v0))), + TsLit::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + TsLit::Bool(v0) => Box::new(::std::iter::once(NodeRef::Bool(v0))), + TsLit::BigInt(v0) => Box::new(::std::iter::once(NodeRef::BigInt(v0))), + TsLit::Tpl(v0) => Box::new(::std::iter::once(NodeRef::TsTplLitType(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsLitType(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsLit(&node.lit))); + Box::new(iterator) + } + NodeRef::TsMappedType(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.readonly + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TruePlusMinus(&item))), + ) + .chain(::std::iter::once(NodeRef::TsTypeParam(&node.type_param))) + .chain(node.name_type.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + })) + .chain( + node.optional + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TruePlusMinus(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + })); + Box::new(iterator) + } + NodeRef::TsMethodSignature(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.key; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsFnParam(&item))), + ) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })); + Box::new(iterator) + } + NodeRef::TsModuleBlock(node) => { + let iterator = ::std::iter::empty::>().chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::ModuleItem(&item))), + ); + Box::new(iterator) + } + NodeRef::TsModuleDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsModuleName(&node.id))) + .chain( + node.body + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsNamespaceBody(&item))), + ); + Box::new(iterator) + } + NodeRef::TsModuleName(node) => match node { + TsModuleName::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + TsModuleName::Str(v0) => Box::new(::std::iter::once(NodeRef::Str(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsModuleRef(node) => match node { + TsModuleRef::TsEntityName(v0) => { + Box::new(::std::iter::once(NodeRef::TsEntityName(v0))) + } + TsModuleRef::TsExternalModuleRef(v0) => { + Box::new(::std::iter::once(NodeRef::TsExternalModuleRef(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsNamespaceBody(node) => match node { + TsNamespaceBody::TsModuleBlock(v0) => { + Box::new(::std::iter::once(NodeRef::TsModuleBlock(v0))) + } + TsNamespaceBody::TsNamespaceDecl(v0) => { + Box::new(::std::iter::once(NodeRef::TsNamespaceDecl(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsNamespaceDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::TsNamespaceBody(&item)) + }); + Box::new(iterator) + } + NodeRef::TsNamespaceExportDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))); + Box::new(iterator) + } + NodeRef::TsNonNullExpr(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::TsOptionalType(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsParamProp(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.decorators + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Decorator(&item))), + ) + .chain( + node.accessibility + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Accessibility(&item))), + ) + .chain(::std::iter::once(NodeRef::TsParamPropParam(&node.param))); + Box::new(iterator) + } + NodeRef::TsParamPropParam(node) => match node { + TsParamPropParam::Ident(v0) => { + Box::new(::std::iter::once(NodeRef::BindingIdent(v0))) + } + TsParamPropParam::Assign(v0) => Box::new(::std::iter::once(NodeRef::AssignPat(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsParenthesizedType(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsPropertySignature(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.key; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::TsQualifiedName(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsEntityName(&node.left))) + .chain(::std::iter::once(NodeRef::IdentName(&node.right))); + Box::new(iterator) + } + NodeRef::TsRestType(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsSatisfiesExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsSetterSignature(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.key; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain(::std::iter::once(NodeRef::TsFnParam(&node.param))); + Box::new(iterator) + } + NodeRef::TsThisType(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::TsThisTypeOrIdent(node) => match node { + TsThisTypeOrIdent::TsThisType(v0) => { + Box::new(::std::iter::once(NodeRef::TsThisType(v0))) + } + TsThisTypeOrIdent::Ident(v0) => Box::new(::std::iter::once(NodeRef::Ident(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsTplLitType(node) => { + let iterator = ::std::iter::empty::>() + .chain(node.types.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + })) + .chain( + node.quasis + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TplElement(&item))), + ); + Box::new(iterator) + } + NodeRef::TsTupleElement(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.label + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Pat(&item))), + ) + .chain({ + let item = &*node.ty; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsTupleType(node) => { + let iterator = ::std::iter::empty::>().chain( + node.elem_types + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsTupleElement(&item))), + ); + Box::new(iterator) + } + NodeRef::TsType(node) => match node { + TsType::TsKeywordType(v0) => { + Box::new(::std::iter::once(NodeRef::TsKeywordType(v0))) + } + TsType::TsThisType(v0) => Box::new(::std::iter::once(NodeRef::TsThisType(v0))), + TsType::TsFnOrConstructorType(v0) => { + Box::new(::std::iter::once(NodeRef::TsFnOrConstructorType(v0))) + } + TsType::TsTypeRef(v0) => Box::new(::std::iter::once(NodeRef::TsTypeRef(v0))), + TsType::TsTypeQuery(v0) => Box::new(::std::iter::once(NodeRef::TsTypeQuery(v0))), + TsType::TsTypeLit(v0) => Box::new(::std::iter::once(NodeRef::TsTypeLit(v0))), + TsType::TsArrayType(v0) => Box::new(::std::iter::once(NodeRef::TsArrayType(v0))), + TsType::TsTupleType(v0) => Box::new(::std::iter::once(NodeRef::TsTupleType(v0))), + TsType::TsOptionalType(v0) => { + Box::new(::std::iter::once(NodeRef::TsOptionalType(v0))) + } + TsType::TsRestType(v0) => Box::new(::std::iter::once(NodeRef::TsRestType(v0))), + TsType::TsUnionOrIntersectionType(v0) => { + Box::new(::std::iter::once(NodeRef::TsUnionOrIntersectionType(v0))) + } + TsType::TsConditionalType(v0) => { + Box::new(::std::iter::once(NodeRef::TsConditionalType(v0))) + } + TsType::TsInferType(v0) => Box::new(::std::iter::once(NodeRef::TsInferType(v0))), + TsType::TsParenthesizedType(v0) => { + Box::new(::std::iter::once(NodeRef::TsParenthesizedType(v0))) + } + TsType::TsTypeOperator(v0) => { + Box::new(::std::iter::once(NodeRef::TsTypeOperator(v0))) + } + TsType::TsIndexedAccessType(v0) => { + Box::new(::std::iter::once(NodeRef::TsIndexedAccessType(v0))) + } + TsType::TsMappedType(v0) => Box::new(::std::iter::once(NodeRef::TsMappedType(v0))), + TsType::TsLitType(v0) => Box::new(::std::iter::once(NodeRef::TsLitType(v0))), + TsType::TsTypePredicate(v0) => { + Box::new(::std::iter::once(NodeRef::TsTypePredicate(v0))) + } + TsType::TsImportType(v0) => Box::new(::std::iter::once(NodeRef::TsImportType(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsTypeAliasDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.id))) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamDecl(&item)) + })) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsTypeAnn(node) => { + let iterator = ::std::iter::empty::>().chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsTypeAssertion(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.expr; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsTypeElement(node) => match node { + TsTypeElement::TsCallSignatureDecl(v0) => { + Box::new(::std::iter::once(NodeRef::TsCallSignatureDecl(v0))) + } + TsTypeElement::TsConstructSignatureDecl(v0) => { + Box::new(::std::iter::once(NodeRef::TsConstructSignatureDecl(v0))) + } + TsTypeElement::TsPropertySignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsPropertySignature(v0))) + } + TsTypeElement::TsGetterSignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsGetterSignature(v0))) + } + TsTypeElement::TsSetterSignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsSetterSignature(v0))) + } + TsTypeElement::TsMethodSignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsMethodSignature(v0))) + } + TsTypeElement::TsIndexSignature(v0) => { + Box::new(::std::iter::once(NodeRef::TsIndexSignature(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsTypeLit(node) => { + let iterator = ::std::iter::empty::>().chain( + node.members + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsTypeElement(&item))), + ); + Box::new(iterator) + } + NodeRef::TsTypeOperator(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsTypeOperatorOp(&node.op))) + .chain({ + let item = &*node.type_ann; + ::std::iter::once(NodeRef::TsType(&item)) + }); + Box::new(iterator) + } + NodeRef::TsTypeOperatorOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsTypeParam(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Ident(&node.name))) + .chain(node.constraint.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + })) + .chain(node.default.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + })); + Box::new(iterator) + } + NodeRef::TsTypeParamDecl(node) => { + let iterator = ::std::iter::empty::>().chain( + node.params + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::TsTypeParam(&item))), + ); + Box::new(iterator) + } + NodeRef::TsTypeParamInstantiation(node) => { + let iterator = ::std::iter::empty::>().chain( + node.params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + }), + ); + Box::new(iterator) + } + NodeRef::TsTypePredicate(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsThisTypeOrIdent( + &node.param_name, + ))) + .chain(node.type_ann.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeAnn(&item)) + })); + Box::new(iterator) + } + NodeRef::TsTypeQuery(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsTypeQueryExpr(&node.expr_name))) + .chain(node.type_args.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::TsTypeQueryExpr(node) => match node { + TsTypeQueryExpr::TsEntityName(v0) => { + Box::new(::std::iter::once(NodeRef::TsEntityName(v0))) + } + TsTypeQueryExpr::Import(v0) => { + Box::new(::std::iter::once(NodeRef::TsImportType(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsTypeRef(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::TsEntityName(&node.type_name))) + .chain(node.type_params.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsTypeParamInstantiation(&item)) + })); + Box::new(iterator) + } + NodeRef::TsUnionOrIntersectionType(node) => match node { + TsUnionOrIntersectionType::TsUnionType(v0) => { + Box::new(::std::iter::once(NodeRef::TsUnionType(v0))) + } + TsUnionOrIntersectionType::TsIntersectionType(v0) => { + Box::new(::std::iter::once(NodeRef::TsIntersectionType(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TsUnionType(node) => { + let iterator = ::std::iter::empty::>().chain( + node.types.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::TsType(&item)) + }), + ); + Box::new(iterator) + } + NodeRef::UnaryExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::UnaryOp(&node.op))) + .chain({ + let item = &*node.arg; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::UnaryOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::UpdateExpr(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::UpdateOp(&node.op))) + .chain({ + let item = &*node.arg; + ::std::iter::once(NodeRef::Expr(&item)) + }); + Box::new(iterator) + } + NodeRef::UpdateOp(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::UsingDecl(node) => { + let iterator = ::std::iter::empty::>().chain( + node.decls + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::VarDeclarator(&item))), + ); + Box::new(iterator) + } + NodeRef::VarDecl(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::VarDeclKind(&node.kind))) + .chain( + node.decls + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::VarDeclarator(&item))), + ); + Box::new(iterator) + } + NodeRef::VarDeclKind(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::VarDeclOrExpr(node) => match node { + VarDeclOrExpr::VarDecl(v0) => Box::new(::std::iter::once(NodeRef::VarDecl(v0))), + VarDeclOrExpr::Expr(v0) => Box::new(::std::iter::once(NodeRef::Expr(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::VarDeclarator(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Pat(&node.name))) + .chain(node.init.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })); + Box::new(iterator) + } + NodeRef::WhileStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.test; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::WithStmt(node) => { + let iterator = ::std::iter::empty::>() + .chain({ + let item = &*node.obj; + ::std::iter::once(NodeRef::Expr(&item)) + }) + .chain({ + let item = &*node.body; + ::std::iter::once(NodeRef::Stmt(&item)) + }); + Box::new(iterator) + } + NodeRef::YieldExpr(node) => { + let iterator = + ::std::iter::empty::>().chain(node.arg.iter().flat_map(|item| { + let item = &*item; + ::std::iter::once(NodeRef::Expr(&item)) + })); + Box::new(iterator) + } + } + } +} #[cfg(any(docsrs, feature = "path"))] pub use self::fields::{AstParentKind, AstParentNodeRef}; diff --git a/crates/swc_html_visit/src/generated.rs b/crates/swc_html_visit/src/generated.rs index e27acacf5ab..8054a4075ee 100644 --- a/crates/swc_html_visit/src/generated.rs +++ b/crates/swc_html_visit/src/generated.rs @@ -11092,7 +11092,6 @@ pub mod fields { #[doc = "Represents [`TokenAndSpan::token`]"] Token, } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AstParentKind { Attribute(AttributeField), @@ -11131,7 +11130,6 @@ pub mod fields { } } } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy)] pub enum AstParentNodeRef<'ast> { Attribute(&'ast Attribute, AttributeField), @@ -11176,6 +11174,7 @@ pub mod fields { } } } + #[cfg(any(docsrs, feature = "path"))] impl<'ast> AstParentNodeRef<'ast> { #[inline] pub fn kind(&self) -> AstParentKind { @@ -11202,5 +11201,185 @@ pub mod fields { } } } +impl<'ast> From<&'ast Attribute> for NodeRef<'ast> { + fn from(node: &'ast Attribute) -> Self { + NodeRef::Attribute(node) + } +} +impl<'ast> From<&'ast AttributeToken> for NodeRef<'ast> { + fn from(node: &'ast AttributeToken) -> Self { + NodeRef::AttributeToken(node) + } +} +impl<'ast> From<&'ast Child> for NodeRef<'ast> { + fn from(node: &'ast Child) -> Self { + NodeRef::Child(node) + } +} +impl<'ast> From<&'ast Comment> for NodeRef<'ast> { + fn from(node: &'ast Comment) -> Self { + NodeRef::Comment(node) + } +} +impl<'ast> From<&'ast Document> for NodeRef<'ast> { + fn from(node: &'ast Document) -> Self { + NodeRef::Document(node) + } +} +impl<'ast> From<&'ast DocumentFragment> for NodeRef<'ast> { + fn from(node: &'ast DocumentFragment) -> Self { + NodeRef::DocumentFragment(node) + } +} +impl<'ast> From<&'ast DocumentMode> for NodeRef<'ast> { + fn from(node: &'ast DocumentMode) -> Self { + NodeRef::DocumentMode(node) + } +} +impl<'ast> From<&'ast DocumentType> for NodeRef<'ast> { + fn from(node: &'ast DocumentType) -> Self { + NodeRef::DocumentType(node) + } +} +impl<'ast> From<&'ast Element> for NodeRef<'ast> { + fn from(node: &'ast Element) -> Self { + NodeRef::Element(node) + } +} +impl<'ast> From<&'ast Namespace> for NodeRef<'ast> { + fn from(node: &'ast Namespace) -> Self { + NodeRef::Namespace(node) + } +} +impl<'ast> From<&'ast Raw> for NodeRef<'ast> { + fn from(node: &'ast Raw) -> Self { + NodeRef::Raw(node) + } +} +impl<'ast> From<&'ast Text> for NodeRef<'ast> { + fn from(node: &'ast Text) -> Self { + NodeRef::Text(node) + } +} +impl<'ast> From<&'ast Token> for NodeRef<'ast> { + fn from(node: &'ast Token) -> Self { + NodeRef::Token(node) + } +} +impl<'ast> From<&'ast TokenAndSpan> for NodeRef<'ast> { + fn from(node: &'ast TokenAndSpan) -> Self { + NodeRef::TokenAndSpan(node) + } +} +#[derive(Debug, Clone, Copy)] +pub enum NodeRef<'ast> { + Attribute(&'ast Attribute), + AttributeToken(&'ast AttributeToken), + Child(&'ast Child), + Comment(&'ast Comment), + Document(&'ast Document), + DocumentFragment(&'ast DocumentFragment), + DocumentMode(&'ast DocumentMode), + DocumentType(&'ast DocumentType), + Element(&'ast Element), + Namespace(&'ast Namespace), + Raw(&'ast Raw), + Text(&'ast Text), + Token(&'ast Token), + TokenAndSpan(&'ast TokenAndSpan), +} +impl<'ast> NodeRef<'ast> { + #[allow(unreachable_patterns)] + pub fn raw_children(&'ast self) -> Box>> { + match self { + NodeRef::Attribute(node) => { + let iterator = ::std::iter::empty::>().chain( + node.namespace + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Namespace(&item))), + ); + Box::new(iterator) + } + NodeRef::AttributeToken(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Child(node) => match node { + Child::DocumentType(v0) => Box::new(::std::iter::once(NodeRef::DocumentType(v0))), + Child::Element(v0) => Box::new(::std::iter::once(NodeRef::Element(v0))), + Child::Text(v0) => Box::new(::std::iter::once(NodeRef::Text(v0))), + Child::Comment(v0) => Box::new(::std::iter::once(NodeRef::Comment(v0))), + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Comment(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Document(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::DocumentMode(&node.mode))) + .chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))), + ); + Box::new(iterator) + } + NodeRef::DocumentFragment(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))), + ); + Box::new(iterator) + } + NodeRef::DocumentMode(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::DocumentType(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Element(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Namespace(&node.namespace))) + .chain( + node.attributes + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Attribute(&item))), + ) + .chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))), + ) + .chain( + node.content + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::DocumentFragment(&item))), + ); + Box::new(iterator) + } + NodeRef::Namespace(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Raw(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Text(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Token(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TokenAndSpan(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Token(&node.token))); + Box::new(iterator) + } + } + } +} #[cfg(any(docsrs, feature = "path"))] pub use self::fields::{AstParentKind, AstParentNodeRef}; diff --git a/crates/swc_xml_visit/src/generated.rs b/crates/swc_xml_visit/src/generated.rs index 7e90b040ad2..237deb6c653 100644 --- a/crates/swc_xml_visit/src/generated.rs +++ b/crates/swc_xml_visit/src/generated.rs @@ -10660,7 +10660,6 @@ pub mod fields { #[doc = "Represents [`TokenAndSpan::token`]"] Token, } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AstParentKind { Attribute(AttributeField), @@ -10699,7 +10698,6 @@ pub mod fields { } } } - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy)] pub enum AstParentNodeRef<'ast> { Attribute(&'ast Attribute, AttributeField), @@ -10744,6 +10742,7 @@ pub mod fields { } } } + #[cfg(any(docsrs, feature = "path"))] impl<'ast> AstParentNodeRef<'ast> { #[inline] pub fn kind(&self) -> AstParentKind { @@ -10770,5 +10769,178 @@ pub mod fields { } } } +impl<'ast> From<&'ast Attribute> for NodeRef<'ast> { + fn from(node: &'ast Attribute) -> Self { + NodeRef::Attribute(node) + } +} +impl<'ast> From<&'ast AttributeToken> for NodeRef<'ast> { + fn from(node: &'ast AttributeToken) -> Self { + NodeRef::AttributeToken(node) + } +} +impl<'ast> From<&'ast CdataSection> for NodeRef<'ast> { + fn from(node: &'ast CdataSection) -> Self { + NodeRef::CdataSection(node) + } +} +impl<'ast> From<&'ast Child> for NodeRef<'ast> { + fn from(node: &'ast Child) -> Self { + NodeRef::Child(node) + } +} +impl<'ast> From<&'ast Comment> for NodeRef<'ast> { + fn from(node: &'ast Comment) -> Self { + NodeRef::Comment(node) + } +} +impl<'ast> From<&'ast Document> for NodeRef<'ast> { + fn from(node: &'ast Document) -> Self { + NodeRef::Document(node) + } +} +impl<'ast> From<&'ast DocumentMode> for NodeRef<'ast> { + fn from(node: &'ast DocumentMode) -> Self { + NodeRef::DocumentMode(node) + } +} +impl<'ast> From<&'ast DocumentType> for NodeRef<'ast> { + fn from(node: &'ast DocumentType) -> Self { + NodeRef::DocumentType(node) + } +} +impl<'ast> From<&'ast Element> for NodeRef<'ast> { + fn from(node: &'ast Element) -> Self { + NodeRef::Element(node) + } +} +impl<'ast> From<&'ast Namespace> for NodeRef<'ast> { + fn from(node: &'ast Namespace) -> Self { + NodeRef::Namespace(node) + } +} +impl<'ast> From<&'ast ProcessingInstruction> for NodeRef<'ast> { + fn from(node: &'ast ProcessingInstruction) -> Self { + NodeRef::ProcessingInstruction(node) + } +} +impl<'ast> From<&'ast Text> for NodeRef<'ast> { + fn from(node: &'ast Text) -> Self { + NodeRef::Text(node) + } +} +impl<'ast> From<&'ast Token> for NodeRef<'ast> { + fn from(node: &'ast Token) -> Self { + NodeRef::Token(node) + } +} +impl<'ast> From<&'ast TokenAndSpan> for NodeRef<'ast> { + fn from(node: &'ast TokenAndSpan) -> Self { + NodeRef::TokenAndSpan(node) + } +} +#[derive(Debug, Clone, Copy)] +pub enum NodeRef<'ast> { + Attribute(&'ast Attribute), + AttributeToken(&'ast AttributeToken), + CdataSection(&'ast CdataSection), + Child(&'ast Child), + Comment(&'ast Comment), + Document(&'ast Document), + DocumentMode(&'ast DocumentMode), + DocumentType(&'ast DocumentType), + Element(&'ast Element), + Namespace(&'ast Namespace), + ProcessingInstruction(&'ast ProcessingInstruction), + Text(&'ast Text), + Token(&'ast Token), + TokenAndSpan(&'ast TokenAndSpan), +} +impl<'ast> NodeRef<'ast> { + #[allow(unreachable_patterns)] + pub fn raw_children(&'ast self) -> Box>> { + match self { + NodeRef::Attribute(node) => { + let iterator = ::std::iter::empty::>().chain( + node.namespace + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Namespace(&item))), + ); + Box::new(iterator) + } + NodeRef::AttributeToken(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::CdataSection(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Child(node) => match node { + Child::DocumentType(v0) => Box::new(::std::iter::once(NodeRef::DocumentType(v0))), + Child::Element(v0) => Box::new(::std::iter::once(NodeRef::Element(v0))), + Child::Text(v0) => Box::new(::std::iter::once(NodeRef::Text(v0))), + Child::CdataSection(v0) => Box::new(::std::iter::once(NodeRef::CdataSection(v0))), + Child::Comment(v0) => Box::new(::std::iter::once(NodeRef::Comment(v0))), + Child::ProcessingInstruction(v0) => { + Box::new(::std::iter::once(NodeRef::ProcessingInstruction(v0))) + } + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::Comment(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Document(node) => { + let iterator = ::std::iter::empty::>().chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))), + ); + Box::new(iterator) + } + NodeRef::DocumentMode(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::DocumentType(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Element(node) => { + let iterator = ::std::iter::empty::>() + .chain( + node.attributes + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Attribute(&item))), + ) + .chain( + node.children + .iter() + .flat_map(|item| ::std::iter::once(NodeRef::Child(&item))), + ); + Box::new(iterator) + } + NodeRef::Namespace(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::ProcessingInstruction(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Text(node) => { + let iterator = ::std::iter::empty::>(); + Box::new(iterator) + } + NodeRef::Token(node) => match node { + _ => Box::new(::std::iter::empty::>()), + }, + NodeRef::TokenAndSpan(node) => { + let iterator = ::std::iter::empty::>() + .chain(::std::iter::once(NodeRef::Token(&node.token))); + Box::new(iterator) + } + } + } +} #[cfg(any(docsrs, feature = "path"))] pub use self::fields::{AstParentKind, AstParentNodeRef}; diff --git a/tools/generate-code/src/generators/visitor.rs b/tools/generate-code/src/generators/visitor.rs index d57f41dcc19..89832837606 100644 --- a/tools/generate-code/src/generators/visitor.rs +++ b/tools/generate-code/src/generators/visitor.rs @@ -1261,14 +1261,71 @@ fn extract_generic<'a>(name: &str, ty: &'a Type) -> Option<&'a Type> { None } + +fn to_iter(e: TokenStream, ty: &Type, node_names: &[Ident]) -> Option { + if let Some(ty) = extract_vec(ty) { + let inner_expr = to_iter(quote!(item), ty, node_names)?; + return Some(parse_quote!(#e.iter().flat_map(|item| #inner_expr))); + } + + if let Some(ty) = extract_generic("Option", ty) { + let inner_expr = to_iter(quote!(item), ty, node_names)?; + return Some(parse_quote!(#e.iter().flat_map(|item| #inner_expr))); + } + + if let Some(ty) = extract_generic("Box", ty) { + let inner_expr = to_iter(quote!(item), ty, node_names)?; + return Some(parse_quote!({ + let item = &*#e; + #inner_expr + })); + } + + if let Type::Path(p) = ty { + let ty = &p.path.segments.last().unwrap().ident; + + if node_names.contains(ty) { + return Some(parse_quote!(::std::iter::once(NodeRef::#ty(&#e)))); + } + + None + } else { + todo!("to_iter for {:?}", ty); + } +} + fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { let mut items = Vec::::new(); let mut kind_enum_members = Vec::new(); + let mut parent_enum_members = Vec::new(); let mut node_ref_enum_members = Vec::new(); let mut kind_set_index_arms = Vec::::new(); let mut node_ref_set_index_arms = Vec::::new(); let mut node_ref_kind_arms = Vec::::new(); + let mut node_ref_iter_next_arms = Vec::::new(); + + let node_names = node_types + .iter() + .filter_map(|ty| match ty { + Item::Enum(data) => Some(data.ident.clone()), + Item::Struct(data) => Some(data.ident.clone()), + _ => None, + }) + .collect::>(); + + let is_node_ref_raw = |ty: &Type| match ty { + Type::Path(p) => node_names.contains(&p.path.segments.last().unwrap().ident), + _ => false, + }; + + let is_node_ref = |ty: &Type| { + if let Some(ty) = extract_generic("Box", ty) { + return is_node_ref_raw(ty); + } + + is_node_ref_raw(ty) + }; { let mut defs = Vec::::new(); @@ -1330,10 +1387,58 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { #type_name(#fields_enum_name) )); - node_ref_enum_members.push(quote!( + parent_enum_members.push(quote!( #type_name(&'ast #type_name, #fields_enum_name) )); + node_ref_enum_members.push(quote!( + #type_name(&'ast #type_name) + )); + + items.push(parse_quote!( + impl<'ast> From<&'ast #type_name> for NodeRef<'ast> { + fn from(node: &'ast #type_name) -> Self { + NodeRef::#type_name(node) + } + } + )); + + { + let mut arms = Vec::::new(); + + for variant in &data.variants { + let variant_name = &variant.ident; + + // TODO: Support all kinds of fields + if variant.fields.len() != 1 { + continue; + } + + for f in variant.fields.iter().filter(|f| is_node_ref(&f.ty)) { + let mut ty = &f.ty; + if let Some(inner) = extract_generic("Box", ty) { + ty = inner; + } + + arms.push(parse_quote!( + #type_name::#variant_name(v0) => { + Box::new(::std::iter::once(NodeRef::#ty(v0))) + }, + )); + } + } + + node_ref_iter_next_arms.push(parse_quote!( + NodeRef::#type_name(node) => { + match node { + #(#arms)* + + _ => Box::new(::std::iter::empty::>()) + } + } + )); + } + defs.push(parse_quote!( impl #fields_enum_name { #[inline(always)] @@ -1361,10 +1466,51 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { #type_name(#fields_enum_name) )); - node_ref_enum_members.push(quote!( + parent_enum_members.push(quote!( #type_name(&'ast #type_name, #fields_enum_name) )); + node_ref_enum_members.push(quote!( + #type_name(&'ast #type_name) + )); + + items.push(parse_quote!( + impl<'ast> From<&'ast #type_name> for NodeRef<'ast> { + fn from(node: &'ast #type_name) -> Self { + NodeRef::#type_name(node) + } + } + )); + + { + let mut iter: Expr = parse_quote!(::std::iter::empty::>()); + + match &data.fields { + Fields::Named(fields) => { + for f in fields.named.iter() { + let ident = &f.ident; + let iter_expr = + to_iter(quote!(node.#ident), &f.ty, &node_names); + if let Some(iter_expr) = iter_expr { + iter = parse_quote!(#iter.chain(#iter_expr)); + } + } + } + + Fields::Unnamed(_fields) => { + // TODO: Support unnamed fields + } + Fields::Unit => {} + } + + node_ref_iter_next_arms.push(parse_quote!( + NodeRef::#type_name(node) => { + let iterator = #iter; + Box::new(iterator) + } + )); + } + defs.push(parse_quote!( impl #fields_enum_name { pub(crate) fn set_index(&mut self, index: usize) { @@ -1392,7 +1538,6 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { { defs.push(parse_quote!( - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum AstParentKind { #(#kind_enum_members),* @@ -1413,9 +1558,14 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { { defs.push(parse_quote!( - #[cfg(any(docsrs, feature = "path"))] #[derive(Debug, Clone, Copy)] pub enum AstParentNodeRef<'ast> { + #(#parent_enum_members),* + } + )); + items.push(parse_quote!( + #[derive(Debug, Clone, Copy)] + pub enum NodeRef<'ast> { #(#node_ref_enum_members),* } )); @@ -1437,6 +1587,7 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { } )); defs.push(parse_quote!( + #[cfg(any(docsrs, feature = "path"))] impl<'ast> AstParentNodeRef<'ast> { #[inline] pub fn kind(&self) -> AstParentKind { @@ -1446,14 +1597,27 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { } } )); + items.push(parse_quote!( + impl<'ast> NodeRef<'ast> { + #[allow(unreachable_patterns)] + pub fn raw_children(&'ast self) -> Box>> { + match self { + #(#node_ref_iter_next_arms)* + } + } + } + )); } - items.push(parse_quote!( - #[cfg(any(docsrs, feature = "path"))] - pub mod fields { - #(#defs)* - } - )); + items.insert( + 0, + parse_quote!( + #[cfg(any(docsrs, feature = "path"))] + pub mod fields { + #(#defs)* + } + ), + ); items.push(parse_quote!( #[cfg(any(docsrs, feature = "path"))]