From 49bb0dd56e632c9d05767a27ff7386a25acb804d Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY Date: Thu, 5 Sep 2024 23:56:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20omit=20'a=20lifetime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxc_ast/src/generated/ast_kind.rs | 338 ++++++++++----------- tasks/ast_tools/src/generators/ast_kind.rs | 2 +- 2 files changed, 169 insertions(+), 171 deletions(-) diff --git a/crates/oxc_ast/src/generated/ast_kind.rs b/crates/oxc_ast/src/generated/ast_kind.rs index f680e9ed6d9f7d..2c68cb9584ece2 100644 --- a/crates/oxc_ast/src/generated/ast_kind.rs +++ b/crates/oxc_ast/src/generated/ast_kind.rs @@ -528,7 +528,7 @@ impl<'a> GetSpan for AstKind<'a> { } impl<'a> AstKind<'a> { - pub fn as_boolean_literal(&self) -> Option<&'a BooleanLiteral> { + pub fn as_boolean_literal(&self) -> Option<&BooleanLiteral> { if let Self::BooleanLiteral(v) = self { Some(*v) } else { @@ -536,7 +536,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_null_literal(&self) -> Option<&'a NullLiteral> { + pub fn as_null_literal(&self) -> Option<&NullLiteral> { if let Self::NullLiteral(v) = self { Some(*v) } else { @@ -544,7 +544,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_numeric_literal(&self) -> Option<&'a NumericLiteral<'a>> { + pub fn as_numeric_literal(&self) -> Option<&NumericLiteral<'a>> { if let Self::NumericLiteral(v) = self { Some(*v) } else { @@ -552,7 +552,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_big_int_literal(&self) -> Option<&'a BigIntLiteral<'a>> { + pub fn as_big_int_literal(&self) -> Option<&BigIntLiteral<'a>> { if let Self::BigIntLiteral(v) = self { Some(*v) } else { @@ -560,7 +560,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_reg_exp_literal(&self) -> Option<&'a RegExpLiteral<'a>> { + pub fn as_reg_exp_literal(&self) -> Option<&RegExpLiteral<'a>> { if let Self::RegExpLiteral(v) = self { Some(*v) } else { @@ -568,7 +568,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_string_literal(&self) -> Option<&'a StringLiteral<'a>> { + pub fn as_string_literal(&self) -> Option<&StringLiteral<'a>> { if let Self::StringLiteral(v) = self { Some(*v) } else { @@ -576,7 +576,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_program(&self) -> Option<&'a Program<'a>> { + pub fn as_program(&self) -> Option<&Program<'a>> { if let Self::Program(v) = self { Some(*v) } else { @@ -584,7 +584,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_identifier_name(&self) -> Option<&'a IdentifierName<'a>> { + pub fn as_identifier_name(&self) -> Option<&IdentifierName<'a>> { if let Self::IdentifierName(v) = self { Some(*v) } else { @@ -592,7 +592,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_identifier_reference(&self) -> Option<&'a IdentifierReference<'a>> { + pub fn as_identifier_reference(&self) -> Option<&IdentifierReference<'a>> { if let Self::IdentifierReference(v) = self { Some(*v) } else { @@ -600,7 +600,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_binding_identifier(&self) -> Option<&'a BindingIdentifier<'a>> { + pub fn as_binding_identifier(&self) -> Option<&BindingIdentifier<'a>> { if let Self::BindingIdentifier(v) = self { Some(*v) } else { @@ -608,7 +608,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_label_identifier(&self) -> Option<&'a LabelIdentifier<'a>> { + pub fn as_label_identifier(&self) -> Option<&LabelIdentifier<'a>> { if let Self::LabelIdentifier(v) = self { Some(*v) } else { @@ -616,7 +616,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_this_expression(&self) -> Option<&'a ThisExpression> { + pub fn as_this_expression(&self) -> Option<&ThisExpression> { if let Self::ThisExpression(v) = self { Some(*v) } else { @@ -624,7 +624,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_array_expression(&self) -> Option<&'a ArrayExpression<'a>> { + pub fn as_array_expression(&self) -> Option<&ArrayExpression<'a>> { if let Self::ArrayExpression(v) = self { Some(*v) } else { @@ -632,7 +632,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_array_expression_element(&self) -> Option<&'a ArrayExpressionElement<'a>> { + pub fn as_array_expression_element(&self) -> Option<&ArrayExpressionElement<'a>> { if let Self::ArrayExpressionElement(v) = self { Some(*v) } else { @@ -640,7 +640,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_elision(&self) -> Option<&'a Elision> { + pub fn as_elision(&self) -> Option<&Elision> { if let Self::Elision(v) = self { Some(*v) } else { @@ -648,7 +648,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_object_expression(&self) -> Option<&'a ObjectExpression<'a>> { + pub fn as_object_expression(&self) -> Option<&ObjectExpression<'a>> { if let Self::ObjectExpression(v) = self { Some(*v) } else { @@ -656,7 +656,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_object_property(&self) -> Option<&'a ObjectProperty<'a>> { + pub fn as_object_property(&self) -> Option<&ObjectProperty<'a>> { if let Self::ObjectProperty(v) = self { Some(*v) } else { @@ -664,7 +664,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_property_key(&self) -> Option<&'a PropertyKey<'a>> { + pub fn as_property_key(&self) -> Option<&PropertyKey<'a>> { if let Self::PropertyKey(v) = self { Some(*v) } else { @@ -672,7 +672,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_template_literal(&self) -> Option<&'a TemplateLiteral<'a>> { + pub fn as_template_literal(&self) -> Option<&TemplateLiteral<'a>> { if let Self::TemplateLiteral(v) = self { Some(*v) } else { @@ -680,7 +680,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_tagged_template_expression(&self) -> Option<&'a TaggedTemplateExpression<'a>> { + pub fn as_tagged_template_expression(&self) -> Option<&TaggedTemplateExpression<'a>> { if let Self::TaggedTemplateExpression(v) = self { Some(*v) } else { @@ -688,7 +688,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_member_expression(&self) -> Option<&'a MemberExpression<'a>> { + pub fn as_member_expression(&self) -> Option<&MemberExpression<'a>> { if let Self::MemberExpression(v) = self { Some(*v) } else { @@ -696,7 +696,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_call_expression(&self) -> Option<&'a CallExpression<'a>> { + pub fn as_call_expression(&self) -> Option<&CallExpression<'a>> { if let Self::CallExpression(v) = self { Some(*v) } else { @@ -704,7 +704,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_new_expression(&self) -> Option<&'a NewExpression<'a>> { + pub fn as_new_expression(&self) -> Option<&NewExpression<'a>> { if let Self::NewExpression(v) = self { Some(*v) } else { @@ -712,7 +712,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_meta_property(&self) -> Option<&'a MetaProperty<'a>> { + pub fn as_meta_property(&self) -> Option<&MetaProperty<'a>> { if let Self::MetaProperty(v) = self { Some(*v) } else { @@ -720,7 +720,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_spread_element(&self) -> Option<&'a SpreadElement<'a>> { + pub fn as_spread_element(&self) -> Option<&SpreadElement<'a>> { if let Self::SpreadElement(v) = self { Some(*v) } else { @@ -728,7 +728,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_argument(&self) -> Option<&'a Argument<'a>> { + pub fn as_argument(&self) -> Option<&Argument<'a>> { if let Self::Argument(v) = self { Some(*v) } else { @@ -736,7 +736,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_update_expression(&self) -> Option<&'a UpdateExpression<'a>> { + pub fn as_update_expression(&self) -> Option<&UpdateExpression<'a>> { if let Self::UpdateExpression(v) = self { Some(*v) } else { @@ -744,7 +744,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_unary_expression(&self) -> Option<&'a UnaryExpression<'a>> { + pub fn as_unary_expression(&self) -> Option<&UnaryExpression<'a>> { if let Self::UnaryExpression(v) = self { Some(*v) } else { @@ -752,7 +752,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_binary_expression(&self) -> Option<&'a BinaryExpression<'a>> { + pub fn as_binary_expression(&self) -> Option<&BinaryExpression<'a>> { if let Self::BinaryExpression(v) = self { Some(*v) } else { @@ -760,7 +760,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_private_in_expression(&self) -> Option<&'a PrivateInExpression<'a>> { + pub fn as_private_in_expression(&self) -> Option<&PrivateInExpression<'a>> { if let Self::PrivateInExpression(v) = self { Some(*v) } else { @@ -768,7 +768,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_logical_expression(&self) -> Option<&'a LogicalExpression<'a>> { + pub fn as_logical_expression(&self) -> Option<&LogicalExpression<'a>> { if let Self::LogicalExpression(v) = self { Some(*v) } else { @@ -776,7 +776,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_conditional_expression(&self) -> Option<&'a ConditionalExpression<'a>> { + pub fn as_conditional_expression(&self) -> Option<&ConditionalExpression<'a>> { if let Self::ConditionalExpression(v) = self { Some(*v) } else { @@ -784,7 +784,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_assignment_expression(&self) -> Option<&'a AssignmentExpression<'a>> { + pub fn as_assignment_expression(&self) -> Option<&AssignmentExpression<'a>> { if let Self::AssignmentExpression(v) = self { Some(*v) } else { @@ -792,7 +792,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_assignment_target(&self) -> Option<&'a AssignmentTarget<'a>> { + pub fn as_assignment_target(&self) -> Option<&AssignmentTarget<'a>> { if let Self::AssignmentTarget(v) = self { Some(*v) } else { @@ -800,7 +800,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_simple_assignment_target(&self) -> Option<&'a SimpleAssignmentTarget<'a>> { + pub fn as_simple_assignment_target(&self) -> Option<&SimpleAssignmentTarget<'a>> { if let Self::SimpleAssignmentTarget(v) = self { Some(*v) } else { @@ -808,7 +808,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_assignment_target_pattern(&self) -> Option<&'a AssignmentTargetPattern<'a>> { + pub fn as_assignment_target_pattern(&self) -> Option<&AssignmentTargetPattern<'a>> { if let Self::AssignmentTargetPattern(v) = self { Some(*v) } else { @@ -816,7 +816,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_array_assignment_target(&self) -> Option<&'a ArrayAssignmentTarget<'a>> { + pub fn as_array_assignment_target(&self) -> Option<&ArrayAssignmentTarget<'a>> { if let Self::ArrayAssignmentTarget(v) = self { Some(*v) } else { @@ -824,7 +824,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_object_assignment_target(&self) -> Option<&'a ObjectAssignmentTarget<'a>> { + pub fn as_object_assignment_target(&self) -> Option<&ObjectAssignmentTarget<'a>> { if let Self::ObjectAssignmentTarget(v) = self { Some(*v) } else { @@ -832,7 +832,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_assignment_target_with_default(&self) -> Option<&'a AssignmentTargetWithDefault<'a>> { + pub fn as_assignment_target_with_default(&self) -> Option<&AssignmentTargetWithDefault<'a>> { if let Self::AssignmentTargetWithDefault(v) = self { Some(*v) } else { @@ -840,7 +840,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_sequence_expression(&self) -> Option<&'a SequenceExpression<'a>> { + pub fn as_sequence_expression(&self) -> Option<&SequenceExpression<'a>> { if let Self::SequenceExpression(v) = self { Some(*v) } else { @@ -848,7 +848,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_super(&self) -> Option<&'a Super> { + pub fn as_super(&self) -> Option<&Super> { if let Self::Super(v) = self { Some(*v) } else { @@ -856,7 +856,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_await_expression(&self) -> Option<&'a AwaitExpression<'a>> { + pub fn as_await_expression(&self) -> Option<&AwaitExpression<'a>> { if let Self::AwaitExpression(v) = self { Some(*v) } else { @@ -864,7 +864,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_chain_expression(&self) -> Option<&'a ChainExpression<'a>> { + pub fn as_chain_expression(&self) -> Option<&ChainExpression<'a>> { if let Self::ChainExpression(v) = self { Some(*v) } else { @@ -872,7 +872,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_parenthesized_expression(&self) -> Option<&'a ParenthesizedExpression<'a>> { + pub fn as_parenthesized_expression(&self) -> Option<&ParenthesizedExpression<'a>> { if let Self::ParenthesizedExpression(v) = self { Some(*v) } else { @@ -880,7 +880,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_directive(&self) -> Option<&'a Directive<'a>> { + pub fn as_directive(&self) -> Option<&Directive<'a>> { if let Self::Directive(v) = self { Some(*v) } else { @@ -888,7 +888,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_hashbang(&self) -> Option<&'a Hashbang<'a>> { + pub fn as_hashbang(&self) -> Option<&Hashbang<'a>> { if let Self::Hashbang(v) = self { Some(*v) } else { @@ -896,7 +896,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_block_statement(&self) -> Option<&'a BlockStatement<'a>> { + pub fn as_block_statement(&self) -> Option<&BlockStatement<'a>> { if let Self::BlockStatement(v) = self { Some(*v) } else { @@ -904,7 +904,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_variable_declaration(&self) -> Option<&'a VariableDeclaration<'a>> { + pub fn as_variable_declaration(&self) -> Option<&VariableDeclaration<'a>> { if let Self::VariableDeclaration(v) = self { Some(*v) } else { @@ -912,7 +912,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_variable_declarator(&self) -> Option<&'a VariableDeclarator<'a>> { + pub fn as_variable_declarator(&self) -> Option<&VariableDeclarator<'a>> { if let Self::VariableDeclarator(v) = self { Some(*v) } else { @@ -920,7 +920,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_empty_statement(&self) -> Option<&'a EmptyStatement> { + pub fn as_empty_statement(&self) -> Option<&EmptyStatement> { if let Self::EmptyStatement(v) = self { Some(*v) } else { @@ -928,7 +928,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_expression_statement(&self) -> Option<&'a ExpressionStatement<'a>> { + pub fn as_expression_statement(&self) -> Option<&ExpressionStatement<'a>> { if let Self::ExpressionStatement(v) = self { Some(*v) } else { @@ -936,7 +936,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_if_statement(&self) -> Option<&'a IfStatement<'a>> { + pub fn as_if_statement(&self) -> Option<&IfStatement<'a>> { if let Self::IfStatement(v) = self { Some(*v) } else { @@ -944,7 +944,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_do_while_statement(&self) -> Option<&'a DoWhileStatement<'a>> { + pub fn as_do_while_statement(&self) -> Option<&DoWhileStatement<'a>> { if let Self::DoWhileStatement(v) = self { Some(*v) } else { @@ -952,7 +952,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_while_statement(&self) -> Option<&'a WhileStatement<'a>> { + pub fn as_while_statement(&self) -> Option<&WhileStatement<'a>> { if let Self::WhileStatement(v) = self { Some(*v) } else { @@ -960,7 +960,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_for_statement(&self) -> Option<&'a ForStatement<'a>> { + pub fn as_for_statement(&self) -> Option<&ForStatement<'a>> { if let Self::ForStatement(v) = self { Some(*v) } else { @@ -968,7 +968,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_for_statement_init(&self) -> Option<&'a ForStatementInit<'a>> { + pub fn as_for_statement_init(&self) -> Option<&ForStatementInit<'a>> { if let Self::ForStatementInit(v) = self { Some(*v) } else { @@ -976,7 +976,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_for_in_statement(&self) -> Option<&'a ForInStatement<'a>> { + pub fn as_for_in_statement(&self) -> Option<&ForInStatement<'a>> { if let Self::ForInStatement(v) = self { Some(*v) } else { @@ -984,7 +984,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_for_of_statement(&self) -> Option<&'a ForOfStatement<'a>> { + pub fn as_for_of_statement(&self) -> Option<&ForOfStatement<'a>> { if let Self::ForOfStatement(v) = self { Some(*v) } else { @@ -992,7 +992,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_continue_statement(&self) -> Option<&'a ContinueStatement<'a>> { + pub fn as_continue_statement(&self) -> Option<&ContinueStatement<'a>> { if let Self::ContinueStatement(v) = self { Some(*v) } else { @@ -1000,7 +1000,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_break_statement(&self) -> Option<&'a BreakStatement<'a>> { + pub fn as_break_statement(&self) -> Option<&BreakStatement<'a>> { if let Self::BreakStatement(v) = self { Some(*v) } else { @@ -1008,7 +1008,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_return_statement(&self) -> Option<&'a ReturnStatement<'a>> { + pub fn as_return_statement(&self) -> Option<&ReturnStatement<'a>> { if let Self::ReturnStatement(v) = self { Some(*v) } else { @@ -1016,7 +1016,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_with_statement(&self) -> Option<&'a WithStatement<'a>> { + pub fn as_with_statement(&self) -> Option<&WithStatement<'a>> { if let Self::WithStatement(v) = self { Some(*v) } else { @@ -1024,7 +1024,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_switch_statement(&self) -> Option<&'a SwitchStatement<'a>> { + pub fn as_switch_statement(&self) -> Option<&SwitchStatement<'a>> { if let Self::SwitchStatement(v) = self { Some(*v) } else { @@ -1032,7 +1032,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_switch_case(&self) -> Option<&'a SwitchCase<'a>> { + pub fn as_switch_case(&self) -> Option<&SwitchCase<'a>> { if let Self::SwitchCase(v) = self { Some(*v) } else { @@ -1040,7 +1040,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_labeled_statement(&self) -> Option<&'a LabeledStatement<'a>> { + pub fn as_labeled_statement(&self) -> Option<&LabeledStatement<'a>> { if let Self::LabeledStatement(v) = self { Some(*v) } else { @@ -1048,7 +1048,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_throw_statement(&self) -> Option<&'a ThrowStatement<'a>> { + pub fn as_throw_statement(&self) -> Option<&ThrowStatement<'a>> { if let Self::ThrowStatement(v) = self { Some(*v) } else { @@ -1056,7 +1056,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_try_statement(&self) -> Option<&'a TryStatement<'a>> { + pub fn as_try_statement(&self) -> Option<&TryStatement<'a>> { if let Self::TryStatement(v) = self { Some(*v) } else { @@ -1064,7 +1064,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_finally_clause(&self) -> Option<&'a BlockStatement<'a>> { + pub fn as_finally_clause(&self) -> Option<&BlockStatement<'a>> { if let Self::FinallyClause(v) = self { Some(*v) } else { @@ -1072,7 +1072,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_catch_clause(&self) -> Option<&'a CatchClause<'a>> { + pub fn as_catch_clause(&self) -> Option<&CatchClause<'a>> { if let Self::CatchClause(v) = self { Some(*v) } else { @@ -1080,7 +1080,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_catch_parameter(&self) -> Option<&'a CatchParameter<'a>> { + pub fn as_catch_parameter(&self) -> Option<&CatchParameter<'a>> { if let Self::CatchParameter(v) = self { Some(*v) } else { @@ -1088,7 +1088,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_debugger_statement(&self) -> Option<&'a DebuggerStatement> { + pub fn as_debugger_statement(&self) -> Option<&DebuggerStatement> { if let Self::DebuggerStatement(v) = self { Some(*v) } else { @@ -1096,7 +1096,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_assignment_pattern(&self) -> Option<&'a AssignmentPattern<'a>> { + pub fn as_assignment_pattern(&self) -> Option<&AssignmentPattern<'a>> { if let Self::AssignmentPattern(v) = self { Some(*v) } else { @@ -1104,7 +1104,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_object_pattern(&self) -> Option<&'a ObjectPattern<'a>> { + pub fn as_object_pattern(&self) -> Option<&ObjectPattern<'a>> { if let Self::ObjectPattern(v) = self { Some(*v) } else { @@ -1112,7 +1112,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_array_pattern(&self) -> Option<&'a ArrayPattern<'a>> { + pub fn as_array_pattern(&self) -> Option<&ArrayPattern<'a>> { if let Self::ArrayPattern(v) = self { Some(*v) } else { @@ -1120,7 +1120,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_binding_rest_element(&self) -> Option<&'a BindingRestElement<'a>> { + pub fn as_binding_rest_element(&self) -> Option<&BindingRestElement<'a>> { if let Self::BindingRestElement(v) = self { Some(*v) } else { @@ -1128,7 +1128,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_function(&self) -> Option<&'a Function<'a>> { + pub fn as_function(&self) -> Option<&Function<'a>> { if let Self::Function(v) = self { Some(*v) } else { @@ -1136,7 +1136,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_formal_parameters(&self) -> Option<&'a FormalParameters<'a>> { + pub fn as_formal_parameters(&self) -> Option<&FormalParameters<'a>> { if let Self::FormalParameters(v) = self { Some(*v) } else { @@ -1144,7 +1144,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_formal_parameter(&self) -> Option<&'a FormalParameter<'a>> { + pub fn as_formal_parameter(&self) -> Option<&FormalParameter<'a>> { if let Self::FormalParameter(v) = self { Some(*v) } else { @@ -1152,7 +1152,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_function_body(&self) -> Option<&'a FunctionBody<'a>> { + pub fn as_function_body(&self) -> Option<&FunctionBody<'a>> { if let Self::FunctionBody(v) = self { Some(*v) } else { @@ -1160,7 +1160,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_arrow_function_expression(&self) -> Option<&'a ArrowFunctionExpression<'a>> { + pub fn as_arrow_function_expression(&self) -> Option<&ArrowFunctionExpression<'a>> { if let Self::ArrowFunctionExpression(v) = self { Some(*v) } else { @@ -1168,7 +1168,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_yield_expression(&self) -> Option<&'a YieldExpression<'a>> { + pub fn as_yield_expression(&self) -> Option<&YieldExpression<'a>> { if let Self::YieldExpression(v) = self { Some(*v) } else { @@ -1176,7 +1176,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_class(&self) -> Option<&'a Class<'a>> { + pub fn as_class(&self) -> Option<&Class<'a>> { if let Self::Class(v) = self { Some(*v) } else { @@ -1184,7 +1184,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_class_heritage(&self) -> Option<&'a Expression<'a>> { + pub fn as_class_heritage(&self) -> Option<&Expression<'a>> { if let Self::ClassHeritage(v) = self { Some(*v) } else { @@ -1192,7 +1192,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_class_body(&self) -> Option<&'a ClassBody<'a>> { + pub fn as_class_body(&self) -> Option<&ClassBody<'a>> { if let Self::ClassBody(v) = self { Some(*v) } else { @@ -1200,7 +1200,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_method_definition(&self) -> Option<&'a MethodDefinition<'a>> { + pub fn as_method_definition(&self) -> Option<&MethodDefinition<'a>> { if let Self::MethodDefinition(v) = self { Some(*v) } else { @@ -1208,7 +1208,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_property_definition(&self) -> Option<&'a PropertyDefinition<'a>> { + pub fn as_property_definition(&self) -> Option<&PropertyDefinition<'a>> { if let Self::PropertyDefinition(v) = self { Some(*v) } else { @@ -1216,7 +1216,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_private_identifier(&self) -> Option<&'a PrivateIdentifier<'a>> { + pub fn as_private_identifier(&self) -> Option<&PrivateIdentifier<'a>> { if let Self::PrivateIdentifier(v) = self { Some(*v) } else { @@ -1224,7 +1224,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_static_block(&self) -> Option<&'a StaticBlock<'a>> { + pub fn as_static_block(&self) -> Option<&StaticBlock<'a>> { if let Self::StaticBlock(v) = self { Some(*v) } else { @@ -1232,7 +1232,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_module_declaration(&self) -> Option<&'a ModuleDeclaration<'a>> { + pub fn as_module_declaration(&self) -> Option<&ModuleDeclaration<'a>> { if let Self::ModuleDeclaration(v) = self { Some(*v) } else { @@ -1240,7 +1240,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_import_expression(&self) -> Option<&'a ImportExpression<'a>> { + pub fn as_import_expression(&self) -> Option<&ImportExpression<'a>> { if let Self::ImportExpression(v) = self { Some(*v) } else { @@ -1248,7 +1248,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_import_declaration(&self) -> Option<&'a ImportDeclaration<'a>> { + pub fn as_import_declaration(&self) -> Option<&ImportDeclaration<'a>> { if let Self::ImportDeclaration(v) = self { Some(*v) } else { @@ -1256,7 +1256,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_import_specifier(&self) -> Option<&'a ImportSpecifier<'a>> { + pub fn as_import_specifier(&self) -> Option<&ImportSpecifier<'a>> { if let Self::ImportSpecifier(v) = self { Some(*v) } else { @@ -1264,7 +1264,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_import_default_specifier(&self) -> Option<&'a ImportDefaultSpecifier<'a>> { + pub fn as_import_default_specifier(&self) -> Option<&ImportDefaultSpecifier<'a>> { if let Self::ImportDefaultSpecifier(v) = self { Some(*v) } else { @@ -1272,7 +1272,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_import_namespace_specifier(&self) -> Option<&'a ImportNamespaceSpecifier<'a>> { + pub fn as_import_namespace_specifier(&self) -> Option<&ImportNamespaceSpecifier<'a>> { if let Self::ImportNamespaceSpecifier(v) = self { Some(*v) } else { @@ -1280,7 +1280,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_export_named_declaration(&self) -> Option<&'a ExportNamedDeclaration<'a>> { + pub fn as_export_named_declaration(&self) -> Option<&ExportNamedDeclaration<'a>> { if let Self::ExportNamedDeclaration(v) = self { Some(*v) } else { @@ -1288,7 +1288,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_export_default_declaration(&self) -> Option<&'a ExportDefaultDeclaration<'a>> { + pub fn as_export_default_declaration(&self) -> Option<&ExportDefaultDeclaration<'a>> { if let Self::ExportDefaultDeclaration(v) = self { Some(*v) } else { @@ -1296,7 +1296,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_export_all_declaration(&self) -> Option<&'a ExportAllDeclaration<'a>> { + pub fn as_export_all_declaration(&self) -> Option<&ExportAllDeclaration<'a>> { if let Self::ExportAllDeclaration(v) = self { Some(*v) } else { @@ -1304,7 +1304,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_export_specifier(&self) -> Option<&'a ExportSpecifier<'a>> { + pub fn as_export_specifier(&self) -> Option<&ExportSpecifier<'a>> { if let Self::ExportSpecifier(v) = self { Some(*v) } else { @@ -1312,7 +1312,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_this_parameter(&self) -> Option<&'a TSThisParameter<'a>> { + pub fn as_ts_this_parameter(&self) -> Option<&TSThisParameter<'a>> { if let Self::TSThisParameter(v) = self { Some(*v) } else { @@ -1320,7 +1320,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_enum_declaration(&self) -> Option<&'a TSEnumDeclaration<'a>> { + pub fn as_ts_enum_declaration(&self) -> Option<&TSEnumDeclaration<'a>> { if let Self::TSEnumDeclaration(v) = self { Some(*v) } else { @@ -1328,7 +1328,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_enum_member(&self) -> Option<&'a TSEnumMember<'a>> { + pub fn as_ts_enum_member(&self) -> Option<&TSEnumMember<'a>> { if let Self::TSEnumMember(v) = self { Some(*v) } else { @@ -1336,7 +1336,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_annotation(&self) -> Option<&'a TSTypeAnnotation<'a>> { + pub fn as_ts_type_annotation(&self) -> Option<&TSTypeAnnotation<'a>> { if let Self::TSTypeAnnotation(v) = self { Some(*v) } else { @@ -1344,7 +1344,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_literal_type(&self) -> Option<&'a TSLiteralType<'a>> { + pub fn as_ts_literal_type(&self) -> Option<&TSLiteralType<'a>> { if let Self::TSLiteralType(v) = self { Some(*v) } else { @@ -1352,7 +1352,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_conditional_type(&self) -> Option<&'a TSConditionalType<'a>> { + pub fn as_ts_conditional_type(&self) -> Option<&TSConditionalType<'a>> { if let Self::TSConditionalType(v) = self { Some(*v) } else { @@ -1360,7 +1360,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_union_type(&self) -> Option<&'a TSUnionType<'a>> { + pub fn as_ts_union_type(&self) -> Option<&TSUnionType<'a>> { if let Self::TSUnionType(v) = self { Some(*v) } else { @@ -1368,7 +1368,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_intersection_type(&self) -> Option<&'a TSIntersectionType<'a>> { + pub fn as_ts_intersection_type(&self) -> Option<&TSIntersectionType<'a>> { if let Self::TSIntersectionType(v) = self { Some(*v) } else { @@ -1376,7 +1376,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_parenthesized_type(&self) -> Option<&'a TSParenthesizedType<'a>> { + pub fn as_ts_parenthesized_type(&self) -> Option<&TSParenthesizedType<'a>> { if let Self::TSParenthesizedType(v) = self { Some(*v) } else { @@ -1384,7 +1384,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_indexed_access_type(&self) -> Option<&'a TSIndexedAccessType<'a>> { + pub fn as_ts_indexed_access_type(&self) -> Option<&TSIndexedAccessType<'a>> { if let Self::TSIndexedAccessType(v) = self { Some(*v) } else { @@ -1392,7 +1392,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_named_tuple_member(&self) -> Option<&'a TSNamedTupleMember<'a>> { + pub fn as_ts_named_tuple_member(&self) -> Option<&TSNamedTupleMember<'a>> { if let Self::TSNamedTupleMember(v) = self { Some(*v) } else { @@ -1400,7 +1400,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_any_keyword(&self) -> Option<&'a TSAnyKeyword> { + pub fn as_ts_any_keyword(&self) -> Option<&TSAnyKeyword> { if let Self::TSAnyKeyword(v) = self { Some(*v) } else { @@ -1408,7 +1408,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_string_keyword(&self) -> Option<&'a TSStringKeyword> { + pub fn as_ts_string_keyword(&self) -> Option<&TSStringKeyword> { if let Self::TSStringKeyword(v) = self { Some(*v) } else { @@ -1416,7 +1416,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_boolean_keyword(&self) -> Option<&'a TSBooleanKeyword> { + pub fn as_ts_boolean_keyword(&self) -> Option<&TSBooleanKeyword> { if let Self::TSBooleanKeyword(v) = self { Some(*v) } else { @@ -1424,7 +1424,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_number_keyword(&self) -> Option<&'a TSNumberKeyword> { + pub fn as_ts_number_keyword(&self) -> Option<&TSNumberKeyword> { if let Self::TSNumberKeyword(v) = self { Some(*v) } else { @@ -1432,7 +1432,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_never_keyword(&self) -> Option<&'a TSNeverKeyword> { + pub fn as_ts_never_keyword(&self) -> Option<&TSNeverKeyword> { if let Self::TSNeverKeyword(v) = self { Some(*v) } else { @@ -1440,7 +1440,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_intrinsic_keyword(&self) -> Option<&'a TSIntrinsicKeyword> { + pub fn as_ts_intrinsic_keyword(&self) -> Option<&TSIntrinsicKeyword> { if let Self::TSIntrinsicKeyword(v) = self { Some(*v) } else { @@ -1448,7 +1448,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_unknown_keyword(&self) -> Option<&'a TSUnknownKeyword> { + pub fn as_ts_unknown_keyword(&self) -> Option<&TSUnknownKeyword> { if let Self::TSUnknownKeyword(v) = self { Some(*v) } else { @@ -1456,7 +1456,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_null_keyword(&self) -> Option<&'a TSNullKeyword> { + pub fn as_ts_null_keyword(&self) -> Option<&TSNullKeyword> { if let Self::TSNullKeyword(v) = self { Some(*v) } else { @@ -1464,7 +1464,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_undefined_keyword(&self) -> Option<&'a TSUndefinedKeyword> { + pub fn as_ts_undefined_keyword(&self) -> Option<&TSUndefinedKeyword> { if let Self::TSUndefinedKeyword(v) = self { Some(*v) } else { @@ -1472,7 +1472,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_void_keyword(&self) -> Option<&'a TSVoidKeyword> { + pub fn as_ts_void_keyword(&self) -> Option<&TSVoidKeyword> { if let Self::TSVoidKeyword(v) = self { Some(*v) } else { @@ -1480,7 +1480,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_symbol_keyword(&self) -> Option<&'a TSSymbolKeyword> { + pub fn as_ts_symbol_keyword(&self) -> Option<&TSSymbolKeyword> { if let Self::TSSymbolKeyword(v) = self { Some(*v) } else { @@ -1488,7 +1488,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_this_type(&self) -> Option<&'a TSThisType> { + pub fn as_ts_this_type(&self) -> Option<&TSThisType> { if let Self::TSThisType(v) = self { Some(*v) } else { @@ -1496,7 +1496,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_object_keyword(&self) -> Option<&'a TSObjectKeyword> { + pub fn as_ts_object_keyword(&self) -> Option<&TSObjectKeyword> { if let Self::TSObjectKeyword(v) = self { Some(*v) } else { @@ -1504,7 +1504,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_big_int_keyword(&self) -> Option<&'a TSBigIntKeyword> { + pub fn as_ts_big_int_keyword(&self) -> Option<&TSBigIntKeyword> { if let Self::TSBigIntKeyword(v) = self { Some(*v) } else { @@ -1512,7 +1512,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_reference(&self) -> Option<&'a TSTypeReference<'a>> { + pub fn as_ts_type_reference(&self) -> Option<&TSTypeReference<'a>> { if let Self::TSTypeReference(v) = self { Some(*v) } else { @@ -1520,7 +1520,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_name(&self) -> Option<&'a TSTypeName<'a>> { + pub fn as_ts_type_name(&self) -> Option<&TSTypeName<'a>> { if let Self::TSTypeName(v) = self { Some(*v) } else { @@ -1528,7 +1528,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_qualified_name(&self) -> Option<&'a TSQualifiedName<'a>> { + pub fn as_ts_qualified_name(&self) -> Option<&TSQualifiedName<'a>> { if let Self::TSQualifiedName(v) = self { Some(*v) } else { @@ -1536,9 +1536,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_parameter_instantiation( - &self, - ) -> Option<&'a TSTypeParameterInstantiation<'a>> { + pub fn as_ts_type_parameter_instantiation(&self) -> Option<&TSTypeParameterInstantiation<'a>> { if let Self::TSTypeParameterInstantiation(v) = self { Some(*v) } else { @@ -1546,7 +1544,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_parameter(&self) -> Option<&'a TSTypeParameter<'a>> { + pub fn as_ts_type_parameter(&self) -> Option<&TSTypeParameter<'a>> { if let Self::TSTypeParameter(v) = self { Some(*v) } else { @@ -1554,7 +1552,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_parameter_declaration(&self) -> Option<&'a TSTypeParameterDeclaration<'a>> { + pub fn as_ts_type_parameter_declaration(&self) -> Option<&TSTypeParameterDeclaration<'a>> { if let Self::TSTypeParameterDeclaration(v) = self { Some(*v) } else { @@ -1562,7 +1560,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_alias_declaration(&self) -> Option<&'a TSTypeAliasDeclaration<'a>> { + pub fn as_ts_type_alias_declaration(&self) -> Option<&TSTypeAliasDeclaration<'a>> { if let Self::TSTypeAliasDeclaration(v) = self { Some(*v) } else { @@ -1570,7 +1568,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_class_implements(&self) -> Option<&'a TSClassImplements<'a>> { + pub fn as_ts_class_implements(&self) -> Option<&TSClassImplements<'a>> { if let Self::TSClassImplements(v) = self { Some(*v) } else { @@ -1578,7 +1576,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_interface_declaration(&self) -> Option<&'a TSInterfaceDeclaration<'a>> { + pub fn as_ts_interface_declaration(&self) -> Option<&TSInterfaceDeclaration<'a>> { if let Self::TSInterfaceDeclaration(v) = self { Some(*v) } else { @@ -1586,7 +1584,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_property_signature(&self) -> Option<&'a TSPropertySignature<'a>> { + pub fn as_ts_property_signature(&self) -> Option<&TSPropertySignature<'a>> { if let Self::TSPropertySignature(v) = self { Some(*v) } else { @@ -1594,7 +1592,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_method_signature(&self) -> Option<&'a TSMethodSignature<'a>> { + pub fn as_ts_method_signature(&self) -> Option<&TSMethodSignature<'a>> { if let Self::TSMethodSignature(v) = self { Some(*v) } else { @@ -1604,7 +1602,7 @@ impl<'a> AstKind<'a> { pub fn as_ts_construct_signature_declaration( &self, - ) -> Option<&'a TSConstructSignatureDeclaration<'a>> { + ) -> Option<&TSConstructSignatureDeclaration<'a>> { if let Self::TSConstructSignatureDeclaration(v) = self { Some(*v) } else { @@ -1612,7 +1610,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_interface_heritage(&self) -> Option<&'a TSInterfaceHeritage<'a>> { + pub fn as_ts_interface_heritage(&self) -> Option<&TSInterfaceHeritage<'a>> { if let Self::TSInterfaceHeritage(v) = self { Some(*v) } else { @@ -1620,7 +1618,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_module_declaration(&self) -> Option<&'a TSModuleDeclaration<'a>> { + pub fn as_ts_module_declaration(&self) -> Option<&TSModuleDeclaration<'a>> { if let Self::TSModuleDeclaration(v) = self { Some(*v) } else { @@ -1628,7 +1626,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_module_block(&self) -> Option<&'a TSModuleBlock<'a>> { + pub fn as_ts_module_block(&self) -> Option<&TSModuleBlock<'a>> { if let Self::TSModuleBlock(v) = self { Some(*v) } else { @@ -1636,7 +1634,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_literal(&self) -> Option<&'a TSTypeLiteral<'a>> { + pub fn as_ts_type_literal(&self) -> Option<&TSTypeLiteral<'a>> { if let Self::TSTypeLiteral(v) = self { Some(*v) } else { @@ -1644,7 +1642,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_infer_type(&self) -> Option<&'a TSInferType<'a>> { + pub fn as_ts_infer_type(&self) -> Option<&TSInferType<'a>> { if let Self::TSInferType(v) = self { Some(*v) } else { @@ -1652,7 +1650,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_query(&self) -> Option<&'a TSTypeQuery<'a>> { + pub fn as_ts_type_query(&self) -> Option<&TSTypeQuery<'a>> { if let Self::TSTypeQuery(v) = self { Some(*v) } else { @@ -1660,7 +1658,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_import_type(&self) -> Option<&'a TSImportType<'a>> { + pub fn as_ts_import_type(&self) -> Option<&TSImportType<'a>> { if let Self::TSImportType(v) = self { Some(*v) } else { @@ -1668,7 +1666,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_mapped_type(&self) -> Option<&'a TSMappedType<'a>> { + pub fn as_ts_mapped_type(&self) -> Option<&TSMappedType<'a>> { if let Self::TSMappedType(v) = self { Some(*v) } else { @@ -1676,7 +1674,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_template_literal_type(&self) -> Option<&'a TSTemplateLiteralType<'a>> { + pub fn as_ts_template_literal_type(&self) -> Option<&TSTemplateLiteralType<'a>> { if let Self::TSTemplateLiteralType(v) = self { Some(*v) } else { @@ -1684,7 +1682,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_as_expression(&self) -> Option<&'a TSAsExpression<'a>> { + pub fn as_ts_as_expression(&self) -> Option<&TSAsExpression<'a>> { if let Self::TSAsExpression(v) = self { Some(*v) } else { @@ -1692,7 +1690,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_satisfies_expression(&self) -> Option<&'a TSSatisfiesExpression<'a>> { + pub fn as_ts_satisfies_expression(&self) -> Option<&TSSatisfiesExpression<'a>> { if let Self::TSSatisfiesExpression(v) = self { Some(*v) } else { @@ -1700,7 +1698,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_type_assertion(&self) -> Option<&'a TSTypeAssertion<'a>> { + pub fn as_ts_type_assertion(&self) -> Option<&TSTypeAssertion<'a>> { if let Self::TSTypeAssertion(v) = self { Some(*v) } else { @@ -1708,7 +1706,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_import_equals_declaration(&self) -> Option<&'a TSImportEqualsDeclaration<'a>> { + pub fn as_ts_import_equals_declaration(&self) -> Option<&TSImportEqualsDeclaration<'a>> { if let Self::TSImportEqualsDeclaration(v) = self { Some(*v) } else { @@ -1716,7 +1714,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_module_reference(&self) -> Option<&'a TSModuleReference<'a>> { + pub fn as_ts_module_reference(&self) -> Option<&TSModuleReference<'a>> { if let Self::TSModuleReference(v) = self { Some(*v) } else { @@ -1724,7 +1722,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_external_module_reference(&self) -> Option<&'a TSExternalModuleReference<'a>> { + pub fn as_ts_external_module_reference(&self) -> Option<&TSExternalModuleReference<'a>> { if let Self::TSExternalModuleReference(v) = self { Some(*v) } else { @@ -1732,7 +1730,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_non_null_expression(&self) -> Option<&'a TSNonNullExpression<'a>> { + pub fn as_ts_non_null_expression(&self) -> Option<&TSNonNullExpression<'a>> { if let Self::TSNonNullExpression(v) = self { Some(*v) } else { @@ -1740,7 +1738,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_decorator(&self) -> Option<&'a Decorator<'a>> { + pub fn as_decorator(&self) -> Option<&Decorator<'a>> { if let Self::Decorator(v) = self { Some(*v) } else { @@ -1748,7 +1746,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_export_assignment(&self) -> Option<&'a TSExportAssignment<'a>> { + pub fn as_ts_export_assignment(&self) -> Option<&TSExportAssignment<'a>> { if let Self::TSExportAssignment(v) = self { Some(*v) } else { @@ -1756,7 +1754,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_ts_instantiation_expression(&self) -> Option<&'a TSInstantiationExpression<'a>> { + pub fn as_ts_instantiation_expression(&self) -> Option<&TSInstantiationExpression<'a>> { if let Self::TSInstantiationExpression(v) = self { Some(*v) } else { @@ -1764,7 +1762,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_element(&self) -> Option<&'a JSXElement<'a>> { + pub fn as_jsx_element(&self) -> Option<&JSXElement<'a>> { if let Self::JSXElement(v) = self { Some(*v) } else { @@ -1772,7 +1770,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_opening_element(&self) -> Option<&'a JSXOpeningElement<'a>> { + pub fn as_jsx_opening_element(&self) -> Option<&JSXOpeningElement<'a>> { if let Self::JSXOpeningElement(v) = self { Some(*v) } else { @@ -1780,7 +1778,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_closing_element(&self) -> Option<&'a JSXClosingElement<'a>> { + pub fn as_jsx_closing_element(&self) -> Option<&JSXClosingElement<'a>> { if let Self::JSXClosingElement(v) = self { Some(*v) } else { @@ -1788,7 +1786,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_fragment(&self) -> Option<&'a JSXFragment<'a>> { + pub fn as_jsx_fragment(&self) -> Option<&JSXFragment<'a>> { if let Self::JSXFragment(v) = self { Some(*v) } else { @@ -1796,7 +1794,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_element_name(&self) -> Option<&'a JSXElementName<'a>> { + pub fn as_jsx_element_name(&self) -> Option<&JSXElementName<'a>> { if let Self::JSXElementName(v) = self { Some(*v) } else { @@ -1804,7 +1802,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_namespaced_name(&self) -> Option<&'a JSXNamespacedName<'a>> { + pub fn as_jsx_namespaced_name(&self) -> Option<&JSXNamespacedName<'a>> { if let Self::JSXNamespacedName(v) = self { Some(*v) } else { @@ -1812,7 +1810,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_member_expression(&self) -> Option<&'a JSXMemberExpression<'a>> { + pub fn as_jsx_member_expression(&self) -> Option<&JSXMemberExpression<'a>> { if let Self::JSXMemberExpression(v) = self { Some(*v) } else { @@ -1820,7 +1818,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_member_expression_object(&self) -> Option<&'a JSXMemberExpressionObject<'a>> { + pub fn as_jsx_member_expression_object(&self) -> Option<&JSXMemberExpressionObject<'a>> { if let Self::JSXMemberExpressionObject(v) = self { Some(*v) } else { @@ -1828,7 +1826,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_expression_container(&self) -> Option<&'a JSXExpressionContainer<'a>> { + pub fn as_jsx_expression_container(&self) -> Option<&JSXExpressionContainer<'a>> { if let Self::JSXExpressionContainer(v) = self { Some(*v) } else { @@ -1836,7 +1834,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_attribute_item(&self) -> Option<&'a JSXAttributeItem<'a>> { + pub fn as_jsx_attribute_item(&self) -> Option<&JSXAttributeItem<'a>> { if let Self::JSXAttributeItem(v) = self { Some(*v) } else { @@ -1844,7 +1842,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_spread_attribute(&self) -> Option<&'a JSXSpreadAttribute<'a>> { + pub fn as_jsx_spread_attribute(&self) -> Option<&JSXSpreadAttribute<'a>> { if let Self::JSXSpreadAttribute(v) = self { Some(*v) } else { @@ -1852,7 +1850,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_identifier(&self) -> Option<&'a JSXIdentifier<'a>> { + pub fn as_jsx_identifier(&self) -> Option<&JSXIdentifier<'a>> { if let Self::JSXIdentifier(v) = self { Some(*v) } else { @@ -1860,7 +1858,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_jsx_text(&self) -> Option<&'a JSXText<'a>> { + pub fn as_jsx_text(&self) -> Option<&JSXText<'a>> { if let Self::JSXText(v) = self { Some(*v) } else { @@ -1868,7 +1866,7 @@ impl<'a> AstKind<'a> { } } - pub fn as_expression_array_element(&self) -> Option<&'a Expression<'a>> { + pub fn as_expression_array_element(&self) -> Option<&Expression<'a>> { if let Self::ExpressionArrayElement(v) = self { Some(*v) } else { diff --git a/tasks/ast_tools/src/generators/ast_kind.rs b/tasks/ast_tools/src/generators/ast_kind.rs index 76a475cb4981ff..eede627b4415fc 100644 --- a/tasks/ast_tools/src/generators/ast_kind.rs +++ b/tasks/ast_tools/src/generators/ast_kind.rs @@ -162,7 +162,7 @@ impl Generator for AstKindGenerator { format_ident!("as_{}", ident.to_string().to_case(Case::Snake)); parse_quote!( ///@@line_break - pub fn #snake_case_name(&self) -> Option<&'a #typ> { + pub fn #snake_case_name(&self) -> Option<&#typ> { if let Self::#ident(v) = self { Some(*v) } else {