diff --git a/.changeset/ten-books-cheat.md b/.changeset/ten-books-cheat.md new file mode 100644 index 00000000000..636a26a86c9 --- /dev/null +++ b/.changeset/ten-books-cheat.md @@ -0,0 +1,8 @@ +--- +swc_css_visit: patch +swc_ecma_visit: patch +swc_html_visit: patch +swc_xml_visit: patch +--- + +feat(visit): Make `AstParentNodeRef.kind()` accessible without depending on `swc_visit` diff --git a/crates/swc_css_visit/src/generated.rs b/crates/swc_css_visit/src/generated.rs index 72580416563..7301880e8fb 100644 --- a/crates/swc_css_visit/src/generated.rs +++ b/crates/swc_css_visit/src/generated.rs @@ -125206,8 +125206,200 @@ pub mod fields { impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> { type ParentKind = AstParentKind; - #[inline] + #[inline(always)] fn kind(&self) -> AstParentKind { + self.kind() + } + + fn set_index(&mut self, index: usize) { + match self { + Self::AbsoluteColorBase(_, __field_kind) => __field_kind.set_index(index), + Self::AlphaValue(_, __field_kind) => __field_kind.set_index(index), + Self::AnPlusB(_, __field_kind) => __field_kind.set_index(index), + Self::AnPlusBNotation(_, __field_kind) => __field_kind.set_index(index), + Self::Angle(_, __field_kind) => __field_kind.set_index(index), + Self::AnglePercentage(_, __field_kind) => __field_kind.set_index(index), + Self::AnyNamespace(_, __field_kind) => __field_kind.set_index(index), + Self::AtRule(_, __field_kind) => __field_kind.set_index(index), + Self::AtRuleName(_, __field_kind) => __field_kind.set_index(index), + Self::AtRulePrelude(_, __field_kind) => __field_kind.set_index(index), + Self::AttributeSelector(_, __field_kind) => __field_kind.set_index(index), + Self::AttributeSelectorMatcher(_, __field_kind) => __field_kind.set_index(index), + Self::AttributeSelectorMatcherValue(_, __field_kind) => { + __field_kind.set_index(index) + } + Self::AttributeSelectorModifier(_, __field_kind) => __field_kind.set_index(index), + Self::AttributeSelectorValue(_, __field_kind) => __field_kind.set_index(index), + Self::BinOp(_, __field_kind) => __field_kind.set_index(index), + Self::CalcOperator(_, __field_kind) => __field_kind.set_index(index), + Self::CalcOperatorType(_, __field_kind) => __field_kind.set_index(index), + Self::CalcProduct(_, __field_kind) => __field_kind.set_index(index), + Self::CalcProductOrOperator(_, __field_kind) => __field_kind.set_index(index), + Self::CalcSum(_, __field_kind) => __field_kind.set_index(index), + Self::CalcValue(_, __field_kind) => __field_kind.set_index(index), + Self::CalcValueOrOperator(_, __field_kind) => __field_kind.set_index(index), + Self::ClassSelector(_, __field_kind) => __field_kind.set_index(index), + Self::CmykComponent(_, __field_kind) => __field_kind.set_index(index), + Self::Color(_, __field_kind) => __field_kind.set_index(index), + Self::ColorProfileName(_, __field_kind) => __field_kind.set_index(index), + Self::Combinator(_, __field_kind) => __field_kind.set_index(index), + Self::CombinatorValue(_, __field_kind) => __field_kind.set_index(index), + Self::ComplexSelector(_, __field_kind) => __field_kind.set_index(index), + Self::ComplexSelectorChildren(_, __field_kind) => __field_kind.set_index(index), + Self::ComponentValue(_, __field_kind) => __field_kind.set_index(index), + Self::CompoundSelector(_, __field_kind) => __field_kind.set_index(index), + Self::CompoundSelectorList(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerCondition(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerName(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerQuery(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerQueryAnd(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerQueryNot(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerQueryOr(_, __field_kind) => __field_kind.set_index(index), + Self::ContainerQueryType(_, __field_kind) => __field_kind.set_index(index), + Self::CustomHighlightName(_, __field_kind) => __field_kind.set_index(index), + Self::CustomIdent(_, __field_kind) => __field_kind.set_index(index), + Self::CustomMediaQuery(_, __field_kind) => __field_kind.set_index(index), + Self::CustomMediaQueryMediaType(_, __field_kind) => __field_kind.set_index(index), + Self::CustomPropertyName(_, __field_kind) => __field_kind.set_index(index), + Self::DashedIdent(_, __field_kind) => __field_kind.set_index(index), + Self::Declaration(_, __field_kind) => __field_kind.set_index(index), + Self::DeclarationName(_, __field_kind) => __field_kind.set_index(index), + Self::DeclarationOrAtRule(_, __field_kind) => __field_kind.set_index(index), + Self::Delimiter(_, __field_kind) => __field_kind.set_index(index), + Self::DelimiterValue(_, __field_kind) => __field_kind.set_index(index), + Self::Dimension(_, __field_kind) => __field_kind.set_index(index), + Self::DimensionToken(_, __field_kind) => __field_kind.set_index(index), + Self::DocumentPrelude(_, __field_kind) => __field_kind.set_index(index), + Self::DocumentPreludeMatchingFunction(_, __field_kind) => { + __field_kind.set_index(index) + } + Self::ExtensionName(_, __field_kind) => __field_kind.set_index(index), + Self::FamilyName(_, __field_kind) => __field_kind.set_index(index), + Self::Flex(_, __field_kind) => __field_kind.set_index(index), + Self::FontFeatureValuesPrelude(_, __field_kind) => __field_kind.set_index(index), + Self::ForgivingComplexSelector(_, __field_kind) => __field_kind.set_index(index), + Self::ForgivingRelativeSelector(_, __field_kind) => __field_kind.set_index(index), + Self::ForgivingRelativeSelectorList(_, __field_kind) => { + __field_kind.set_index(index) + } + Self::ForgivingSelectorList(_, __field_kind) => __field_kind.set_index(index), + Self::Frequency(_, __field_kind) => __field_kind.set_index(index), + Self::FrequencyPercentage(_, __field_kind) => __field_kind.set_index(index), + Self::Function(_, __field_kind) => __field_kind.set_index(index), + Self::FunctionName(_, __field_kind) => __field_kind.set_index(index), + Self::GeneralEnclosed(_, __field_kind) => __field_kind.set_index(index), + Self::HexColor(_, __field_kind) => __field_kind.set_index(index), + Self::Hue(_, __field_kind) => __field_kind.set_index(index), + Self::IdSelector(_, __field_kind) => __field_kind.set_index(index), + Self::Ident(_, __field_kind) => __field_kind.set_index(index), + Self::ImportConditions(_, __field_kind) => __field_kind.set_index(index), + Self::ImportHref(_, __field_kind) => __field_kind.set_index(index), + Self::ImportLayerName(_, __field_kind) => __field_kind.set_index(index), + Self::ImportPrelude(_, __field_kind) => __field_kind.set_index(index), + Self::ImportantFlag(_, __field_kind) => __field_kind.set_index(index), + Self::Integer(_, __field_kind) => __field_kind.set_index(index), + Self::KeyframeBlock(_, __field_kind) => __field_kind.set_index(index), + Self::KeyframeSelector(_, __field_kind) => __field_kind.set_index(index), + Self::KeyframesName(_, __field_kind) => __field_kind.set_index(index), + Self::KeyframesPseudoFunction(_, __field_kind) => __field_kind.set_index(index), + Self::KeyframesPseudoPrefix(_, __field_kind) => __field_kind.set_index(index), + Self::LayerName(_, __field_kind) => __field_kind.set_index(index), + Self::LayerNameList(_, __field_kind) => __field_kind.set_index(index), + Self::LayerPrelude(_, __field_kind) => __field_kind.set_index(index), + Self::Length(_, __field_kind) => __field_kind.set_index(index), + Self::LengthPercentage(_, __field_kind) => __field_kind.set_index(index), + Self::ListOfComponentValues(_, __field_kind) => __field_kind.set_index(index), + Self::MediaAnd(_, __field_kind) => __field_kind.set_index(index), + Self::MediaCondition(_, __field_kind) => __field_kind.set_index(index), + Self::MediaConditionAllType(_, __field_kind) => __field_kind.set_index(index), + Self::MediaConditionType(_, __field_kind) => __field_kind.set_index(index), + Self::MediaConditionWithoutOr(_, __field_kind) => __field_kind.set_index(index), + Self::MediaConditionWithoutOrType(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeature(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureBoolean(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureName(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeaturePlain(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureRange(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureRangeComparison(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureRangeInterval(_, __field_kind) => __field_kind.set_index(index), + Self::MediaFeatureValue(_, __field_kind) => __field_kind.set_index(index), + Self::MediaInParens(_, __field_kind) => __field_kind.set_index(index), + Self::MediaNot(_, __field_kind) => __field_kind.set_index(index), + Self::MediaOr(_, __field_kind) => __field_kind.set_index(index), + Self::MediaQuery(_, __field_kind) => __field_kind.set_index(index), + Self::MediaQueryList(_, __field_kind) => __field_kind.set_index(index), + Self::MediaType(_, __field_kind) => __field_kind.set_index(index), + Self::NamedNamespace(_, __field_kind) => __field_kind.set_index(index), + Self::Namespace(_, __field_kind) => __field_kind.set_index(index), + Self::NamespacePrefix(_, __field_kind) => __field_kind.set_index(index), + Self::NamespacePrelude(_, __field_kind) => __field_kind.set_index(index), + Self::NamespacePreludeUri(_, __field_kind) => __field_kind.set_index(index), + Self::NestingSelector(_, __field_kind) => __field_kind.set_index(index), + Self::Number(_, __field_kind) => __field_kind.set_index(index), + Self::NumberType(_, __field_kind) => __field_kind.set_index(index), + Self::PageSelector(_, __field_kind) => __field_kind.set_index(index), + Self::PageSelectorList(_, __field_kind) => __field_kind.set_index(index), + Self::PageSelectorPseudo(_, __field_kind) => __field_kind.set_index(index), + Self::PageSelectorType(_, __field_kind) => __field_kind.set_index(index), + Self::Percentage(_, __field_kind) => __field_kind.set_index(index), + Self::PseudoClassSelector(_, __field_kind) => __field_kind.set_index(index), + Self::PseudoClassSelectorChildren(_, __field_kind) => __field_kind.set_index(index), + Self::PseudoElementSelector(_, __field_kind) => __field_kind.set_index(index), + Self::PseudoElementSelectorChildren(_, __field_kind) => { + __field_kind.set_index(index) + } + Self::QualifiedRule(_, __field_kind) => __field_kind.set_index(index), + Self::QualifiedRulePrelude(_, __field_kind) => __field_kind.set_index(index), + Self::QueryInParens(_, __field_kind) => __field_kind.set_index(index), + Self::Ratio(_, __field_kind) => __field_kind.set_index(index), + Self::RelativeSelector(_, __field_kind) => __field_kind.set_index(index), + Self::RelativeSelectorList(_, __field_kind) => __field_kind.set_index(index), + Self::Resolution(_, __field_kind) => __field_kind.set_index(index), + Self::Rule(_, __field_kind) => __field_kind.set_index(index), + Self::ScopeRange(_, __field_kind) => __field_kind.set_index(index), + Self::SelectorList(_, __field_kind) => __field_kind.set_index(index), + Self::SequenceOfCustomIdents(_, __field_kind) => __field_kind.set_index(index), + Self::SimpleBlock(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeature(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureBoolean(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureName(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeaturePlain(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureRange(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureRangeComparison(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureRangeInterval(_, __field_kind) => __field_kind.set_index(index), + Self::SizeFeatureValue(_, __field_kind) => __field_kind.set_index(index), + Self::Str(_, __field_kind) => __field_kind.set_index(index), + Self::StyleBlock(_, __field_kind) => __field_kind.set_index(index), + Self::Stylesheet(_, __field_kind) => __field_kind.set_index(index), + Self::SubclassSelector(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsAnd(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsCondition(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsConditionType(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsFeature(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsInParens(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsNot(_, __field_kind) => __field_kind.set_index(index), + Self::SupportsOr(_, __field_kind) => __field_kind.set_index(index), + Self::TagNameSelector(_, __field_kind) => __field_kind.set_index(index), + Self::Time(_, __field_kind) => __field_kind.set_index(index), + Self::TimePercentage(_, __field_kind) => __field_kind.set_index(index), + Self::Token(_, __field_kind) => __field_kind.set_index(index), + Self::TokenAndSpan(_, __field_kind) => __field_kind.set_index(index), + Self::TypeSelector(_, __field_kind) => __field_kind.set_index(index), + Self::UnicodeRange(_, __field_kind) => __field_kind.set_index(index), + Self::UniversalSelector(_, __field_kind) => __field_kind.set_index(index), + Self::UnknownDimension(_, __field_kind) => __field_kind.set_index(index), + Self::Url(_, __field_kind) => __field_kind.set_index(index), + Self::UrlKeyValue(_, __field_kind) => __field_kind.set_index(index), + Self::UrlModifier(_, __field_kind) => __field_kind.set_index(index), + Self::UrlValue(_, __field_kind) => __field_kind.set_index(index), + Self::UrlValueRaw(_, __field_kind) => __field_kind.set_index(index), + Self::WqName(_, __field_kind) => __field_kind.set_index(index), + } + } + } + impl<'ast> AstParentNodeRef<'ast> { + #[inline] + pub fn kind(&self) -> AstParentKind { match self { Self::AbsoluteColorBase(_, __field_kind) => { AstParentKind::AbsoluteColorBase(*__field_kind) @@ -125570,192 +125762,6 @@ pub mod fields { Self::WqName(_, __field_kind) => AstParentKind::WqName(*__field_kind), } } - - fn set_index(&mut self, index: usize) { - match self { - Self::AbsoluteColorBase(_, __field_kind) => __field_kind.set_index(index), - Self::AlphaValue(_, __field_kind) => __field_kind.set_index(index), - Self::AnPlusB(_, __field_kind) => __field_kind.set_index(index), - Self::AnPlusBNotation(_, __field_kind) => __field_kind.set_index(index), - Self::Angle(_, __field_kind) => __field_kind.set_index(index), - Self::AnglePercentage(_, __field_kind) => __field_kind.set_index(index), - Self::AnyNamespace(_, __field_kind) => __field_kind.set_index(index), - Self::AtRule(_, __field_kind) => __field_kind.set_index(index), - Self::AtRuleName(_, __field_kind) => __field_kind.set_index(index), - Self::AtRulePrelude(_, __field_kind) => __field_kind.set_index(index), - Self::AttributeSelector(_, __field_kind) => __field_kind.set_index(index), - Self::AttributeSelectorMatcher(_, __field_kind) => __field_kind.set_index(index), - Self::AttributeSelectorMatcherValue(_, __field_kind) => { - __field_kind.set_index(index) - } - Self::AttributeSelectorModifier(_, __field_kind) => __field_kind.set_index(index), - Self::AttributeSelectorValue(_, __field_kind) => __field_kind.set_index(index), - Self::BinOp(_, __field_kind) => __field_kind.set_index(index), - Self::CalcOperator(_, __field_kind) => __field_kind.set_index(index), - Self::CalcOperatorType(_, __field_kind) => __field_kind.set_index(index), - Self::CalcProduct(_, __field_kind) => __field_kind.set_index(index), - Self::CalcProductOrOperator(_, __field_kind) => __field_kind.set_index(index), - Self::CalcSum(_, __field_kind) => __field_kind.set_index(index), - Self::CalcValue(_, __field_kind) => __field_kind.set_index(index), - Self::CalcValueOrOperator(_, __field_kind) => __field_kind.set_index(index), - Self::ClassSelector(_, __field_kind) => __field_kind.set_index(index), - Self::CmykComponent(_, __field_kind) => __field_kind.set_index(index), - Self::Color(_, __field_kind) => __field_kind.set_index(index), - Self::ColorProfileName(_, __field_kind) => __field_kind.set_index(index), - Self::Combinator(_, __field_kind) => __field_kind.set_index(index), - Self::CombinatorValue(_, __field_kind) => __field_kind.set_index(index), - Self::ComplexSelector(_, __field_kind) => __field_kind.set_index(index), - Self::ComplexSelectorChildren(_, __field_kind) => __field_kind.set_index(index), - Self::ComponentValue(_, __field_kind) => __field_kind.set_index(index), - Self::CompoundSelector(_, __field_kind) => __field_kind.set_index(index), - Self::CompoundSelectorList(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerCondition(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerName(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerQuery(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerQueryAnd(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerQueryNot(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerQueryOr(_, __field_kind) => __field_kind.set_index(index), - Self::ContainerQueryType(_, __field_kind) => __field_kind.set_index(index), - Self::CustomHighlightName(_, __field_kind) => __field_kind.set_index(index), - Self::CustomIdent(_, __field_kind) => __field_kind.set_index(index), - Self::CustomMediaQuery(_, __field_kind) => __field_kind.set_index(index), - Self::CustomMediaQueryMediaType(_, __field_kind) => __field_kind.set_index(index), - Self::CustomPropertyName(_, __field_kind) => __field_kind.set_index(index), - Self::DashedIdent(_, __field_kind) => __field_kind.set_index(index), - Self::Declaration(_, __field_kind) => __field_kind.set_index(index), - Self::DeclarationName(_, __field_kind) => __field_kind.set_index(index), - Self::DeclarationOrAtRule(_, __field_kind) => __field_kind.set_index(index), - Self::Delimiter(_, __field_kind) => __field_kind.set_index(index), - Self::DelimiterValue(_, __field_kind) => __field_kind.set_index(index), - Self::Dimension(_, __field_kind) => __field_kind.set_index(index), - Self::DimensionToken(_, __field_kind) => __field_kind.set_index(index), - Self::DocumentPrelude(_, __field_kind) => __field_kind.set_index(index), - Self::DocumentPreludeMatchingFunction(_, __field_kind) => { - __field_kind.set_index(index) - } - Self::ExtensionName(_, __field_kind) => __field_kind.set_index(index), - Self::FamilyName(_, __field_kind) => __field_kind.set_index(index), - Self::Flex(_, __field_kind) => __field_kind.set_index(index), - Self::FontFeatureValuesPrelude(_, __field_kind) => __field_kind.set_index(index), - Self::ForgivingComplexSelector(_, __field_kind) => __field_kind.set_index(index), - Self::ForgivingRelativeSelector(_, __field_kind) => __field_kind.set_index(index), - Self::ForgivingRelativeSelectorList(_, __field_kind) => { - __field_kind.set_index(index) - } - Self::ForgivingSelectorList(_, __field_kind) => __field_kind.set_index(index), - Self::Frequency(_, __field_kind) => __field_kind.set_index(index), - Self::FrequencyPercentage(_, __field_kind) => __field_kind.set_index(index), - Self::Function(_, __field_kind) => __field_kind.set_index(index), - Self::FunctionName(_, __field_kind) => __field_kind.set_index(index), - Self::GeneralEnclosed(_, __field_kind) => __field_kind.set_index(index), - Self::HexColor(_, __field_kind) => __field_kind.set_index(index), - Self::Hue(_, __field_kind) => __field_kind.set_index(index), - Self::IdSelector(_, __field_kind) => __field_kind.set_index(index), - Self::Ident(_, __field_kind) => __field_kind.set_index(index), - Self::ImportConditions(_, __field_kind) => __field_kind.set_index(index), - Self::ImportHref(_, __field_kind) => __field_kind.set_index(index), - Self::ImportLayerName(_, __field_kind) => __field_kind.set_index(index), - Self::ImportPrelude(_, __field_kind) => __field_kind.set_index(index), - Self::ImportantFlag(_, __field_kind) => __field_kind.set_index(index), - Self::Integer(_, __field_kind) => __field_kind.set_index(index), - Self::KeyframeBlock(_, __field_kind) => __field_kind.set_index(index), - Self::KeyframeSelector(_, __field_kind) => __field_kind.set_index(index), - Self::KeyframesName(_, __field_kind) => __field_kind.set_index(index), - Self::KeyframesPseudoFunction(_, __field_kind) => __field_kind.set_index(index), - Self::KeyframesPseudoPrefix(_, __field_kind) => __field_kind.set_index(index), - Self::LayerName(_, __field_kind) => __field_kind.set_index(index), - Self::LayerNameList(_, __field_kind) => __field_kind.set_index(index), - Self::LayerPrelude(_, __field_kind) => __field_kind.set_index(index), - Self::Length(_, __field_kind) => __field_kind.set_index(index), - Self::LengthPercentage(_, __field_kind) => __field_kind.set_index(index), - Self::ListOfComponentValues(_, __field_kind) => __field_kind.set_index(index), - Self::MediaAnd(_, __field_kind) => __field_kind.set_index(index), - Self::MediaCondition(_, __field_kind) => __field_kind.set_index(index), - Self::MediaConditionAllType(_, __field_kind) => __field_kind.set_index(index), - Self::MediaConditionType(_, __field_kind) => __field_kind.set_index(index), - Self::MediaConditionWithoutOr(_, __field_kind) => __field_kind.set_index(index), - Self::MediaConditionWithoutOrType(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeature(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureBoolean(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureName(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeaturePlain(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureRange(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureRangeComparison(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureRangeInterval(_, __field_kind) => __field_kind.set_index(index), - Self::MediaFeatureValue(_, __field_kind) => __field_kind.set_index(index), - Self::MediaInParens(_, __field_kind) => __field_kind.set_index(index), - Self::MediaNot(_, __field_kind) => __field_kind.set_index(index), - Self::MediaOr(_, __field_kind) => __field_kind.set_index(index), - Self::MediaQuery(_, __field_kind) => __field_kind.set_index(index), - Self::MediaQueryList(_, __field_kind) => __field_kind.set_index(index), - Self::MediaType(_, __field_kind) => __field_kind.set_index(index), - Self::NamedNamespace(_, __field_kind) => __field_kind.set_index(index), - Self::Namespace(_, __field_kind) => __field_kind.set_index(index), - Self::NamespacePrefix(_, __field_kind) => __field_kind.set_index(index), - Self::NamespacePrelude(_, __field_kind) => __field_kind.set_index(index), - Self::NamespacePreludeUri(_, __field_kind) => __field_kind.set_index(index), - Self::NestingSelector(_, __field_kind) => __field_kind.set_index(index), - Self::Number(_, __field_kind) => __field_kind.set_index(index), - Self::NumberType(_, __field_kind) => __field_kind.set_index(index), - Self::PageSelector(_, __field_kind) => __field_kind.set_index(index), - Self::PageSelectorList(_, __field_kind) => __field_kind.set_index(index), - Self::PageSelectorPseudo(_, __field_kind) => __field_kind.set_index(index), - Self::PageSelectorType(_, __field_kind) => __field_kind.set_index(index), - Self::Percentage(_, __field_kind) => __field_kind.set_index(index), - Self::PseudoClassSelector(_, __field_kind) => __field_kind.set_index(index), - Self::PseudoClassSelectorChildren(_, __field_kind) => __field_kind.set_index(index), - Self::PseudoElementSelector(_, __field_kind) => __field_kind.set_index(index), - Self::PseudoElementSelectorChildren(_, __field_kind) => { - __field_kind.set_index(index) - } - Self::QualifiedRule(_, __field_kind) => __field_kind.set_index(index), - Self::QualifiedRulePrelude(_, __field_kind) => __field_kind.set_index(index), - Self::QueryInParens(_, __field_kind) => __field_kind.set_index(index), - Self::Ratio(_, __field_kind) => __field_kind.set_index(index), - Self::RelativeSelector(_, __field_kind) => __field_kind.set_index(index), - Self::RelativeSelectorList(_, __field_kind) => __field_kind.set_index(index), - Self::Resolution(_, __field_kind) => __field_kind.set_index(index), - Self::Rule(_, __field_kind) => __field_kind.set_index(index), - Self::ScopeRange(_, __field_kind) => __field_kind.set_index(index), - Self::SelectorList(_, __field_kind) => __field_kind.set_index(index), - Self::SequenceOfCustomIdents(_, __field_kind) => __field_kind.set_index(index), - Self::SimpleBlock(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeature(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureBoolean(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureName(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeaturePlain(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureRange(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureRangeComparison(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureRangeInterval(_, __field_kind) => __field_kind.set_index(index), - Self::SizeFeatureValue(_, __field_kind) => __field_kind.set_index(index), - Self::Str(_, __field_kind) => __field_kind.set_index(index), - Self::StyleBlock(_, __field_kind) => __field_kind.set_index(index), - Self::Stylesheet(_, __field_kind) => __field_kind.set_index(index), - Self::SubclassSelector(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsAnd(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsCondition(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsConditionType(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsFeature(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsInParens(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsNot(_, __field_kind) => __field_kind.set_index(index), - Self::SupportsOr(_, __field_kind) => __field_kind.set_index(index), - Self::TagNameSelector(_, __field_kind) => __field_kind.set_index(index), - Self::Time(_, __field_kind) => __field_kind.set_index(index), - Self::TimePercentage(_, __field_kind) => __field_kind.set_index(index), - Self::Token(_, __field_kind) => __field_kind.set_index(index), - Self::TokenAndSpan(_, __field_kind) => __field_kind.set_index(index), - Self::TypeSelector(_, __field_kind) => __field_kind.set_index(index), - Self::UnicodeRange(_, __field_kind) => __field_kind.set_index(index), - Self::UniversalSelector(_, __field_kind) => __field_kind.set_index(index), - Self::UnknownDimension(_, __field_kind) => __field_kind.set_index(index), - Self::Url(_, __field_kind) => __field_kind.set_index(index), - Self::UrlKeyValue(_, __field_kind) => __field_kind.set_index(index), - Self::UrlModifier(_, __field_kind) => __field_kind.set_index(index), - Self::UrlValue(_, __field_kind) => __field_kind.set_index(index), - Self::UrlValueRaw(_, __field_kind) => __field_kind.set_index(index), - Self::WqName(_, __field_kind) => __field_kind.set_index(index), - } - } } } #[cfg(any(docsrs, feature = "path"))] diff --git a/crates/swc_ecma_visit/src/generated.rs b/crates/swc_ecma_visit/src/generated.rs index 9667015ec47..34153933317 100644 --- a/crates/swc_ecma_visit/src/generated.rs +++ b/crates/swc_ecma_visit/src/generated.rs @@ -159974,8 +159974,256 @@ pub mod fields { impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> { type ParentKind = AstParentKind; - #[inline] + #[inline(always)] fn kind(&self) -> AstParentKind { + self.kind() + } + + fn set_index(&mut self, index: usize) { + match self { + Self::Accessibility(_, __field_kind) => __field_kind.set_index(index), + Self::ArrayLit(_, __field_kind) => __field_kind.set_index(index), + Self::ArrayPat(_, __field_kind) => __field_kind.set_index(index), + Self::ArrowExpr(_, __field_kind) => __field_kind.set_index(index), + Self::AssignExpr(_, __field_kind) => __field_kind.set_index(index), + Self::AssignOp(_, __field_kind) => __field_kind.set_index(index), + Self::AssignPat(_, __field_kind) => __field_kind.set_index(index), + Self::AssignPatProp(_, __field_kind) => __field_kind.set_index(index), + Self::AssignProp(_, __field_kind) => __field_kind.set_index(index), + Self::AssignTarget(_, __field_kind) => __field_kind.set_index(index), + Self::AssignTargetPat(_, __field_kind) => __field_kind.set_index(index), + Self::AutoAccessor(_, __field_kind) => __field_kind.set_index(index), + Self::AwaitExpr(_, __field_kind) => __field_kind.set_index(index), + Self::BigInt(_, __field_kind) => __field_kind.set_index(index), + Self::BinExpr(_, __field_kind) => __field_kind.set_index(index), + Self::BinaryOp(_, __field_kind) => __field_kind.set_index(index), + Self::BindingIdent(_, __field_kind) => __field_kind.set_index(index), + Self::BlockStmt(_, __field_kind) => __field_kind.set_index(index), + Self::BlockStmtOrExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Bool(_, __field_kind) => __field_kind.set_index(index), + Self::BreakStmt(_, __field_kind) => __field_kind.set_index(index), + Self::CallExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Callee(_, __field_kind) => __field_kind.set_index(index), + Self::CatchClause(_, __field_kind) => __field_kind.set_index(index), + Self::Class(_, __field_kind) => __field_kind.set_index(index), + Self::ClassDecl(_, __field_kind) => __field_kind.set_index(index), + Self::ClassExpr(_, __field_kind) => __field_kind.set_index(index), + Self::ClassMember(_, __field_kind) => __field_kind.set_index(index), + Self::ClassMethod(_, __field_kind) => __field_kind.set_index(index), + Self::ClassProp(_, __field_kind) => __field_kind.set_index(index), + Self::ComputedPropName(_, __field_kind) => __field_kind.set_index(index), + Self::CondExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Constructor(_, __field_kind) => __field_kind.set_index(index), + Self::ContinueStmt(_, __field_kind) => __field_kind.set_index(index), + Self::DebuggerStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Decl(_, __field_kind) => __field_kind.set_index(index), + Self::Decorator(_, __field_kind) => __field_kind.set_index(index), + Self::DefaultDecl(_, __field_kind) => __field_kind.set_index(index), + Self::DoWhileStmt(_, __field_kind) => __field_kind.set_index(index), + Self::EmptyStmt(_, __field_kind) => __field_kind.set_index(index), + Self::EsVersion(_, __field_kind) => __field_kind.set_index(index), + Self::ExportAll(_, __field_kind) => __field_kind.set_index(index), + Self::ExportDecl(_, __field_kind) => __field_kind.set_index(index), + Self::ExportDefaultDecl(_, __field_kind) => __field_kind.set_index(index), + Self::ExportDefaultExpr(_, __field_kind) => __field_kind.set_index(index), + Self::ExportDefaultSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ExportNamedSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ExportNamespaceSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ExportSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::Expr(_, __field_kind) => __field_kind.set_index(index), + Self::ExprOrSpread(_, __field_kind) => __field_kind.set_index(index), + Self::ExprStmt(_, __field_kind) => __field_kind.set_index(index), + Self::FnDecl(_, __field_kind) => __field_kind.set_index(index), + Self::FnExpr(_, __field_kind) => __field_kind.set_index(index), + Self::ForHead(_, __field_kind) => __field_kind.set_index(index), + Self::ForInStmt(_, __field_kind) => __field_kind.set_index(index), + Self::ForOfStmt(_, __field_kind) => __field_kind.set_index(index), + Self::ForStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Function(_, __field_kind) => __field_kind.set_index(index), + Self::GetterProp(_, __field_kind) => __field_kind.set_index(index), + Self::Ident(_, __field_kind) => __field_kind.set_index(index), + Self::IdentName(_, __field_kind) => __field_kind.set_index(index), + Self::IfStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Import(_, __field_kind) => __field_kind.set_index(index), + Self::ImportDecl(_, __field_kind) => __field_kind.set_index(index), + Self::ImportDefaultSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ImportNamedSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ImportPhase(_, __field_kind) => __field_kind.set_index(index), + Self::ImportSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ImportStarAsSpecifier(_, __field_kind) => __field_kind.set_index(index), + Self::ImportWith(_, __field_kind) => __field_kind.set_index(index), + Self::ImportWithItem(_, __field_kind) => __field_kind.set_index(index), + Self::Invalid(_, __field_kind) => __field_kind.set_index(index), + Self::JSXAttr(_, __field_kind) => __field_kind.set_index(index), + Self::JSXAttrName(_, __field_kind) => __field_kind.set_index(index), + Self::JSXAttrOrSpread(_, __field_kind) => __field_kind.set_index(index), + Self::JSXAttrValue(_, __field_kind) => __field_kind.set_index(index), + Self::JSXClosingElement(_, __field_kind) => __field_kind.set_index(index), + Self::JSXClosingFragment(_, __field_kind) => __field_kind.set_index(index), + Self::JSXElement(_, __field_kind) => __field_kind.set_index(index), + Self::JSXElementChild(_, __field_kind) => __field_kind.set_index(index), + Self::JSXElementName(_, __field_kind) => __field_kind.set_index(index), + Self::JSXEmptyExpr(_, __field_kind) => __field_kind.set_index(index), + Self::JSXExpr(_, __field_kind) => __field_kind.set_index(index), + Self::JSXExprContainer(_, __field_kind) => __field_kind.set_index(index), + Self::JSXFragment(_, __field_kind) => __field_kind.set_index(index), + Self::JSXMemberExpr(_, __field_kind) => __field_kind.set_index(index), + Self::JSXNamespacedName(_, __field_kind) => __field_kind.set_index(index), + Self::JSXObject(_, __field_kind) => __field_kind.set_index(index), + Self::JSXOpeningElement(_, __field_kind) => __field_kind.set_index(index), + Self::JSXOpeningFragment(_, __field_kind) => __field_kind.set_index(index), + Self::JSXSpreadChild(_, __field_kind) => __field_kind.set_index(index), + Self::JSXText(_, __field_kind) => __field_kind.set_index(index), + Self::Key(_, __field_kind) => __field_kind.set_index(index), + Self::KeyValuePatProp(_, __field_kind) => __field_kind.set_index(index), + Self::KeyValueProp(_, __field_kind) => __field_kind.set_index(index), + Self::LabeledStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Lit(_, __field_kind) => __field_kind.set_index(index), + Self::MemberExpr(_, __field_kind) => __field_kind.set_index(index), + Self::MemberProp(_, __field_kind) => __field_kind.set_index(index), + Self::MetaPropExpr(_, __field_kind) => __field_kind.set_index(index), + Self::MetaPropKind(_, __field_kind) => __field_kind.set_index(index), + Self::MethodKind(_, __field_kind) => __field_kind.set_index(index), + Self::MethodProp(_, __field_kind) => __field_kind.set_index(index), + Self::Module(_, __field_kind) => __field_kind.set_index(index), + Self::ModuleDecl(_, __field_kind) => __field_kind.set_index(index), + Self::ModuleExportName(_, __field_kind) => __field_kind.set_index(index), + Self::ModuleItem(_, __field_kind) => __field_kind.set_index(index), + Self::NamedExport(_, __field_kind) => __field_kind.set_index(index), + Self::NewExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Null(_, __field_kind) => __field_kind.set_index(index), + Self::Number(_, __field_kind) => __field_kind.set_index(index), + Self::ObjectLit(_, __field_kind) => __field_kind.set_index(index), + Self::ObjectPat(_, __field_kind) => __field_kind.set_index(index), + Self::ObjectPatProp(_, __field_kind) => __field_kind.set_index(index), + Self::OptCall(_, __field_kind) => __field_kind.set_index(index), + Self::OptChainBase(_, __field_kind) => __field_kind.set_index(index), + Self::OptChainExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Param(_, __field_kind) => __field_kind.set_index(index), + Self::ParamOrTsParamProp(_, __field_kind) => __field_kind.set_index(index), + Self::ParenExpr(_, __field_kind) => __field_kind.set_index(index), + Self::Pat(_, __field_kind) => __field_kind.set_index(index), + Self::PrivateMethod(_, __field_kind) => __field_kind.set_index(index), + Self::PrivateName(_, __field_kind) => __field_kind.set_index(index), + Self::PrivateProp(_, __field_kind) => __field_kind.set_index(index), + Self::Program(_, __field_kind) => __field_kind.set_index(index), + Self::Prop(_, __field_kind) => __field_kind.set_index(index), + Self::PropName(_, __field_kind) => __field_kind.set_index(index), + Self::PropOrSpread(_, __field_kind) => __field_kind.set_index(index), + Self::Regex(_, __field_kind) => __field_kind.set_index(index), + Self::ReservedUnused(_, __field_kind) => __field_kind.set_index(index), + Self::RestPat(_, __field_kind) => __field_kind.set_index(index), + Self::ReturnStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Script(_, __field_kind) => __field_kind.set_index(index), + Self::SeqExpr(_, __field_kind) => __field_kind.set_index(index), + Self::SetterProp(_, __field_kind) => __field_kind.set_index(index), + Self::SimpleAssignTarget(_, __field_kind) => __field_kind.set_index(index), + Self::SpreadElement(_, __field_kind) => __field_kind.set_index(index), + Self::StaticBlock(_, __field_kind) => __field_kind.set_index(index), + Self::Stmt(_, __field_kind) => __field_kind.set_index(index), + Self::Str(_, __field_kind) => __field_kind.set_index(index), + Self::Super(_, __field_kind) => __field_kind.set_index(index), + Self::SuperProp(_, __field_kind) => __field_kind.set_index(index), + Self::SuperPropExpr(_, __field_kind) => __field_kind.set_index(index), + Self::SwitchCase(_, __field_kind) => __field_kind.set_index(index), + Self::SwitchStmt(_, __field_kind) => __field_kind.set_index(index), + Self::TaggedTpl(_, __field_kind) => __field_kind.set_index(index), + Self::ThisExpr(_, __field_kind) => __field_kind.set_index(index), + Self::ThrowStmt(_, __field_kind) => __field_kind.set_index(index), + Self::Tpl(_, __field_kind) => __field_kind.set_index(index), + Self::TplElement(_, __field_kind) => __field_kind.set_index(index), + Self::TruePlusMinus(_, __field_kind) => __field_kind.set_index(index), + Self::TryStmt(_, __field_kind) => __field_kind.set_index(index), + Self::TsArrayType(_, __field_kind) => __field_kind.set_index(index), + Self::TsAsExpr(_, __field_kind) => __field_kind.set_index(index), + Self::TsCallSignatureDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsConditionalType(_, __field_kind) => __field_kind.set_index(index), + Self::TsConstAssertion(_, __field_kind) => __field_kind.set_index(index), + Self::TsConstructSignatureDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsConstructorType(_, __field_kind) => __field_kind.set_index(index), + Self::TsEntityName(_, __field_kind) => __field_kind.set_index(index), + Self::TsEnumDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsEnumMember(_, __field_kind) => __field_kind.set_index(index), + Self::TsEnumMemberId(_, __field_kind) => __field_kind.set_index(index), + Self::TsExportAssignment(_, __field_kind) => __field_kind.set_index(index), + Self::TsExprWithTypeArgs(_, __field_kind) => __field_kind.set_index(index), + Self::TsExternalModuleRef(_, __field_kind) => __field_kind.set_index(index), + Self::TsFnOrConstructorType(_, __field_kind) => __field_kind.set_index(index), + Self::TsFnParam(_, __field_kind) => __field_kind.set_index(index), + Self::TsFnType(_, __field_kind) => __field_kind.set_index(index), + Self::TsGetterSignature(_, __field_kind) => __field_kind.set_index(index), + Self::TsImportEqualsDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsImportType(_, __field_kind) => __field_kind.set_index(index), + Self::TsIndexSignature(_, __field_kind) => __field_kind.set_index(index), + Self::TsIndexedAccessType(_, __field_kind) => __field_kind.set_index(index), + Self::TsInferType(_, __field_kind) => __field_kind.set_index(index), + Self::TsInstantiation(_, __field_kind) => __field_kind.set_index(index), + Self::TsInterfaceBody(_, __field_kind) => __field_kind.set_index(index), + Self::TsInterfaceDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsIntersectionType(_, __field_kind) => __field_kind.set_index(index), + Self::TsKeywordType(_, __field_kind) => __field_kind.set_index(index), + Self::TsKeywordTypeKind(_, __field_kind) => __field_kind.set_index(index), + Self::TsLit(_, __field_kind) => __field_kind.set_index(index), + Self::TsLitType(_, __field_kind) => __field_kind.set_index(index), + Self::TsMappedType(_, __field_kind) => __field_kind.set_index(index), + Self::TsMethodSignature(_, __field_kind) => __field_kind.set_index(index), + Self::TsModuleBlock(_, __field_kind) => __field_kind.set_index(index), + Self::TsModuleDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsModuleName(_, __field_kind) => __field_kind.set_index(index), + Self::TsModuleRef(_, __field_kind) => __field_kind.set_index(index), + Self::TsNamespaceBody(_, __field_kind) => __field_kind.set_index(index), + Self::TsNamespaceDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsNamespaceExportDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsNonNullExpr(_, __field_kind) => __field_kind.set_index(index), + Self::TsOptionalType(_, __field_kind) => __field_kind.set_index(index), + Self::TsParamProp(_, __field_kind) => __field_kind.set_index(index), + Self::TsParamPropParam(_, __field_kind) => __field_kind.set_index(index), + Self::TsParenthesizedType(_, __field_kind) => __field_kind.set_index(index), + Self::TsPropertySignature(_, __field_kind) => __field_kind.set_index(index), + Self::TsQualifiedName(_, __field_kind) => __field_kind.set_index(index), + Self::TsRestType(_, __field_kind) => __field_kind.set_index(index), + Self::TsSatisfiesExpr(_, __field_kind) => __field_kind.set_index(index), + Self::TsSetterSignature(_, __field_kind) => __field_kind.set_index(index), + Self::TsThisType(_, __field_kind) => __field_kind.set_index(index), + Self::TsThisTypeOrIdent(_, __field_kind) => __field_kind.set_index(index), + Self::TsTplLitType(_, __field_kind) => __field_kind.set_index(index), + Self::TsTupleElement(_, __field_kind) => __field_kind.set_index(index), + Self::TsTupleType(_, __field_kind) => __field_kind.set_index(index), + Self::TsType(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeAliasDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeAnn(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeAssertion(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeElement(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeLit(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeOperator(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeOperatorOp(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeParam(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeParamDecl(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeParamInstantiation(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypePredicate(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeQuery(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeQueryExpr(_, __field_kind) => __field_kind.set_index(index), + Self::TsTypeRef(_, __field_kind) => __field_kind.set_index(index), + Self::TsUnionOrIntersectionType(_, __field_kind) => __field_kind.set_index(index), + Self::TsUnionType(_, __field_kind) => __field_kind.set_index(index), + Self::UnaryExpr(_, __field_kind) => __field_kind.set_index(index), + Self::UnaryOp(_, __field_kind) => __field_kind.set_index(index), + Self::UpdateExpr(_, __field_kind) => __field_kind.set_index(index), + Self::UpdateOp(_, __field_kind) => __field_kind.set_index(index), + Self::UsingDecl(_, __field_kind) => __field_kind.set_index(index), + Self::VarDecl(_, __field_kind) => __field_kind.set_index(index), + Self::VarDeclKind(_, __field_kind) => __field_kind.set_index(index), + Self::VarDeclOrExpr(_, __field_kind) => __field_kind.set_index(index), + Self::VarDeclarator(_, __field_kind) => __field_kind.set_index(index), + Self::WhileStmt(_, __field_kind) => __field_kind.set_index(index), + Self::WithStmt(_, __field_kind) => __field_kind.set_index(index), + Self::YieldExpr(_, __field_kind) => __field_kind.set_index(index), + } + } + } + impl<'ast> AstParentNodeRef<'ast> { + #[inline] + pub fn kind(&self) -> AstParentKind { match self { Self::Accessibility(_, __field_kind) => AstParentKind::Accessibility(*__field_kind), Self::ArrayLit(_, __field_kind) => AstParentKind::ArrayLit(*__field_kind), @@ -160356,248 +160604,6 @@ pub mod fields { Self::YieldExpr(_, __field_kind) => AstParentKind::YieldExpr(*__field_kind), } } - - fn set_index(&mut self, index: usize) { - match self { - Self::Accessibility(_, __field_kind) => __field_kind.set_index(index), - Self::ArrayLit(_, __field_kind) => __field_kind.set_index(index), - Self::ArrayPat(_, __field_kind) => __field_kind.set_index(index), - Self::ArrowExpr(_, __field_kind) => __field_kind.set_index(index), - Self::AssignExpr(_, __field_kind) => __field_kind.set_index(index), - Self::AssignOp(_, __field_kind) => __field_kind.set_index(index), - Self::AssignPat(_, __field_kind) => __field_kind.set_index(index), - Self::AssignPatProp(_, __field_kind) => __field_kind.set_index(index), - Self::AssignProp(_, __field_kind) => __field_kind.set_index(index), - Self::AssignTarget(_, __field_kind) => __field_kind.set_index(index), - Self::AssignTargetPat(_, __field_kind) => __field_kind.set_index(index), - Self::AutoAccessor(_, __field_kind) => __field_kind.set_index(index), - Self::AwaitExpr(_, __field_kind) => __field_kind.set_index(index), - Self::BigInt(_, __field_kind) => __field_kind.set_index(index), - Self::BinExpr(_, __field_kind) => __field_kind.set_index(index), - Self::BinaryOp(_, __field_kind) => __field_kind.set_index(index), - Self::BindingIdent(_, __field_kind) => __field_kind.set_index(index), - Self::BlockStmt(_, __field_kind) => __field_kind.set_index(index), - Self::BlockStmtOrExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Bool(_, __field_kind) => __field_kind.set_index(index), - Self::BreakStmt(_, __field_kind) => __field_kind.set_index(index), - Self::CallExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Callee(_, __field_kind) => __field_kind.set_index(index), - Self::CatchClause(_, __field_kind) => __field_kind.set_index(index), - Self::Class(_, __field_kind) => __field_kind.set_index(index), - Self::ClassDecl(_, __field_kind) => __field_kind.set_index(index), - Self::ClassExpr(_, __field_kind) => __field_kind.set_index(index), - Self::ClassMember(_, __field_kind) => __field_kind.set_index(index), - Self::ClassMethod(_, __field_kind) => __field_kind.set_index(index), - Self::ClassProp(_, __field_kind) => __field_kind.set_index(index), - Self::ComputedPropName(_, __field_kind) => __field_kind.set_index(index), - Self::CondExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Constructor(_, __field_kind) => __field_kind.set_index(index), - Self::ContinueStmt(_, __field_kind) => __field_kind.set_index(index), - Self::DebuggerStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Decl(_, __field_kind) => __field_kind.set_index(index), - Self::Decorator(_, __field_kind) => __field_kind.set_index(index), - Self::DefaultDecl(_, __field_kind) => __field_kind.set_index(index), - Self::DoWhileStmt(_, __field_kind) => __field_kind.set_index(index), - Self::EmptyStmt(_, __field_kind) => __field_kind.set_index(index), - Self::EsVersion(_, __field_kind) => __field_kind.set_index(index), - Self::ExportAll(_, __field_kind) => __field_kind.set_index(index), - Self::ExportDecl(_, __field_kind) => __field_kind.set_index(index), - Self::ExportDefaultDecl(_, __field_kind) => __field_kind.set_index(index), - Self::ExportDefaultExpr(_, __field_kind) => __field_kind.set_index(index), - Self::ExportDefaultSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ExportNamedSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ExportNamespaceSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ExportSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::Expr(_, __field_kind) => __field_kind.set_index(index), - Self::ExprOrSpread(_, __field_kind) => __field_kind.set_index(index), - Self::ExprStmt(_, __field_kind) => __field_kind.set_index(index), - Self::FnDecl(_, __field_kind) => __field_kind.set_index(index), - Self::FnExpr(_, __field_kind) => __field_kind.set_index(index), - Self::ForHead(_, __field_kind) => __field_kind.set_index(index), - Self::ForInStmt(_, __field_kind) => __field_kind.set_index(index), - Self::ForOfStmt(_, __field_kind) => __field_kind.set_index(index), - Self::ForStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Function(_, __field_kind) => __field_kind.set_index(index), - Self::GetterProp(_, __field_kind) => __field_kind.set_index(index), - Self::Ident(_, __field_kind) => __field_kind.set_index(index), - Self::IdentName(_, __field_kind) => __field_kind.set_index(index), - Self::IfStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Import(_, __field_kind) => __field_kind.set_index(index), - Self::ImportDecl(_, __field_kind) => __field_kind.set_index(index), - Self::ImportDefaultSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ImportNamedSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ImportPhase(_, __field_kind) => __field_kind.set_index(index), - Self::ImportSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ImportStarAsSpecifier(_, __field_kind) => __field_kind.set_index(index), - Self::ImportWith(_, __field_kind) => __field_kind.set_index(index), - Self::ImportWithItem(_, __field_kind) => __field_kind.set_index(index), - Self::Invalid(_, __field_kind) => __field_kind.set_index(index), - Self::JSXAttr(_, __field_kind) => __field_kind.set_index(index), - Self::JSXAttrName(_, __field_kind) => __field_kind.set_index(index), - Self::JSXAttrOrSpread(_, __field_kind) => __field_kind.set_index(index), - Self::JSXAttrValue(_, __field_kind) => __field_kind.set_index(index), - Self::JSXClosingElement(_, __field_kind) => __field_kind.set_index(index), - Self::JSXClosingFragment(_, __field_kind) => __field_kind.set_index(index), - Self::JSXElement(_, __field_kind) => __field_kind.set_index(index), - Self::JSXElementChild(_, __field_kind) => __field_kind.set_index(index), - Self::JSXElementName(_, __field_kind) => __field_kind.set_index(index), - Self::JSXEmptyExpr(_, __field_kind) => __field_kind.set_index(index), - Self::JSXExpr(_, __field_kind) => __field_kind.set_index(index), - Self::JSXExprContainer(_, __field_kind) => __field_kind.set_index(index), - Self::JSXFragment(_, __field_kind) => __field_kind.set_index(index), - Self::JSXMemberExpr(_, __field_kind) => __field_kind.set_index(index), - Self::JSXNamespacedName(_, __field_kind) => __field_kind.set_index(index), - Self::JSXObject(_, __field_kind) => __field_kind.set_index(index), - Self::JSXOpeningElement(_, __field_kind) => __field_kind.set_index(index), - Self::JSXOpeningFragment(_, __field_kind) => __field_kind.set_index(index), - Self::JSXSpreadChild(_, __field_kind) => __field_kind.set_index(index), - Self::JSXText(_, __field_kind) => __field_kind.set_index(index), - Self::Key(_, __field_kind) => __field_kind.set_index(index), - Self::KeyValuePatProp(_, __field_kind) => __field_kind.set_index(index), - Self::KeyValueProp(_, __field_kind) => __field_kind.set_index(index), - Self::LabeledStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Lit(_, __field_kind) => __field_kind.set_index(index), - Self::MemberExpr(_, __field_kind) => __field_kind.set_index(index), - Self::MemberProp(_, __field_kind) => __field_kind.set_index(index), - Self::MetaPropExpr(_, __field_kind) => __field_kind.set_index(index), - Self::MetaPropKind(_, __field_kind) => __field_kind.set_index(index), - Self::MethodKind(_, __field_kind) => __field_kind.set_index(index), - Self::MethodProp(_, __field_kind) => __field_kind.set_index(index), - Self::Module(_, __field_kind) => __field_kind.set_index(index), - Self::ModuleDecl(_, __field_kind) => __field_kind.set_index(index), - Self::ModuleExportName(_, __field_kind) => __field_kind.set_index(index), - Self::ModuleItem(_, __field_kind) => __field_kind.set_index(index), - Self::NamedExport(_, __field_kind) => __field_kind.set_index(index), - Self::NewExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Null(_, __field_kind) => __field_kind.set_index(index), - Self::Number(_, __field_kind) => __field_kind.set_index(index), - Self::ObjectLit(_, __field_kind) => __field_kind.set_index(index), - Self::ObjectPat(_, __field_kind) => __field_kind.set_index(index), - Self::ObjectPatProp(_, __field_kind) => __field_kind.set_index(index), - Self::OptCall(_, __field_kind) => __field_kind.set_index(index), - Self::OptChainBase(_, __field_kind) => __field_kind.set_index(index), - Self::OptChainExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Param(_, __field_kind) => __field_kind.set_index(index), - Self::ParamOrTsParamProp(_, __field_kind) => __field_kind.set_index(index), - Self::ParenExpr(_, __field_kind) => __field_kind.set_index(index), - Self::Pat(_, __field_kind) => __field_kind.set_index(index), - Self::PrivateMethod(_, __field_kind) => __field_kind.set_index(index), - Self::PrivateName(_, __field_kind) => __field_kind.set_index(index), - Self::PrivateProp(_, __field_kind) => __field_kind.set_index(index), - Self::Program(_, __field_kind) => __field_kind.set_index(index), - Self::Prop(_, __field_kind) => __field_kind.set_index(index), - Self::PropName(_, __field_kind) => __field_kind.set_index(index), - Self::PropOrSpread(_, __field_kind) => __field_kind.set_index(index), - Self::Regex(_, __field_kind) => __field_kind.set_index(index), - Self::ReservedUnused(_, __field_kind) => __field_kind.set_index(index), - Self::RestPat(_, __field_kind) => __field_kind.set_index(index), - Self::ReturnStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Script(_, __field_kind) => __field_kind.set_index(index), - Self::SeqExpr(_, __field_kind) => __field_kind.set_index(index), - Self::SetterProp(_, __field_kind) => __field_kind.set_index(index), - Self::SimpleAssignTarget(_, __field_kind) => __field_kind.set_index(index), - Self::SpreadElement(_, __field_kind) => __field_kind.set_index(index), - Self::StaticBlock(_, __field_kind) => __field_kind.set_index(index), - Self::Stmt(_, __field_kind) => __field_kind.set_index(index), - Self::Str(_, __field_kind) => __field_kind.set_index(index), - Self::Super(_, __field_kind) => __field_kind.set_index(index), - Self::SuperProp(_, __field_kind) => __field_kind.set_index(index), - Self::SuperPropExpr(_, __field_kind) => __field_kind.set_index(index), - Self::SwitchCase(_, __field_kind) => __field_kind.set_index(index), - Self::SwitchStmt(_, __field_kind) => __field_kind.set_index(index), - Self::TaggedTpl(_, __field_kind) => __field_kind.set_index(index), - Self::ThisExpr(_, __field_kind) => __field_kind.set_index(index), - Self::ThrowStmt(_, __field_kind) => __field_kind.set_index(index), - Self::Tpl(_, __field_kind) => __field_kind.set_index(index), - Self::TplElement(_, __field_kind) => __field_kind.set_index(index), - Self::TruePlusMinus(_, __field_kind) => __field_kind.set_index(index), - Self::TryStmt(_, __field_kind) => __field_kind.set_index(index), - Self::TsArrayType(_, __field_kind) => __field_kind.set_index(index), - Self::TsAsExpr(_, __field_kind) => __field_kind.set_index(index), - Self::TsCallSignatureDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsConditionalType(_, __field_kind) => __field_kind.set_index(index), - Self::TsConstAssertion(_, __field_kind) => __field_kind.set_index(index), - Self::TsConstructSignatureDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsConstructorType(_, __field_kind) => __field_kind.set_index(index), - Self::TsEntityName(_, __field_kind) => __field_kind.set_index(index), - Self::TsEnumDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsEnumMember(_, __field_kind) => __field_kind.set_index(index), - Self::TsEnumMemberId(_, __field_kind) => __field_kind.set_index(index), - Self::TsExportAssignment(_, __field_kind) => __field_kind.set_index(index), - Self::TsExprWithTypeArgs(_, __field_kind) => __field_kind.set_index(index), - Self::TsExternalModuleRef(_, __field_kind) => __field_kind.set_index(index), - Self::TsFnOrConstructorType(_, __field_kind) => __field_kind.set_index(index), - Self::TsFnParam(_, __field_kind) => __field_kind.set_index(index), - Self::TsFnType(_, __field_kind) => __field_kind.set_index(index), - Self::TsGetterSignature(_, __field_kind) => __field_kind.set_index(index), - Self::TsImportEqualsDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsImportType(_, __field_kind) => __field_kind.set_index(index), - Self::TsIndexSignature(_, __field_kind) => __field_kind.set_index(index), - Self::TsIndexedAccessType(_, __field_kind) => __field_kind.set_index(index), - Self::TsInferType(_, __field_kind) => __field_kind.set_index(index), - Self::TsInstantiation(_, __field_kind) => __field_kind.set_index(index), - Self::TsInterfaceBody(_, __field_kind) => __field_kind.set_index(index), - Self::TsInterfaceDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsIntersectionType(_, __field_kind) => __field_kind.set_index(index), - Self::TsKeywordType(_, __field_kind) => __field_kind.set_index(index), - Self::TsKeywordTypeKind(_, __field_kind) => __field_kind.set_index(index), - Self::TsLit(_, __field_kind) => __field_kind.set_index(index), - Self::TsLitType(_, __field_kind) => __field_kind.set_index(index), - Self::TsMappedType(_, __field_kind) => __field_kind.set_index(index), - Self::TsMethodSignature(_, __field_kind) => __field_kind.set_index(index), - Self::TsModuleBlock(_, __field_kind) => __field_kind.set_index(index), - Self::TsModuleDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsModuleName(_, __field_kind) => __field_kind.set_index(index), - Self::TsModuleRef(_, __field_kind) => __field_kind.set_index(index), - Self::TsNamespaceBody(_, __field_kind) => __field_kind.set_index(index), - Self::TsNamespaceDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsNamespaceExportDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsNonNullExpr(_, __field_kind) => __field_kind.set_index(index), - Self::TsOptionalType(_, __field_kind) => __field_kind.set_index(index), - Self::TsParamProp(_, __field_kind) => __field_kind.set_index(index), - Self::TsParamPropParam(_, __field_kind) => __field_kind.set_index(index), - Self::TsParenthesizedType(_, __field_kind) => __field_kind.set_index(index), - Self::TsPropertySignature(_, __field_kind) => __field_kind.set_index(index), - Self::TsQualifiedName(_, __field_kind) => __field_kind.set_index(index), - Self::TsRestType(_, __field_kind) => __field_kind.set_index(index), - Self::TsSatisfiesExpr(_, __field_kind) => __field_kind.set_index(index), - Self::TsSetterSignature(_, __field_kind) => __field_kind.set_index(index), - Self::TsThisType(_, __field_kind) => __field_kind.set_index(index), - Self::TsThisTypeOrIdent(_, __field_kind) => __field_kind.set_index(index), - Self::TsTplLitType(_, __field_kind) => __field_kind.set_index(index), - Self::TsTupleElement(_, __field_kind) => __field_kind.set_index(index), - Self::TsTupleType(_, __field_kind) => __field_kind.set_index(index), - Self::TsType(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeAliasDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeAnn(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeAssertion(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeElement(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeLit(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeOperator(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeOperatorOp(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeParam(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeParamDecl(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeParamInstantiation(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypePredicate(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeQuery(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeQueryExpr(_, __field_kind) => __field_kind.set_index(index), - Self::TsTypeRef(_, __field_kind) => __field_kind.set_index(index), - Self::TsUnionOrIntersectionType(_, __field_kind) => __field_kind.set_index(index), - Self::TsUnionType(_, __field_kind) => __field_kind.set_index(index), - Self::UnaryExpr(_, __field_kind) => __field_kind.set_index(index), - Self::UnaryOp(_, __field_kind) => __field_kind.set_index(index), - Self::UpdateExpr(_, __field_kind) => __field_kind.set_index(index), - Self::UpdateOp(_, __field_kind) => __field_kind.set_index(index), - Self::UsingDecl(_, __field_kind) => __field_kind.set_index(index), - Self::VarDecl(_, __field_kind) => __field_kind.set_index(index), - Self::VarDeclKind(_, __field_kind) => __field_kind.set_index(index), - Self::VarDeclOrExpr(_, __field_kind) => __field_kind.set_index(index), - Self::VarDeclarator(_, __field_kind) => __field_kind.set_index(index), - Self::WhileStmt(_, __field_kind) => __field_kind.set_index(index), - Self::WithStmt(_, __field_kind) => __field_kind.set_index(index), - Self::YieldExpr(_, __field_kind) => __field_kind.set_index(index), - } - } } } #[cfg(any(docsrs, feature = "path"))] diff --git a/crates/swc_html_visit/src/generated.rs b/crates/swc_html_visit/src/generated.rs index 6bc0b0a5f47..d8f6dc1e4ca 100644 --- a/crates/swc_html_visit/src/generated.rs +++ b/crates/swc_html_visit/src/generated.rs @@ -12612,28 +12612,9 @@ pub mod fields { impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> { type ParentKind = AstParentKind; - #[inline] + #[inline(always)] fn kind(&self) -> AstParentKind { - match self { - Self::Attribute(_, __field_kind) => AstParentKind::Attribute(*__field_kind), - Self::AttributeToken(_, __field_kind) => { - AstParentKind::AttributeToken(*__field_kind) - } - Self::Child(_, __field_kind) => AstParentKind::Child(*__field_kind), - Self::Comment(_, __field_kind) => AstParentKind::Comment(*__field_kind), - Self::Document(_, __field_kind) => AstParentKind::Document(*__field_kind), - Self::DocumentFragment(_, __field_kind) => { - AstParentKind::DocumentFragment(*__field_kind) - } - Self::DocumentMode(_, __field_kind) => AstParentKind::DocumentMode(*__field_kind), - Self::DocumentType(_, __field_kind) => AstParentKind::DocumentType(*__field_kind), - Self::Element(_, __field_kind) => AstParentKind::Element(*__field_kind), - Self::Namespace(_, __field_kind) => AstParentKind::Namespace(*__field_kind), - Self::Raw(_, __field_kind) => AstParentKind::Raw(*__field_kind), - Self::Text(_, __field_kind) => AstParentKind::Text(*__field_kind), - Self::Token(_, __field_kind) => AstParentKind::Token(*__field_kind), - Self::TokenAndSpan(_, __field_kind) => AstParentKind::TokenAndSpan(*__field_kind), - } + self.kind() } fn set_index(&mut self, index: usize) { @@ -12655,6 +12636,31 @@ pub mod fields { } } } + impl<'ast> AstParentNodeRef<'ast> { + #[inline] + pub fn kind(&self) -> AstParentKind { + match self { + Self::Attribute(_, __field_kind) => AstParentKind::Attribute(*__field_kind), + Self::AttributeToken(_, __field_kind) => { + AstParentKind::AttributeToken(*__field_kind) + } + Self::Child(_, __field_kind) => AstParentKind::Child(*__field_kind), + Self::Comment(_, __field_kind) => AstParentKind::Comment(*__field_kind), + Self::Document(_, __field_kind) => AstParentKind::Document(*__field_kind), + Self::DocumentFragment(_, __field_kind) => { + AstParentKind::DocumentFragment(*__field_kind) + } + Self::DocumentMode(_, __field_kind) => AstParentKind::DocumentMode(*__field_kind), + Self::DocumentType(_, __field_kind) => AstParentKind::DocumentType(*__field_kind), + Self::Element(_, __field_kind) => AstParentKind::Element(*__field_kind), + Self::Namespace(_, __field_kind) => AstParentKind::Namespace(*__field_kind), + Self::Raw(_, __field_kind) => AstParentKind::Raw(*__field_kind), + Self::Text(_, __field_kind) => AstParentKind::Text(*__field_kind), + Self::Token(_, __field_kind) => AstParentKind::Token(*__field_kind), + Self::TokenAndSpan(_, __field_kind) => AstParentKind::TokenAndSpan(*__field_kind), + } + } + } } #[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 e78227baf94..0edc54a5012 100644 --- a/crates/swc_xml_visit/src/generated.rs +++ b/crates/swc_xml_visit/src/generated.rs @@ -12084,28 +12084,9 @@ pub mod fields { impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> { type ParentKind = AstParentKind; - #[inline] + #[inline(always)] fn kind(&self) -> AstParentKind { - match self { - Self::Attribute(_, __field_kind) => AstParentKind::Attribute(*__field_kind), - Self::AttributeToken(_, __field_kind) => { - AstParentKind::AttributeToken(*__field_kind) - } - Self::CdataSection(_, __field_kind) => AstParentKind::CdataSection(*__field_kind), - Self::Child(_, __field_kind) => AstParentKind::Child(*__field_kind), - Self::Comment(_, __field_kind) => AstParentKind::Comment(*__field_kind), - Self::Document(_, __field_kind) => AstParentKind::Document(*__field_kind), - Self::DocumentMode(_, __field_kind) => AstParentKind::DocumentMode(*__field_kind), - Self::DocumentType(_, __field_kind) => AstParentKind::DocumentType(*__field_kind), - Self::Element(_, __field_kind) => AstParentKind::Element(*__field_kind), - Self::Namespace(_, __field_kind) => AstParentKind::Namespace(*__field_kind), - Self::ProcessingInstruction(_, __field_kind) => { - AstParentKind::ProcessingInstruction(*__field_kind) - } - Self::Text(_, __field_kind) => AstParentKind::Text(*__field_kind), - Self::Token(_, __field_kind) => AstParentKind::Token(*__field_kind), - Self::TokenAndSpan(_, __field_kind) => AstParentKind::TokenAndSpan(*__field_kind), - } + self.kind() } fn set_index(&mut self, index: usize) { @@ -12127,6 +12108,31 @@ pub mod fields { } } } + impl<'ast> AstParentNodeRef<'ast> { + #[inline] + pub fn kind(&self) -> AstParentKind { + match self { + Self::Attribute(_, __field_kind) => AstParentKind::Attribute(*__field_kind), + Self::AttributeToken(_, __field_kind) => { + AstParentKind::AttributeToken(*__field_kind) + } + Self::CdataSection(_, __field_kind) => AstParentKind::CdataSection(*__field_kind), + Self::Child(_, __field_kind) => AstParentKind::Child(*__field_kind), + Self::Comment(_, __field_kind) => AstParentKind::Comment(*__field_kind), + Self::Document(_, __field_kind) => AstParentKind::Document(*__field_kind), + Self::DocumentMode(_, __field_kind) => AstParentKind::DocumentMode(*__field_kind), + Self::DocumentType(_, __field_kind) => AstParentKind::DocumentType(*__field_kind), + Self::Element(_, __field_kind) => AstParentKind::Element(*__field_kind), + Self::Namespace(_, __field_kind) => AstParentKind::Namespace(*__field_kind), + Self::ProcessingInstruction(_, __field_kind) => { + AstParentKind::ProcessingInstruction(*__field_kind) + } + Self::Text(_, __field_kind) => AstParentKind::Text(*__field_kind), + Self::Token(_, __field_kind) => AstParentKind::Token(*__field_kind), + Self::TokenAndSpan(_, __field_kind) => AstParentKind::TokenAndSpan(*__field_kind), + } + } + } } #[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 026f2358c34..a38dd2643a9 100644 --- a/tools/generate-code/src/generators/visitor.rs +++ b/tools/generate-code/src/generators/visitor.rs @@ -1440,11 +1440,9 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { impl<'ast> ::swc_visit::NodeRef for AstParentNodeRef<'ast> { type ParentKind = AstParentKind; - #[inline] + #[inline(always)] fn kind(&self) -> AstParentKind { - match self { - #(#node_ref_kind_arms)* - } + self.kind() } fn set_index(&mut self, index: usize) { @@ -1454,6 +1452,16 @@ fn define_fields(crate_name: &Ident, node_types: &[&Item]) -> Vec { } } )); + defs.push(parse_quote!( + impl<'ast> AstParentNodeRef<'ast> { + #[inline] + pub fn kind(&self) -> AstParentKind { + match self { + #(#node_ref_kind_arms)* + } + } + } + )); } items.push(parse_quote!(