diff --git a/crates/oxc_ast/src/generated/span.rs b/crates/oxc_ast/src/generated/span.rs index 73013419d69a5..fef350ad706be 100644 --- a/crates/oxc_ast/src/generated/span.rs +++ b/crates/oxc_ast/src/generated/span.rs @@ -4,7 +4,7 @@ #![allow(clippy::match_same_arms)] use crate::ast::*; -use oxc_span::{GetSpan, Span}; +use oxc_span::{GetSpan, GetSpanMut, Span}; impl GetSpan for BooleanLiteral { #[inline] @@ -13,6 +13,13 @@ impl GetSpan for BooleanLiteral { } } +impl GetSpanMut for BooleanLiteral { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for NullLiteral { #[inline] fn span(&self) -> Span { @@ -20,6 +27,13 @@ impl GetSpan for NullLiteral { } } +impl GetSpanMut for NullLiteral { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for NumericLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -27,6 +41,13 @@ impl<'a> GetSpan for NumericLiteral<'a> { } } +impl<'a> GetSpanMut for NumericLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BigIntLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -34,6 +55,13 @@ impl<'a> GetSpan for BigIntLiteral<'a> { } } +impl<'a> GetSpanMut for BigIntLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for RegExpLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -41,6 +69,13 @@ impl<'a> GetSpan for RegExpLiteral<'a> { } } +impl<'a> GetSpanMut for RegExpLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for StringLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -48,6 +83,13 @@ impl<'a> GetSpan for StringLiteral<'a> { } } +impl<'a> GetSpanMut for StringLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Program<'a> { #[inline] fn span(&self) -> Span { @@ -55,6 +97,13 @@ impl<'a> GetSpan for Program<'a> { } } +impl<'a> GetSpanMut for Program<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Expression<'a> { fn span(&self) -> Span { match self { @@ -104,6 +153,55 @@ impl<'a> GetSpan for Expression<'a> { } } +impl<'a> GetSpanMut for Expression<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for IdentifierName<'a> { #[inline] fn span(&self) -> Span { @@ -111,6 +209,13 @@ impl<'a> GetSpan for IdentifierName<'a> { } } +impl<'a> GetSpanMut for IdentifierName<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for IdentifierReference<'a> { #[inline] fn span(&self) -> Span { @@ -118,6 +223,13 @@ impl<'a> GetSpan for IdentifierReference<'a> { } } +impl<'a> GetSpanMut for IdentifierReference<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BindingIdentifier<'a> { #[inline] fn span(&self) -> Span { @@ -125,6 +237,13 @@ impl<'a> GetSpan for BindingIdentifier<'a> { } } +impl<'a> GetSpanMut for BindingIdentifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for LabelIdentifier<'a> { #[inline] fn span(&self) -> Span { @@ -132,6 +251,13 @@ impl<'a> GetSpan for LabelIdentifier<'a> { } } +impl<'a> GetSpanMut for LabelIdentifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for ThisExpression { #[inline] fn span(&self) -> Span { @@ -139,6 +265,13 @@ impl GetSpan for ThisExpression { } } +impl GetSpanMut for ThisExpression { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ArrayExpression<'a> { #[inline] fn span(&self) -> Span { @@ -146,6 +279,13 @@ impl<'a> GetSpan for ArrayExpression<'a> { } } +impl<'a> GetSpanMut for ArrayExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ArrayExpressionElement<'a> { fn span(&self) -> Span { match self { @@ -197,6 +337,57 @@ impl<'a> GetSpan for ArrayExpressionElement<'a> { } } +impl<'a> GetSpanMut for ArrayExpressionElement<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::SpreadElement(it) => it.span_mut(), + Self::Elision(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl GetSpan for Elision { #[inline] fn span(&self) -> Span { @@ -204,6 +395,13 @@ impl GetSpan for Elision { } } +impl GetSpanMut for Elision { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ObjectExpression<'a> { #[inline] fn span(&self) -> Span { @@ -211,6 +409,13 @@ impl<'a> GetSpan for ObjectExpression<'a> { } } +impl<'a> GetSpanMut for ObjectExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ObjectPropertyKind<'a> { fn span(&self) -> Span { match self { @@ -220,6 +425,15 @@ impl<'a> GetSpan for ObjectPropertyKind<'a> { } } +impl<'a> GetSpanMut for ObjectPropertyKind<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ObjectProperty(it) => it.span_mut(), + Self::SpreadProperty(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ObjectProperty<'a> { #[inline] fn span(&self) -> Span { @@ -227,6 +441,13 @@ impl<'a> GetSpan for ObjectProperty<'a> { } } +impl<'a> GetSpanMut for ObjectProperty<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for PropertyKey<'a> { fn span(&self) -> Span { match self { @@ -278,6 +499,57 @@ impl<'a> GetSpan for PropertyKey<'a> { } } +impl<'a> GetSpanMut for PropertyKey<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::StaticIdentifier(it) => it.span_mut(), + Self::PrivateIdentifier(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TemplateLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -285,6 +557,13 @@ impl<'a> GetSpan for TemplateLiteral<'a> { } } +impl<'a> GetSpanMut for TemplateLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TaggedTemplateExpression<'a> { #[inline] fn span(&self) -> Span { @@ -292,6 +571,13 @@ impl<'a> GetSpan for TaggedTemplateExpression<'a> { } } +impl<'a> GetSpanMut for TaggedTemplateExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TemplateElement<'a> { #[inline] fn span(&self) -> Span { @@ -299,6 +585,13 @@ impl<'a> GetSpan for TemplateElement<'a> { } } +impl<'a> GetSpanMut for TemplateElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for MemberExpression<'a> { fn span(&self) -> Span { match self { @@ -309,6 +602,16 @@ impl<'a> GetSpan for MemberExpression<'a> { } } +impl<'a> GetSpanMut for MemberExpression<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ComputedMemberExpression<'a> { #[inline] fn span(&self) -> Span { @@ -316,6 +619,13 @@ impl<'a> GetSpan for ComputedMemberExpression<'a> { } } +impl<'a> GetSpanMut for ComputedMemberExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for StaticMemberExpression<'a> { #[inline] fn span(&self) -> Span { @@ -323,6 +633,13 @@ impl<'a> GetSpan for StaticMemberExpression<'a> { } } +impl<'a> GetSpanMut for StaticMemberExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for PrivateFieldExpression<'a> { #[inline] fn span(&self) -> Span { @@ -330,6 +647,13 @@ impl<'a> GetSpan for PrivateFieldExpression<'a> { } } +impl<'a> GetSpanMut for PrivateFieldExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for CallExpression<'a> { #[inline] fn span(&self) -> Span { @@ -337,6 +661,13 @@ impl<'a> GetSpan for CallExpression<'a> { } } +impl<'a> GetSpanMut for CallExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for NewExpression<'a> { #[inline] fn span(&self) -> Span { @@ -344,6 +675,13 @@ impl<'a> GetSpan for NewExpression<'a> { } } +impl<'a> GetSpanMut for NewExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for MetaProperty<'a> { #[inline] fn span(&self) -> Span { @@ -351,6 +689,13 @@ impl<'a> GetSpan for MetaProperty<'a> { } } +impl<'a> GetSpanMut for MetaProperty<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for SpreadElement<'a> { #[inline] fn span(&self) -> Span { @@ -358,6 +703,13 @@ impl<'a> GetSpan for SpreadElement<'a> { } } +impl<'a> GetSpanMut for SpreadElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Argument<'a> { fn span(&self) -> Span { match self { @@ -408,6 +760,56 @@ impl<'a> GetSpan for Argument<'a> { } } +impl<'a> GetSpanMut for Argument<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::SpreadElement(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for UpdateExpression<'a> { #[inline] fn span(&self) -> Span { @@ -415,6 +817,13 @@ impl<'a> GetSpan for UpdateExpression<'a> { } } +impl<'a> GetSpanMut for UpdateExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for UnaryExpression<'a> { #[inline] fn span(&self) -> Span { @@ -422,6 +831,13 @@ impl<'a> GetSpan for UnaryExpression<'a> { } } +impl<'a> GetSpanMut for UnaryExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BinaryExpression<'a> { #[inline] fn span(&self) -> Span { @@ -429,6 +845,13 @@ impl<'a> GetSpan for BinaryExpression<'a> { } } +impl<'a> GetSpanMut for BinaryExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for PrivateInExpression<'a> { #[inline] fn span(&self) -> Span { @@ -436,6 +859,13 @@ impl<'a> GetSpan for PrivateInExpression<'a> { } } +impl<'a> GetSpanMut for PrivateInExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for LogicalExpression<'a> { #[inline] fn span(&self) -> Span { @@ -443,6 +873,13 @@ impl<'a> GetSpan for LogicalExpression<'a> { } } +impl<'a> GetSpanMut for LogicalExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ConditionalExpression<'a> { #[inline] fn span(&self) -> Span { @@ -450,6 +887,13 @@ impl<'a> GetSpan for ConditionalExpression<'a> { } } +impl<'a> GetSpanMut for ConditionalExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentExpression<'a> { #[inline] fn span(&self) -> Span { @@ -457,6 +901,13 @@ impl<'a> GetSpan for AssignmentExpression<'a> { } } +impl<'a> GetSpanMut for AssignmentExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentTarget<'a> { fn span(&self) -> Span { match self { @@ -475,6 +926,24 @@ impl<'a> GetSpan for AssignmentTarget<'a> { } } +impl<'a> GetSpanMut for AssignmentTarget<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::AssignmentTargetIdentifier(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + Self::ArrayAssignmentTarget(it) => it.span_mut(), + Self::ObjectAssignmentTarget(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for SimpleAssignmentTarget<'a> { fn span(&self) -> Span { match self { @@ -491,6 +960,22 @@ impl<'a> GetSpan for SimpleAssignmentTarget<'a> { } } +impl<'a> GetSpanMut for SimpleAssignmentTarget<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::AssignmentTargetIdentifier(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for AssignmentTargetPattern<'a> { fn span(&self) -> Span { match self { @@ -500,6 +985,15 @@ impl<'a> GetSpan for AssignmentTargetPattern<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetPattern<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ArrayAssignmentTarget(it) => it.span_mut(), + Self::ObjectAssignmentTarget(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ArrayAssignmentTarget<'a> { #[inline] fn span(&self) -> Span { @@ -507,6 +1001,13 @@ impl<'a> GetSpan for ArrayAssignmentTarget<'a> { } } +impl<'a> GetSpanMut for ArrayAssignmentTarget<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ObjectAssignmentTarget<'a> { #[inline] fn span(&self) -> Span { @@ -514,6 +1015,13 @@ impl<'a> GetSpan for ObjectAssignmentTarget<'a> { } } +impl<'a> GetSpanMut for ObjectAssignmentTarget<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentTargetRest<'a> { #[inline] fn span(&self) -> Span { @@ -521,6 +1029,13 @@ impl<'a> GetSpan for AssignmentTargetRest<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetRest<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentTargetMaybeDefault<'a> { fn span(&self) -> Span { match self { @@ -540,6 +1055,25 @@ impl<'a> GetSpan for AssignmentTargetMaybeDefault<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetMaybeDefault<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::AssignmentTargetWithDefault(it) => it.span_mut(), + Self::AssignmentTargetIdentifier(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + Self::ArrayAssignmentTarget(it) => it.span_mut(), + Self::ObjectAssignmentTarget(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for AssignmentTargetWithDefault<'a> { #[inline] fn span(&self) -> Span { @@ -547,6 +1081,13 @@ impl<'a> GetSpan for AssignmentTargetWithDefault<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetWithDefault<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentTargetProperty<'a> { fn span(&self) -> Span { match self { @@ -556,6 +1097,15 @@ impl<'a> GetSpan for AssignmentTargetProperty<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetProperty<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::AssignmentTargetPropertyIdentifier(it) => it.span_mut(), + Self::AssignmentTargetPropertyProperty(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for AssignmentTargetPropertyIdentifier<'a> { #[inline] fn span(&self) -> Span { @@ -563,6 +1113,13 @@ impl<'a> GetSpan for AssignmentTargetPropertyIdentifier<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetPropertyIdentifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AssignmentTargetPropertyProperty<'a> { #[inline] fn span(&self) -> Span { @@ -570,6 +1127,13 @@ impl<'a> GetSpan for AssignmentTargetPropertyProperty<'a> { } } +impl<'a> GetSpanMut for AssignmentTargetPropertyProperty<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for SequenceExpression<'a> { #[inline] fn span(&self) -> Span { @@ -577,6 +1141,13 @@ impl<'a> GetSpan for SequenceExpression<'a> { } } +impl<'a> GetSpanMut for SequenceExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for Super { #[inline] fn span(&self) -> Span { @@ -584,6 +1155,13 @@ impl GetSpan for Super { } } +impl GetSpanMut for Super { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for AwaitExpression<'a> { #[inline] fn span(&self) -> Span { @@ -591,6 +1169,13 @@ impl<'a> GetSpan for AwaitExpression<'a> { } } +impl<'a> GetSpanMut for AwaitExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ChainExpression<'a> { #[inline] fn span(&self) -> Span { @@ -598,6 +1183,13 @@ impl<'a> GetSpan for ChainExpression<'a> { } } +impl<'a> GetSpanMut for ChainExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ChainElement<'a> { fn span(&self) -> Span { match self { @@ -609,6 +1201,17 @@ impl<'a> GetSpan for ChainElement<'a> { } } +impl<'a> GetSpanMut for ChainElement<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::CallExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ParenthesizedExpression<'a> { #[inline] fn span(&self) -> Span { @@ -616,6 +1219,13 @@ impl<'a> GetSpan for ParenthesizedExpression<'a> { } } +impl<'a> GetSpanMut for ParenthesizedExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Statement<'a> { fn span(&self) -> Span { match self { @@ -656,6 +1266,46 @@ impl<'a> GetSpan for Statement<'a> { } } +impl<'a> GetSpanMut for Statement<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::BlockStatement(it) => it.span_mut(), + Self::BreakStatement(it) => it.span_mut(), + Self::ContinueStatement(it) => it.span_mut(), + Self::DebuggerStatement(it) => it.span_mut(), + Self::DoWhileStatement(it) => it.span_mut(), + Self::EmptyStatement(it) => it.span_mut(), + Self::ExpressionStatement(it) => it.span_mut(), + Self::ForInStatement(it) => it.span_mut(), + Self::ForOfStatement(it) => it.span_mut(), + Self::ForStatement(it) => it.span_mut(), + Self::IfStatement(it) => it.span_mut(), + Self::LabeledStatement(it) => it.span_mut(), + Self::ReturnStatement(it) => it.span_mut(), + Self::SwitchStatement(it) => it.span_mut(), + Self::ThrowStatement(it) => it.span_mut(), + Self::TryStatement(it) => it.span_mut(), + Self::WhileStatement(it) => it.span_mut(), + Self::WithStatement(it) => it.span_mut(), + Self::VariableDeclaration(it) => it.span_mut(), + Self::FunctionDeclaration(it) => it.span_mut(), + Self::ClassDeclaration(it) => it.span_mut(), + Self::UsingDeclaration(it) => it.span_mut(), + Self::TSTypeAliasDeclaration(it) => it.span_mut(), + Self::TSInterfaceDeclaration(it) => it.span_mut(), + Self::TSEnumDeclaration(it) => it.span_mut(), + Self::TSModuleDeclaration(it) => it.span_mut(), + Self::TSImportEqualsDeclaration(it) => it.span_mut(), + Self::ImportDeclaration(it) => it.span_mut(), + Self::ExportAllDeclaration(it) => it.span_mut(), + Self::ExportDefaultDeclaration(it) => it.span_mut(), + Self::ExportNamedDeclaration(it) => it.span_mut(), + Self::TSExportAssignment(it) => it.span_mut(), + Self::TSNamespaceExportDeclaration(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for Directive<'a> { #[inline] fn span(&self) -> Span { @@ -663,6 +1313,13 @@ impl<'a> GetSpan for Directive<'a> { } } +impl<'a> GetSpanMut for Directive<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Hashbang<'a> { #[inline] fn span(&self) -> Span { @@ -670,6 +1327,13 @@ impl<'a> GetSpan for Hashbang<'a> { } } +impl<'a> GetSpanMut for Hashbang<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BlockStatement<'a> { #[inline] fn span(&self) -> Span { @@ -677,6 +1341,13 @@ impl<'a> GetSpan for BlockStatement<'a> { } } +impl<'a> GetSpanMut for BlockStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Declaration<'a> { fn span(&self) -> Span { match self { @@ -693,13 +1364,36 @@ impl<'a> GetSpan for Declaration<'a> { } } -impl<'a> GetSpan for VariableDeclaration<'a> { - #[inline] - fn span(&self) -> Span { +impl<'a> GetSpanMut for Declaration<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::VariableDeclaration(it) => it.span_mut(), + Self::FunctionDeclaration(it) => it.span_mut(), + Self::ClassDeclaration(it) => it.span_mut(), + Self::UsingDeclaration(it) => it.span_mut(), + Self::TSTypeAliasDeclaration(it) => it.span_mut(), + Self::TSInterfaceDeclaration(it) => it.span_mut(), + Self::TSEnumDeclaration(it) => it.span_mut(), + Self::TSModuleDeclaration(it) => it.span_mut(), + Self::TSImportEqualsDeclaration(it) => it.span_mut(), + } + } +} + +impl<'a> GetSpan for VariableDeclaration<'a> { + #[inline] + fn span(&self) -> Span { self.span } } +impl<'a> GetSpanMut for VariableDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for VariableDeclarator<'a> { #[inline] fn span(&self) -> Span { @@ -707,6 +1401,13 @@ impl<'a> GetSpan for VariableDeclarator<'a> { } } +impl<'a> GetSpanMut for VariableDeclarator<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for UsingDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -714,6 +1415,13 @@ impl<'a> GetSpan for UsingDeclaration<'a> { } } +impl<'a> GetSpanMut for UsingDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for EmptyStatement { #[inline] fn span(&self) -> Span { @@ -721,6 +1429,13 @@ impl GetSpan for EmptyStatement { } } +impl GetSpanMut for EmptyStatement { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ExpressionStatement<'a> { #[inline] fn span(&self) -> Span { @@ -728,6 +1443,13 @@ impl<'a> GetSpan for ExpressionStatement<'a> { } } +impl<'a> GetSpanMut for ExpressionStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for IfStatement<'a> { #[inline] fn span(&self) -> Span { @@ -735,6 +1457,13 @@ impl<'a> GetSpan for IfStatement<'a> { } } +impl<'a> GetSpanMut for IfStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for DoWhileStatement<'a> { #[inline] fn span(&self) -> Span { @@ -742,6 +1471,13 @@ impl<'a> GetSpan for DoWhileStatement<'a> { } } +impl<'a> GetSpanMut for DoWhileStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for WhileStatement<'a> { #[inline] fn span(&self) -> Span { @@ -749,6 +1485,13 @@ impl<'a> GetSpan for WhileStatement<'a> { } } +impl<'a> GetSpanMut for WhileStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ForStatement<'a> { #[inline] fn span(&self) -> Span { @@ -756,6 +1499,13 @@ impl<'a> GetSpan for ForStatement<'a> { } } +impl<'a> GetSpanMut for ForStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ForStatementInit<'a> { fn span(&self) -> Span { match self { @@ -807,6 +1557,57 @@ impl<'a> GetSpan for ForStatementInit<'a> { } } +impl<'a> GetSpanMut for ForStatementInit<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::VariableDeclaration(it) => it.span_mut(), + Self::UsingDeclaration(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ForInStatement<'a> { #[inline] fn span(&self) -> Span { @@ -814,6 +1615,13 @@ impl<'a> GetSpan for ForInStatement<'a> { } } +impl<'a> GetSpanMut for ForInStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ForStatementLeft<'a> { fn span(&self) -> Span { match self { @@ -834,6 +1642,26 @@ impl<'a> GetSpan for ForStatementLeft<'a> { } } +impl<'a> GetSpanMut for ForStatementLeft<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::VariableDeclaration(it) => it.span_mut(), + Self::UsingDeclaration(it) => it.span_mut(), + Self::AssignmentTargetIdentifier(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + Self::ArrayAssignmentTarget(it) => it.span_mut(), + Self::ObjectAssignmentTarget(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ForOfStatement<'a> { #[inline] fn span(&self) -> Span { @@ -841,6 +1669,13 @@ impl<'a> GetSpan for ForOfStatement<'a> { } } +impl<'a> GetSpanMut for ForOfStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ContinueStatement<'a> { #[inline] fn span(&self) -> Span { @@ -848,6 +1683,13 @@ impl<'a> GetSpan for ContinueStatement<'a> { } } +impl<'a> GetSpanMut for ContinueStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BreakStatement<'a> { #[inline] fn span(&self) -> Span { @@ -855,6 +1697,13 @@ impl<'a> GetSpan for BreakStatement<'a> { } } +impl<'a> GetSpanMut for BreakStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ReturnStatement<'a> { #[inline] fn span(&self) -> Span { @@ -862,6 +1711,13 @@ impl<'a> GetSpan for ReturnStatement<'a> { } } +impl<'a> GetSpanMut for ReturnStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for WithStatement<'a> { #[inline] fn span(&self) -> Span { @@ -869,6 +1725,13 @@ impl<'a> GetSpan for WithStatement<'a> { } } +impl<'a> GetSpanMut for WithStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for SwitchStatement<'a> { #[inline] fn span(&self) -> Span { @@ -876,6 +1739,13 @@ impl<'a> GetSpan for SwitchStatement<'a> { } } +impl<'a> GetSpanMut for SwitchStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for SwitchCase<'a> { #[inline] fn span(&self) -> Span { @@ -883,6 +1753,13 @@ impl<'a> GetSpan for SwitchCase<'a> { } } +impl<'a> GetSpanMut for SwitchCase<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for LabeledStatement<'a> { #[inline] fn span(&self) -> Span { @@ -890,6 +1767,13 @@ impl<'a> GetSpan for LabeledStatement<'a> { } } +impl<'a> GetSpanMut for LabeledStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ThrowStatement<'a> { #[inline] fn span(&self) -> Span { @@ -897,6 +1781,13 @@ impl<'a> GetSpan for ThrowStatement<'a> { } } +impl<'a> GetSpanMut for ThrowStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TryStatement<'a> { #[inline] fn span(&self) -> Span { @@ -904,6 +1795,13 @@ impl<'a> GetSpan for TryStatement<'a> { } } +impl<'a> GetSpanMut for TryStatement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for CatchClause<'a> { #[inline] fn span(&self) -> Span { @@ -911,6 +1809,13 @@ impl<'a> GetSpan for CatchClause<'a> { } } +impl<'a> GetSpanMut for CatchClause<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for CatchParameter<'a> { #[inline] fn span(&self) -> Span { @@ -918,6 +1823,13 @@ impl<'a> GetSpan for CatchParameter<'a> { } } +impl<'a> GetSpanMut for CatchParameter<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for DebuggerStatement { #[inline] fn span(&self) -> Span { @@ -925,6 +1837,13 @@ impl GetSpan for DebuggerStatement { } } +impl GetSpanMut for DebuggerStatement { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BindingPattern<'a> { #[inline] fn span(&self) -> Span { @@ -932,6 +1851,13 @@ impl<'a> GetSpan for BindingPattern<'a> { } } +impl<'a> GetSpanMut for BindingPattern<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + self.kind.span_mut() + } +} + impl<'a> GetSpan for BindingPatternKind<'a> { fn span(&self) -> Span { match self { @@ -943,6 +1869,17 @@ impl<'a> GetSpan for BindingPatternKind<'a> { } } +impl<'a> GetSpanMut for BindingPatternKind<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::BindingIdentifier(it) => it.span_mut(), + Self::ObjectPattern(it) => it.span_mut(), + Self::ArrayPattern(it) => it.span_mut(), + Self::AssignmentPattern(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for AssignmentPattern<'a> { #[inline] fn span(&self) -> Span { @@ -950,6 +1887,13 @@ impl<'a> GetSpan for AssignmentPattern<'a> { } } +impl<'a> GetSpanMut for AssignmentPattern<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ObjectPattern<'a> { #[inline] fn span(&self) -> Span { @@ -957,6 +1901,13 @@ impl<'a> GetSpan for ObjectPattern<'a> { } } +impl<'a> GetSpanMut for ObjectPattern<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BindingProperty<'a> { #[inline] fn span(&self) -> Span { @@ -964,6 +1915,13 @@ impl<'a> GetSpan for BindingProperty<'a> { } } +impl<'a> GetSpanMut for BindingProperty<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ArrayPattern<'a> { #[inline] fn span(&self) -> Span { @@ -971,6 +1929,13 @@ impl<'a> GetSpan for ArrayPattern<'a> { } } +impl<'a> GetSpanMut for ArrayPattern<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for BindingRestElement<'a> { #[inline] fn span(&self) -> Span { @@ -978,6 +1943,13 @@ impl<'a> GetSpan for BindingRestElement<'a> { } } +impl<'a> GetSpanMut for BindingRestElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Function<'a> { #[inline] fn span(&self) -> Span { @@ -985,6 +1957,13 @@ impl<'a> GetSpan for Function<'a> { } } +impl<'a> GetSpanMut for Function<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for FormalParameters<'a> { #[inline] fn span(&self) -> Span { @@ -992,6 +1971,13 @@ impl<'a> GetSpan for FormalParameters<'a> { } } +impl<'a> GetSpanMut for FormalParameters<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for FormalParameter<'a> { #[inline] fn span(&self) -> Span { @@ -999,6 +1985,13 @@ impl<'a> GetSpan for FormalParameter<'a> { } } +impl<'a> GetSpanMut for FormalParameter<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for FunctionBody<'a> { #[inline] fn span(&self) -> Span { @@ -1006,6 +1999,13 @@ impl<'a> GetSpan for FunctionBody<'a> { } } +impl<'a> GetSpanMut for FunctionBody<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ArrowFunctionExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1013,6 +2013,13 @@ impl<'a> GetSpan for ArrowFunctionExpression<'a> { } } +impl<'a> GetSpanMut for ArrowFunctionExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for YieldExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1020,6 +2027,13 @@ impl<'a> GetSpan for YieldExpression<'a> { } } +impl<'a> GetSpanMut for YieldExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Class<'a> { #[inline] fn span(&self) -> Span { @@ -1027,6 +2041,13 @@ impl<'a> GetSpan for Class<'a> { } } +impl<'a> GetSpanMut for Class<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ClassBody<'a> { #[inline] fn span(&self) -> Span { @@ -1034,6 +2055,13 @@ impl<'a> GetSpan for ClassBody<'a> { } } +impl<'a> GetSpanMut for ClassBody<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ClassElement<'a> { fn span(&self) -> Span { match self { @@ -1046,6 +2074,18 @@ impl<'a> GetSpan for ClassElement<'a> { } } +impl<'a> GetSpanMut for ClassElement<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::StaticBlock(it) => it.span_mut(), + Self::MethodDefinition(it) => it.span_mut(), + Self::PropertyDefinition(it) => it.span_mut(), + Self::AccessorProperty(it) => it.span_mut(), + Self::TSIndexSignature(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for MethodDefinition<'a> { #[inline] fn span(&self) -> Span { @@ -1053,6 +2093,13 @@ impl<'a> GetSpan for MethodDefinition<'a> { } } +impl<'a> GetSpanMut for MethodDefinition<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for PropertyDefinition<'a> { #[inline] fn span(&self) -> Span { @@ -1060,6 +2107,13 @@ impl<'a> GetSpan for PropertyDefinition<'a> { } } +impl<'a> GetSpanMut for PropertyDefinition<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for PrivateIdentifier<'a> { #[inline] fn span(&self) -> Span { @@ -1067,6 +2121,13 @@ impl<'a> GetSpan for PrivateIdentifier<'a> { } } +impl<'a> GetSpanMut for PrivateIdentifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for StaticBlock<'a> { #[inline] fn span(&self) -> Span { @@ -1074,6 +2135,13 @@ impl<'a> GetSpan for StaticBlock<'a> { } } +impl<'a> GetSpanMut for StaticBlock<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ModuleDeclaration<'a> { fn span(&self) -> Span { match self { @@ -1087,6 +2155,19 @@ impl<'a> GetSpan for ModuleDeclaration<'a> { } } +impl<'a> GetSpanMut for ModuleDeclaration<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ImportDeclaration(it) => it.span_mut(), + Self::ExportAllDeclaration(it) => it.span_mut(), + Self::ExportDefaultDeclaration(it) => it.span_mut(), + Self::ExportNamedDeclaration(it) => it.span_mut(), + Self::TSExportAssignment(it) => it.span_mut(), + Self::TSNamespaceExportDeclaration(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for AccessorProperty<'a> { #[inline] fn span(&self) -> Span { @@ -1094,6 +2175,13 @@ impl<'a> GetSpan for AccessorProperty<'a> { } } +impl<'a> GetSpanMut for AccessorProperty<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1101,6 +2189,13 @@ impl<'a> GetSpan for ImportExpression<'a> { } } +impl<'a> GetSpanMut for ImportExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1108,6 +2203,13 @@ impl<'a> GetSpan for ImportDeclaration<'a> { } } +impl<'a> GetSpanMut for ImportDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportDeclarationSpecifier<'a> { fn span(&self) -> Span { match self { @@ -1118,6 +2220,16 @@ impl<'a> GetSpan for ImportDeclarationSpecifier<'a> { } } +impl<'a> GetSpanMut for ImportDeclarationSpecifier<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ImportSpecifier(it) => it.span_mut(), + Self::ImportDefaultSpecifier(it) => it.span_mut(), + Self::ImportNamespaceSpecifier(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ImportSpecifier<'a> { #[inline] fn span(&self) -> Span { @@ -1125,6 +2237,13 @@ impl<'a> GetSpan for ImportSpecifier<'a> { } } +impl<'a> GetSpanMut for ImportSpecifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportDefaultSpecifier<'a> { #[inline] fn span(&self) -> Span { @@ -1132,6 +2251,13 @@ impl<'a> GetSpan for ImportDefaultSpecifier<'a> { } } +impl<'a> GetSpanMut for ImportDefaultSpecifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportNamespaceSpecifier<'a> { #[inline] fn span(&self) -> Span { @@ -1139,6 +2265,13 @@ impl<'a> GetSpan for ImportNamespaceSpecifier<'a> { } } +impl<'a> GetSpanMut for ImportNamespaceSpecifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for WithClause<'a> { #[inline] fn span(&self) -> Span { @@ -1146,6 +2279,13 @@ impl<'a> GetSpan for WithClause<'a> { } } +impl<'a> GetSpanMut for WithClause<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportAttribute<'a> { #[inline] fn span(&self) -> Span { @@ -1153,6 +2293,13 @@ impl<'a> GetSpan for ImportAttribute<'a> { } } +impl<'a> GetSpanMut for ImportAttribute<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ImportAttributeKey<'a> { fn span(&self) -> Span { match self { @@ -1162,6 +2309,15 @@ impl<'a> GetSpan for ImportAttributeKey<'a> { } } +impl<'a> GetSpanMut for ImportAttributeKey<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for ExportNamedDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1169,6 +2325,13 @@ impl<'a> GetSpan for ExportNamedDeclaration<'a> { } } +impl<'a> GetSpanMut for ExportNamedDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ExportDefaultDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1176,6 +2339,13 @@ impl<'a> GetSpan for ExportDefaultDeclaration<'a> { } } +impl<'a> GetSpanMut for ExportDefaultDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ExportAllDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1183,6 +2353,13 @@ impl<'a> GetSpan for ExportAllDeclaration<'a> { } } +impl<'a> GetSpanMut for ExportAllDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ExportSpecifier<'a> { #[inline] fn span(&self) -> Span { @@ -1190,6 +2367,13 @@ impl<'a> GetSpan for ExportSpecifier<'a> { } } +impl<'a> GetSpanMut for ExportSpecifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for ExportDefaultDeclarationKind<'a> { fn span(&self) -> Span { match self { @@ -1242,7 +2426,59 @@ impl<'a> GetSpan for ExportDefaultDeclarationKind<'a> { } } -impl<'a> GetSpan for ModuleExportName<'a> { +impl<'a> GetSpanMut for ExportDefaultDeclarationKind<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::FunctionDeclaration(it) => it.span_mut(), + Self::ClassDeclaration(it) => it.span_mut(), + Self::TSInterfaceDeclaration(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + +impl<'a> GetSpan for ModuleExportName<'a> { fn span(&self) -> Span { match self { Self::IdentifierName(it) => it.span(), @@ -1252,6 +2488,16 @@ impl<'a> GetSpan for ModuleExportName<'a> { } } +impl<'a> GetSpanMut for ModuleExportName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::IdentifierName(it) => it.span_mut(), + Self::IdentifierReference(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSThisParameter<'a> { #[inline] fn span(&self) -> Span { @@ -1259,6 +2505,13 @@ impl<'a> GetSpan for TSThisParameter<'a> { } } +impl<'a> GetSpanMut for TSThisParameter<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSEnumDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1266,6 +2519,13 @@ impl<'a> GetSpan for TSEnumDeclaration<'a> { } } +impl<'a> GetSpanMut for TSEnumDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSEnumMember<'a> { #[inline] fn span(&self) -> Span { @@ -1273,6 +2533,13 @@ impl<'a> GetSpan for TSEnumMember<'a> { } } +impl<'a> GetSpanMut for TSEnumMember<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSEnumMemberName<'a> { fn span(&self) -> Span { match self { @@ -1326,6 +2593,59 @@ impl<'a> GetSpan for TSEnumMemberName<'a> { } } +impl<'a> GetSpanMut for TSEnumMemberName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::StaticIdentifier(it) => it.span_mut(), + Self::StaticStringLiteral(it) => it.span_mut(), + Self::StaticTemplateLiteral(it) => it.span_mut(), + Self::StaticNumericLiteral(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSTypeAnnotation<'a> { #[inline] fn span(&self) -> Span { @@ -1333,6 +2653,13 @@ impl<'a> GetSpan for TSTypeAnnotation<'a> { } } +impl<'a> GetSpanMut for TSTypeAnnotation<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSLiteralType<'a> { #[inline] fn span(&self) -> Span { @@ -1340,6 +2667,13 @@ impl<'a> GetSpan for TSLiteralType<'a> { } } +impl<'a> GetSpanMut for TSLiteralType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSLiteral<'a> { fn span(&self) -> Span { match self { @@ -1355,6 +2689,21 @@ impl<'a> GetSpan for TSLiteral<'a> { } } +impl<'a> GetSpanMut for TSLiteral<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSType<'a> { fn span(&self) -> Span { match self { @@ -1400,6 +2749,51 @@ impl<'a> GetSpan for TSType<'a> { } } +impl<'a> GetSpanMut for TSType<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::TSAnyKeyword(it) => it.span_mut(), + Self::TSBigIntKeyword(it) => it.span_mut(), + Self::TSBooleanKeyword(it) => it.span_mut(), + Self::TSIntrinsicKeyword(it) => it.span_mut(), + Self::TSNeverKeyword(it) => it.span_mut(), + Self::TSNullKeyword(it) => it.span_mut(), + Self::TSNumberKeyword(it) => it.span_mut(), + Self::TSObjectKeyword(it) => it.span_mut(), + Self::TSStringKeyword(it) => it.span_mut(), + Self::TSSymbolKeyword(it) => it.span_mut(), + Self::TSUndefinedKeyword(it) => it.span_mut(), + Self::TSUnknownKeyword(it) => it.span_mut(), + Self::TSVoidKeyword(it) => it.span_mut(), + Self::TSArrayType(it) => it.span_mut(), + Self::TSConditionalType(it) => it.span_mut(), + Self::TSConstructorType(it) => it.span_mut(), + Self::TSFunctionType(it) => it.span_mut(), + Self::TSImportType(it) => it.span_mut(), + Self::TSIndexedAccessType(it) => it.span_mut(), + Self::TSInferType(it) => it.span_mut(), + Self::TSIntersectionType(it) => it.span_mut(), + Self::TSLiteralType(it) => it.span_mut(), + Self::TSMappedType(it) => it.span_mut(), + Self::TSNamedTupleMember(it) => it.span_mut(), + Self::TSQualifiedName(it) => it.span_mut(), + Self::TSTemplateLiteralType(it) => it.span_mut(), + Self::TSThisType(it) => it.span_mut(), + Self::TSTupleType(it) => it.span_mut(), + Self::TSTypeLiteral(it) => it.span_mut(), + Self::TSTypeOperatorType(it) => it.span_mut(), + Self::TSTypePredicate(it) => it.span_mut(), + Self::TSTypeQuery(it) => it.span_mut(), + Self::TSTypeReference(it) => it.span_mut(), + Self::TSUnionType(it) => it.span_mut(), + Self::TSParenthesizedType(it) => it.span_mut(), + Self::JSDocNullableType(it) => it.span_mut(), + Self::JSDocNonNullableType(it) => it.span_mut(), + Self::JSDocUnknownType(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSConditionalType<'a> { #[inline] fn span(&self) -> Span { @@ -1407,6 +2801,13 @@ impl<'a> GetSpan for TSConditionalType<'a> { } } +impl<'a> GetSpanMut for TSConditionalType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSUnionType<'a> { #[inline] fn span(&self) -> Span { @@ -1414,6 +2815,13 @@ impl<'a> GetSpan for TSUnionType<'a> { } } +impl<'a> GetSpanMut for TSUnionType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSIntersectionType<'a> { #[inline] fn span(&self) -> Span { @@ -1421,6 +2829,13 @@ impl<'a> GetSpan for TSIntersectionType<'a> { } } +impl<'a> GetSpanMut for TSIntersectionType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSParenthesizedType<'a> { #[inline] fn span(&self) -> Span { @@ -1428,6 +2843,13 @@ impl<'a> GetSpan for TSParenthesizedType<'a> { } } +impl<'a> GetSpanMut for TSParenthesizedType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeOperator<'a> { #[inline] fn span(&self) -> Span { @@ -1435,6 +2857,13 @@ impl<'a> GetSpan for TSTypeOperator<'a> { } } +impl<'a> GetSpanMut for TSTypeOperator<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSArrayType<'a> { #[inline] fn span(&self) -> Span { @@ -1442,6 +2871,13 @@ impl<'a> GetSpan for TSArrayType<'a> { } } +impl<'a> GetSpanMut for TSArrayType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSIndexedAccessType<'a> { #[inline] fn span(&self) -> Span { @@ -1449,6 +2885,13 @@ impl<'a> GetSpan for TSIndexedAccessType<'a> { } } +impl<'a> GetSpanMut for TSIndexedAccessType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTupleType<'a> { #[inline] fn span(&self) -> Span { @@ -1456,6 +2899,13 @@ impl<'a> GetSpan for TSTupleType<'a> { } } +impl<'a> GetSpanMut for TSTupleType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSNamedTupleMember<'a> { #[inline] fn span(&self) -> Span { @@ -1463,6 +2913,13 @@ impl<'a> GetSpan for TSNamedTupleMember<'a> { } } +impl<'a> GetSpanMut for TSNamedTupleMember<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSOptionalType<'a> { #[inline] fn span(&self) -> Span { @@ -1470,6 +2927,13 @@ impl<'a> GetSpan for TSOptionalType<'a> { } } +impl<'a> GetSpanMut for TSOptionalType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSRestType<'a> { #[inline] fn span(&self) -> Span { @@ -1477,6 +2941,13 @@ impl<'a> GetSpan for TSRestType<'a> { } } +impl<'a> GetSpanMut for TSRestType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTupleElement<'a> { fn span(&self) -> Span { match self { @@ -1524,6 +2995,53 @@ impl<'a> GetSpan for TSTupleElement<'a> { } } +impl<'a> GetSpanMut for TSTupleElement<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::TSOptionalType(it) => it.span_mut(), + Self::TSRestType(it) => it.span_mut(), + Self::TSAnyKeyword(it) => it.span_mut(), + Self::TSBigIntKeyword(it) => it.span_mut(), + Self::TSBooleanKeyword(it) => it.span_mut(), + Self::TSIntrinsicKeyword(it) => it.span_mut(), + Self::TSNeverKeyword(it) => it.span_mut(), + Self::TSNullKeyword(it) => it.span_mut(), + Self::TSNumberKeyword(it) => it.span_mut(), + Self::TSObjectKeyword(it) => it.span_mut(), + Self::TSStringKeyword(it) => it.span_mut(), + Self::TSSymbolKeyword(it) => it.span_mut(), + Self::TSUndefinedKeyword(it) => it.span_mut(), + Self::TSUnknownKeyword(it) => it.span_mut(), + Self::TSVoidKeyword(it) => it.span_mut(), + Self::TSArrayType(it) => it.span_mut(), + Self::TSConditionalType(it) => it.span_mut(), + Self::TSConstructorType(it) => it.span_mut(), + Self::TSFunctionType(it) => it.span_mut(), + Self::TSImportType(it) => it.span_mut(), + Self::TSIndexedAccessType(it) => it.span_mut(), + Self::TSInferType(it) => it.span_mut(), + Self::TSIntersectionType(it) => it.span_mut(), + Self::TSLiteralType(it) => it.span_mut(), + Self::TSMappedType(it) => it.span_mut(), + Self::TSNamedTupleMember(it) => it.span_mut(), + Self::TSQualifiedName(it) => it.span_mut(), + Self::TSTemplateLiteralType(it) => it.span_mut(), + Self::TSThisType(it) => it.span_mut(), + Self::TSTupleType(it) => it.span_mut(), + Self::TSTypeLiteral(it) => it.span_mut(), + Self::TSTypeOperatorType(it) => it.span_mut(), + Self::TSTypePredicate(it) => it.span_mut(), + Self::TSTypeQuery(it) => it.span_mut(), + Self::TSTypeReference(it) => it.span_mut(), + Self::TSUnionType(it) => it.span_mut(), + Self::TSParenthesizedType(it) => it.span_mut(), + Self::JSDocNullableType(it) => it.span_mut(), + Self::JSDocNonNullableType(it) => it.span_mut(), + Self::JSDocUnknownType(it) => it.span_mut(), + } + } +} + impl GetSpan for TSAnyKeyword { #[inline] fn span(&self) -> Span { @@ -1531,6 +3049,13 @@ impl GetSpan for TSAnyKeyword { } } +impl GetSpanMut for TSAnyKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSStringKeyword { #[inline] fn span(&self) -> Span { @@ -1538,6 +3063,13 @@ impl GetSpan for TSStringKeyword { } } +impl GetSpanMut for TSStringKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSBooleanKeyword { #[inline] fn span(&self) -> Span { @@ -1545,6 +3077,13 @@ impl GetSpan for TSBooleanKeyword { } } +impl GetSpanMut for TSBooleanKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSNumberKeyword { #[inline] fn span(&self) -> Span { @@ -1552,6 +3091,13 @@ impl GetSpan for TSNumberKeyword { } } +impl GetSpanMut for TSNumberKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSNeverKeyword { #[inline] fn span(&self) -> Span { @@ -1559,6 +3105,13 @@ impl GetSpan for TSNeverKeyword { } } +impl GetSpanMut for TSNeverKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSIntrinsicKeyword { #[inline] fn span(&self) -> Span { @@ -1566,6 +3119,13 @@ impl GetSpan for TSIntrinsicKeyword { } } +impl GetSpanMut for TSIntrinsicKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSUnknownKeyword { #[inline] fn span(&self) -> Span { @@ -1573,6 +3133,13 @@ impl GetSpan for TSUnknownKeyword { } } +impl GetSpanMut for TSUnknownKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSNullKeyword { #[inline] fn span(&self) -> Span { @@ -1580,6 +3147,13 @@ impl GetSpan for TSNullKeyword { } } +impl GetSpanMut for TSNullKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSUndefinedKeyword { #[inline] fn span(&self) -> Span { @@ -1587,6 +3161,13 @@ impl GetSpan for TSUndefinedKeyword { } } +impl GetSpanMut for TSUndefinedKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSVoidKeyword { #[inline] fn span(&self) -> Span { @@ -1594,6 +3175,13 @@ impl GetSpan for TSVoidKeyword { } } +impl GetSpanMut for TSVoidKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSSymbolKeyword { #[inline] fn span(&self) -> Span { @@ -1601,6 +3189,13 @@ impl GetSpan for TSSymbolKeyword { } } +impl GetSpanMut for TSSymbolKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSThisType { #[inline] fn span(&self) -> Span { @@ -1608,6 +3203,13 @@ impl GetSpan for TSThisType { } } +impl GetSpanMut for TSThisType { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSObjectKeyword { #[inline] fn span(&self) -> Span { @@ -1615,6 +3217,13 @@ impl GetSpan for TSObjectKeyword { } } +impl GetSpanMut for TSObjectKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for TSBigIntKeyword { #[inline] fn span(&self) -> Span { @@ -1622,6 +3231,13 @@ impl GetSpan for TSBigIntKeyword { } } +impl GetSpanMut for TSBigIntKeyword { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeReference<'a> { #[inline] fn span(&self) -> Span { @@ -1629,6 +3245,13 @@ impl<'a> GetSpan for TSTypeReference<'a> { } } +impl<'a> GetSpanMut for TSTypeReference<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeName<'a> { fn span(&self) -> Span { match self { @@ -1638,6 +3261,15 @@ impl<'a> GetSpan for TSTypeName<'a> { } } +impl<'a> GetSpanMut for TSTypeName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::IdentifierReference(it) => it.span_mut(), + Self::QualifiedName(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSQualifiedName<'a> { #[inline] fn span(&self) -> Span { @@ -1645,6 +3277,13 @@ impl<'a> GetSpan for TSQualifiedName<'a> { } } +impl<'a> GetSpanMut for TSQualifiedName<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeParameterInstantiation<'a> { #[inline] fn span(&self) -> Span { @@ -1652,6 +3291,13 @@ impl<'a> GetSpan for TSTypeParameterInstantiation<'a> { } } +impl<'a> GetSpanMut for TSTypeParameterInstantiation<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeParameter<'a> { #[inline] fn span(&self) -> Span { @@ -1659,6 +3305,13 @@ impl<'a> GetSpan for TSTypeParameter<'a> { } } +impl<'a> GetSpanMut for TSTypeParameter<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeParameterDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1666,6 +3319,13 @@ impl<'a> GetSpan for TSTypeParameterDeclaration<'a> { } } +impl<'a> GetSpanMut for TSTypeParameterDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeAliasDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1673,6 +3333,13 @@ impl<'a> GetSpan for TSTypeAliasDeclaration<'a> { } } +impl<'a> GetSpanMut for TSTypeAliasDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSClassImplements<'a> { #[inline] fn span(&self) -> Span { @@ -1680,6 +3347,13 @@ impl<'a> GetSpan for TSClassImplements<'a> { } } +impl<'a> GetSpanMut for TSClassImplements<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSInterfaceDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1687,6 +3361,13 @@ impl<'a> GetSpan for TSInterfaceDeclaration<'a> { } } +impl<'a> GetSpanMut for TSInterfaceDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSInterfaceBody<'a> { #[inline] fn span(&self) -> Span { @@ -1694,6 +3375,13 @@ impl<'a> GetSpan for TSInterfaceBody<'a> { } } +impl<'a> GetSpanMut for TSInterfaceBody<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSPropertySignature<'a> { #[inline] fn span(&self) -> Span { @@ -1701,6 +3389,13 @@ impl<'a> GetSpan for TSPropertySignature<'a> { } } +impl<'a> GetSpanMut for TSPropertySignature<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSSignature<'a> { fn span(&self) -> Span { match self { @@ -1713,6 +3408,18 @@ impl<'a> GetSpan for TSSignature<'a> { } } +impl<'a> GetSpanMut for TSSignature<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::TSIndexSignature(it) => it.span_mut(), + Self::TSPropertySignature(it) => it.span_mut(), + Self::TSCallSignatureDeclaration(it) => it.span_mut(), + Self::TSConstructSignatureDeclaration(it) => it.span_mut(), + Self::TSMethodSignature(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSIndexSignature<'a> { #[inline] fn span(&self) -> Span { @@ -1720,6 +3427,13 @@ impl<'a> GetSpan for TSIndexSignature<'a> { } } +impl<'a> GetSpanMut for TSIndexSignature<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSCallSignatureDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1727,6 +3441,13 @@ impl<'a> GetSpan for TSCallSignatureDeclaration<'a> { } } +impl<'a> GetSpanMut for TSCallSignatureDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSMethodSignature<'a> { #[inline] fn span(&self) -> Span { @@ -1734,6 +3455,13 @@ impl<'a> GetSpan for TSMethodSignature<'a> { } } +impl<'a> GetSpanMut for TSMethodSignature<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSConstructSignatureDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1741,6 +3469,13 @@ impl<'a> GetSpan for TSConstructSignatureDeclaration<'a> { } } +impl<'a> GetSpanMut for TSConstructSignatureDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSIndexSignatureName<'a> { #[inline] fn span(&self) -> Span { @@ -1748,6 +3483,13 @@ impl<'a> GetSpan for TSIndexSignatureName<'a> { } } +impl<'a> GetSpanMut for TSIndexSignatureName<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSInterfaceHeritage<'a> { #[inline] fn span(&self) -> Span { @@ -1755,6 +3497,13 @@ impl<'a> GetSpan for TSInterfaceHeritage<'a> { } } +impl<'a> GetSpanMut for TSInterfaceHeritage<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypePredicate<'a> { #[inline] fn span(&self) -> Span { @@ -1762,6 +3511,13 @@ impl<'a> GetSpan for TSTypePredicate<'a> { } } +impl<'a> GetSpanMut for TSTypePredicate<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypePredicateName<'a> { fn span(&self) -> Span { match self { @@ -1771,6 +3527,15 @@ impl<'a> GetSpan for TSTypePredicateName<'a> { } } +impl<'a> GetSpanMut for TSTypePredicateName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::This(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSModuleDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1778,6 +3543,13 @@ impl<'a> GetSpan for TSModuleDeclaration<'a> { } } +impl<'a> GetSpanMut for TSModuleDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSModuleDeclarationName<'a> { fn span(&self) -> Span { match self { @@ -1787,6 +3559,15 @@ impl<'a> GetSpan for TSModuleDeclarationName<'a> { } } +impl<'a> GetSpanMut for TSModuleDeclarationName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSModuleDeclarationBody<'a> { fn span(&self) -> Span { match self { @@ -1796,6 +3577,15 @@ impl<'a> GetSpan for TSModuleDeclarationBody<'a> { } } +impl<'a> GetSpanMut for TSModuleDeclarationBody<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::TSModuleDeclaration(it) => it.span_mut(), + Self::TSModuleBlock(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSModuleBlock<'a> { #[inline] fn span(&self) -> Span { @@ -1803,6 +3593,13 @@ impl<'a> GetSpan for TSModuleBlock<'a> { } } +impl<'a> GetSpanMut for TSModuleBlock<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeLiteral<'a> { #[inline] fn span(&self) -> Span { @@ -1810,6 +3607,13 @@ impl<'a> GetSpan for TSTypeLiteral<'a> { } } +impl<'a> GetSpanMut for TSTypeLiteral<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSInferType<'a> { #[inline] fn span(&self) -> Span { @@ -1817,6 +3621,13 @@ impl<'a> GetSpan for TSInferType<'a> { } } +impl<'a> GetSpanMut for TSInferType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeQuery<'a> { #[inline] fn span(&self) -> Span { @@ -1824,6 +3635,13 @@ impl<'a> GetSpan for TSTypeQuery<'a> { } } +impl<'a> GetSpanMut for TSTypeQuery<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeQueryExprName<'a> { fn span(&self) -> Span { match self { @@ -1834,6 +3652,16 @@ impl<'a> GetSpan for TSTypeQueryExprName<'a> { } } +impl<'a> GetSpanMut for TSTypeQueryExprName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::TSImportType(it) => it.span_mut(), + Self::IdentifierReference(it) => it.span_mut(), + Self::QualifiedName(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSImportType<'a> { #[inline] fn span(&self) -> Span { @@ -1841,6 +3669,13 @@ impl<'a> GetSpan for TSImportType<'a> { } } +impl<'a> GetSpanMut for TSImportType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSImportAttributes<'a> { #[inline] fn span(&self) -> Span { @@ -1848,6 +3683,13 @@ impl<'a> GetSpan for TSImportAttributes<'a> { } } +impl<'a> GetSpanMut for TSImportAttributes<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSImportAttribute<'a> { #[inline] fn span(&self) -> Span { @@ -1855,6 +3697,13 @@ impl<'a> GetSpan for TSImportAttribute<'a> { } } +impl<'a> GetSpanMut for TSImportAttribute<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSImportAttributeName<'a> { fn span(&self) -> Span { match self { @@ -1864,6 +3713,15 @@ impl<'a> GetSpan for TSImportAttributeName<'a> { } } +impl<'a> GetSpanMut for TSImportAttributeName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSFunctionType<'a> { #[inline] fn span(&self) -> Span { @@ -1871,6 +3729,13 @@ impl<'a> GetSpan for TSFunctionType<'a> { } } +impl<'a> GetSpanMut for TSFunctionType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSConstructorType<'a> { #[inline] fn span(&self) -> Span { @@ -1878,6 +3743,13 @@ impl<'a> GetSpan for TSConstructorType<'a> { } } +impl<'a> GetSpanMut for TSConstructorType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSMappedType<'a> { #[inline] fn span(&self) -> Span { @@ -1885,6 +3757,13 @@ impl<'a> GetSpan for TSMappedType<'a> { } } +impl<'a> GetSpanMut for TSMappedType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTemplateLiteralType<'a> { #[inline] fn span(&self) -> Span { @@ -1892,6 +3771,13 @@ impl<'a> GetSpan for TSTemplateLiteralType<'a> { } } +impl<'a> GetSpanMut for TSTemplateLiteralType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSAsExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1899,6 +3785,13 @@ impl<'a> GetSpan for TSAsExpression<'a> { } } +impl<'a> GetSpanMut for TSAsExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSSatisfiesExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1906,6 +3799,13 @@ impl<'a> GetSpan for TSSatisfiesExpression<'a> { } } +impl<'a> GetSpanMut for TSSatisfiesExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSTypeAssertion<'a> { #[inline] fn span(&self) -> Span { @@ -1913,6 +3813,13 @@ impl<'a> GetSpan for TSTypeAssertion<'a> { } } +impl<'a> GetSpanMut for TSTypeAssertion<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSImportEqualsDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1920,6 +3827,13 @@ impl<'a> GetSpan for TSImportEqualsDeclaration<'a> { } } +impl<'a> GetSpanMut for TSImportEqualsDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSModuleReference<'a> { fn span(&self) -> Span { match self { @@ -1930,6 +3844,16 @@ impl<'a> GetSpan for TSModuleReference<'a> { } } +impl<'a> GetSpanMut for TSModuleReference<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::ExternalModuleReference(it) => it.span_mut(), + Self::IdentifierReference(it) => it.span_mut(), + Self::QualifiedName(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for TSExternalModuleReference<'a> { #[inline] fn span(&self) -> Span { @@ -1937,6 +3861,13 @@ impl<'a> GetSpan for TSExternalModuleReference<'a> { } } +impl<'a> GetSpanMut for TSExternalModuleReference<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSNonNullExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1944,6 +3875,13 @@ impl<'a> GetSpan for TSNonNullExpression<'a> { } } +impl<'a> GetSpanMut for TSNonNullExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for Decorator<'a> { #[inline] fn span(&self) -> Span { @@ -1951,6 +3889,13 @@ impl<'a> GetSpan for Decorator<'a> { } } +impl<'a> GetSpanMut for Decorator<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSExportAssignment<'a> { #[inline] fn span(&self) -> Span { @@ -1958,6 +3903,13 @@ impl<'a> GetSpan for TSExportAssignment<'a> { } } +impl<'a> GetSpanMut for TSExportAssignment<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSNamespaceExportDeclaration<'a> { #[inline] fn span(&self) -> Span { @@ -1965,6 +3917,13 @@ impl<'a> GetSpan for TSNamespaceExportDeclaration<'a> { } } +impl<'a> GetSpanMut for TSNamespaceExportDeclaration<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for TSInstantiationExpression<'a> { #[inline] fn span(&self) -> Span { @@ -1972,6 +3931,13 @@ impl<'a> GetSpan for TSInstantiationExpression<'a> { } } +impl<'a> GetSpanMut for TSInstantiationExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSDocNullableType<'a> { #[inline] fn span(&self) -> Span { @@ -1979,6 +3945,13 @@ impl<'a> GetSpan for JSDocNullableType<'a> { } } +impl<'a> GetSpanMut for JSDocNullableType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSDocNonNullableType<'a> { #[inline] fn span(&self) -> Span { @@ -1986,6 +3959,13 @@ impl<'a> GetSpan for JSDocNonNullableType<'a> { } } +impl<'a> GetSpanMut for JSDocNonNullableType<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl GetSpan for JSDocUnknownType { #[inline] fn span(&self) -> Span { @@ -1993,6 +3973,13 @@ impl GetSpan for JSDocUnknownType { } } +impl GetSpanMut for JSDocUnknownType { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXElement<'a> { #[inline] fn span(&self) -> Span { @@ -2000,6 +3987,13 @@ impl<'a> GetSpan for JSXElement<'a> { } } +impl<'a> GetSpanMut for JSXElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXOpeningElement<'a> { #[inline] fn span(&self) -> Span { @@ -2007,6 +4001,13 @@ impl<'a> GetSpan for JSXOpeningElement<'a> { } } +impl<'a> GetSpanMut for JSXOpeningElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXClosingElement<'a> { #[inline] fn span(&self) -> Span { @@ -2014,6 +4015,13 @@ impl<'a> GetSpan for JSXClosingElement<'a> { } } +impl<'a> GetSpanMut for JSXClosingElement<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXFragment<'a> { #[inline] fn span(&self) -> Span { @@ -2021,6 +4029,13 @@ impl<'a> GetSpan for JSXFragment<'a> { } } +impl<'a> GetSpanMut for JSXFragment<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXElementName<'a> { fn span(&self) -> Span { match self { @@ -2031,6 +4046,16 @@ impl<'a> GetSpan for JSXElementName<'a> { } } +impl<'a> GetSpanMut for JSXElementName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::NamespacedName(it) => it.span_mut(), + Self::MemberExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXNamespacedName<'a> { #[inline] fn span(&self) -> Span { @@ -2038,6 +4063,13 @@ impl<'a> GetSpan for JSXNamespacedName<'a> { } } +impl<'a> GetSpanMut for JSXNamespacedName<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXMemberExpression<'a> { #[inline] fn span(&self) -> Span { @@ -2045,6 +4077,13 @@ impl<'a> GetSpan for JSXMemberExpression<'a> { } } +impl<'a> GetSpanMut for JSXMemberExpression<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXMemberExpressionObject<'a> { fn span(&self) -> Span { match self { @@ -2054,6 +4093,15 @@ impl<'a> GetSpan for JSXMemberExpressionObject<'a> { } } +impl<'a> GetSpanMut for JSXMemberExpressionObject<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::MemberExpression(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXExpressionContainer<'a> { #[inline] fn span(&self) -> Span { @@ -2061,6 +4109,13 @@ impl<'a> GetSpan for JSXExpressionContainer<'a> { } } +impl<'a> GetSpanMut for JSXExpressionContainer<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXExpression<'a> { fn span(&self) -> Span { match self { @@ -2111,6 +4166,56 @@ impl<'a> GetSpan for JSXExpression<'a> { } } +impl<'a> GetSpanMut for JSXExpression<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::EmptyExpression(it) => it.span_mut(), + Self::BooleanLiteral(it) => it.span_mut(), + Self::NullLiteral(it) => it.span_mut(), + Self::NumericLiteral(it) => it.span_mut(), + Self::BigIntLiteral(it) => it.span_mut(), + Self::RegExpLiteral(it) => it.span_mut(), + Self::StringLiteral(it) => it.span_mut(), + Self::TemplateLiteral(it) => it.span_mut(), + Self::Identifier(it) => it.span_mut(), + Self::MetaProperty(it) => it.span_mut(), + Self::Super(it) => it.span_mut(), + Self::ArrayExpression(it) => it.span_mut(), + Self::ArrowFunctionExpression(it) => it.span_mut(), + Self::AssignmentExpression(it) => it.span_mut(), + Self::AwaitExpression(it) => it.span_mut(), + Self::BinaryExpression(it) => it.span_mut(), + Self::CallExpression(it) => it.span_mut(), + Self::ChainExpression(it) => it.span_mut(), + Self::ClassExpression(it) => it.span_mut(), + Self::ConditionalExpression(it) => it.span_mut(), + Self::FunctionExpression(it) => it.span_mut(), + Self::ImportExpression(it) => it.span_mut(), + Self::LogicalExpression(it) => it.span_mut(), + Self::NewExpression(it) => it.span_mut(), + Self::ObjectExpression(it) => it.span_mut(), + Self::ParenthesizedExpression(it) => it.span_mut(), + Self::SequenceExpression(it) => it.span_mut(), + Self::TaggedTemplateExpression(it) => it.span_mut(), + Self::ThisExpression(it) => it.span_mut(), + Self::UnaryExpression(it) => it.span_mut(), + Self::UpdateExpression(it) => it.span_mut(), + Self::YieldExpression(it) => it.span_mut(), + Self::PrivateInExpression(it) => it.span_mut(), + Self::JSXElement(it) => it.span_mut(), + Self::JSXFragment(it) => it.span_mut(), + Self::TSAsExpression(it) => it.span_mut(), + Self::TSSatisfiesExpression(it) => it.span_mut(), + Self::TSTypeAssertion(it) => it.span_mut(), + Self::TSNonNullExpression(it) => it.span_mut(), + Self::TSInstantiationExpression(it) => it.span_mut(), + Self::ComputedMemberExpression(it) => it.span_mut(), + Self::StaticMemberExpression(it) => it.span_mut(), + Self::PrivateFieldExpression(it) => it.span_mut(), + } + } +} + impl GetSpan for JSXEmptyExpression { #[inline] fn span(&self) -> Span { @@ -2118,6 +4223,13 @@ impl GetSpan for JSXEmptyExpression { } } +impl GetSpanMut for JSXEmptyExpression { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXAttributeItem<'a> { fn span(&self) -> Span { match self { @@ -2127,6 +4239,15 @@ impl<'a> GetSpan for JSXAttributeItem<'a> { } } +impl<'a> GetSpanMut for JSXAttributeItem<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Attribute(it) => it.span_mut(), + Self::SpreadAttribute(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXAttribute<'a> { #[inline] fn span(&self) -> Span { @@ -2134,6 +4255,13 @@ impl<'a> GetSpan for JSXAttribute<'a> { } } +impl<'a> GetSpanMut for JSXAttribute<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXSpreadAttribute<'a> { #[inline] fn span(&self) -> Span { @@ -2141,6 +4269,13 @@ impl<'a> GetSpan for JSXSpreadAttribute<'a> { } } +impl<'a> GetSpanMut for JSXSpreadAttribute<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXAttributeName<'a> { fn span(&self) -> Span { match self { @@ -2150,6 +4285,15 @@ impl<'a> GetSpan for JSXAttributeName<'a> { } } +impl<'a> GetSpanMut for JSXAttributeName<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Identifier(it) => it.span_mut(), + Self::NamespacedName(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXAttributeValue<'a> { fn span(&self) -> Span { match self { @@ -2161,6 +4305,17 @@ impl<'a> GetSpan for JSXAttributeValue<'a> { } } +impl<'a> GetSpanMut for JSXAttributeValue<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::StringLiteral(it) => it.span_mut(), + Self::ExpressionContainer(it) => it.span_mut(), + Self::Element(it) => it.span_mut(), + Self::Fragment(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXIdentifier<'a> { #[inline] fn span(&self) -> Span { @@ -2168,6 +4323,13 @@ impl<'a> GetSpan for JSXIdentifier<'a> { } } +impl<'a> GetSpanMut for JSXIdentifier<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXChild<'a> { fn span(&self) -> Span { match self { @@ -2180,6 +4342,18 @@ impl<'a> GetSpan for JSXChild<'a> { } } +impl<'a> GetSpanMut for JSXChild<'a> { + fn span_mut(&mut self) -> &mut Span { + match self { + Self::Text(it) => it.span_mut(), + Self::Element(it) => it.span_mut(), + Self::Fragment(it) => it.span_mut(), + Self::ExpressionContainer(it) => it.span_mut(), + Self::Spread(it) => it.span_mut(), + } + } +} + impl<'a> GetSpan for JSXSpreadChild<'a> { #[inline] fn span(&self) -> Span { @@ -2187,9 +4361,23 @@ impl<'a> GetSpan for JSXSpreadChild<'a> { } } +impl<'a> GetSpanMut for JSXSpreadChild<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} + impl<'a> GetSpan for JSXText<'a> { #[inline] fn span(&self) -> Span { self.span } } + +impl<'a> GetSpanMut for JSXText<'a> { + #[inline] + fn span_mut(&mut self) -> &mut Span { + &mut self.span + } +} diff --git a/crates/oxc_span/src/lib.rs b/crates/oxc_span/src/lib.rs index 368f2f7bcbf30..a51b7bd70bf55 100644 --- a/crates/oxc_span/src/lib.rs +++ b/crates/oxc_span/src/lib.rs @@ -9,5 +9,5 @@ mod span; pub use crate::{ atom::{Atom, CompactStr, MAX_INLINE_LEN as ATOM_MAX_INLINE_LEN}, source_type::{Language, LanguageVariant, ModuleKind, SourceType, VALID_EXTENSIONS}, - span::{GetSpan, Span, SPAN}, + span::{GetSpan, GetSpanMut, Span, SPAN}, }; diff --git a/crates/oxc_span/src/span.rs b/crates/oxc_span/src/span.rs index 0f83cb38dd8d4..2440e14cea5fd 100644 --- a/crates/oxc_span/src/span.rs +++ b/crates/oxc_span/src/span.rs @@ -352,12 +352,26 @@ impl From for LabeledSpan { pub trait GetSpan { fn span(&self) -> Span; } + +/// Get mutable ref to span for an AST node +pub trait GetSpanMut { + fn span_mut(&mut self) -> &mut Span; +} + impl GetSpan for Span { + #[inline] fn span(&self) -> Span { *self } } +impl GetSpanMut for Span { + #[inline] + fn span_mut(&mut self) -> &mut Span { + self + } +} + #[cfg(test)] mod test { use super::Span; diff --git a/tasks/ast_codegen/src/generators/impl_get_span.rs b/tasks/ast_codegen/src/generators/impl_get_span.rs index 471f3c49d5179..70a1f583f5b07 100644 --- a/tasks/ast_codegen/src/generators/impl_get_span.rs +++ b/tasks/ast_codegen/src/generators/impl_get_span.rs @@ -1,4 +1,3 @@ -use itertools::Itertools; use proc_macro2::TokenStream; use quote::quote; use syn::Variant; @@ -44,7 +43,7 @@ impl Generator for ImplGetSpanGenerator { endl!(); use crate::ast::*; - use oxc_span::{GetSpan, Span}; + use oxc_span::{GetSpan, GetSpanMut, Span}; #(#impls)* }, @@ -55,11 +54,13 @@ impl Generator for ImplGetSpanGenerator { fn impl_enum(it @ REnum { item, .. }: &REnum) -> TokenStream { let typ = it.as_type(); let generics = &item.generics; - let matches: Vec = item + let (matches, matches_mut): (Vec, Vec) = item .variants .iter() - .map(|Variant { ident, .. }| quote!(Self :: #ident(it) => it.span())) - .collect_vec(); + .map(|Variant { ident, .. }| { + (quote!(Self :: #ident(it) => it.span()), quote!(Self :: #ident(it) => it.span_mut())) + }) + .unzip(); quote! { endl!(); @@ -70,6 +71,15 @@ fn impl_enum(it @ REnum { item, .. }: &REnum) -> TokenStream { } } } + endl!(); + + impl #generics GetSpanMut for #typ { + fn span_mut(&mut self) -> &mut Span { + match self { + #(#matches_mut),* + } + } + } } } @@ -78,18 +88,26 @@ fn impl_struct(it @ RStruct { item, .. }: &RStruct) -> TokenStream { let generics = &item.generics; let inner_span_hint = item.fields.iter().find(|it| it.attrs.iter().any(|a| a.path().is_ident("span"))); - let span = if let Some(span_field) = inner_span_hint { + let (span, span_mut) = if let Some(span_field) = inner_span_hint { let ident = span_field.ident.as_ref().unwrap(); - quote!(#ident.span()) + (quote!(self.#ident.span()), quote!(self.#ident.span_mut())) } else { - quote!(span) + (quote!(self.span), quote!(&mut self.span)) }; quote! { endl!(); impl #generics GetSpan for #typ { #[inline] fn span(&self) -> Span { - self.#span + #span + } + } + endl!(); + + impl #generics GetSpanMut for #typ { + #[inline] + fn span_mut(&mut self) -> &mut Span { + #span_mut } } }