Skip to content

Commit

Permalink
feat(ast): implement From<Argument> for ArrayExpressionElement (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Dec 13, 2024
1 parent 5172f32 commit 6466a4a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@ impl ArrayExpressionElement<'_> {
}
}

impl<'a> From<Argument<'a>> for ArrayExpressionElement<'a> {
fn from(argument: Argument<'a>) -> Self {
if let Argument::SpreadElement(spread) = argument {
ArrayExpressionElement::SpreadElement(spread)
} else {
ArrayExpressionElement::from(argument.into_expression())
}
}
}

impl ObjectPropertyKind<'_> {
/// Returns `true` if this object property is a [spread](SpreadElement).
#[inline]
Expand Down

0 comments on commit 6466a4a

Please sign in to comment.