Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ast): fix lifetimes on custom Serialize impls #8899

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions crates/oxc_ast/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl From<&NullLiteral> for ESTreeLiteral<'_, ()> {
}
}

impl<'a> From<&'a NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
fn from(lit: &'a NumericLiteral) -> Self {
impl<'a> From<&NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
fn from(lit: &NumericLiteral<'a>) -> Self {
Self {
span: lit.span,
value: lit.value,
Expand All @@ -61,20 +61,20 @@ impl<'a> From<&'a NumericLiteral<'a>> for ESTreeLiteral<'a, f64> {
}
}

impl<'a> From<&'a StringLiteral<'a>> for ESTreeLiteral<'a, &'a str> {
fn from(lit: &'a StringLiteral) -> Self {
impl<'a> From<&StringLiteral<'a>> for ESTreeLiteral<'a, &'a str> {
fn from(lit: &StringLiteral<'a>) -> Self {
Self {
span: lit.span,
value: &lit.value,
value: lit.value.as_str(),
raw: lit.raw.as_ref().map(Atom::as_str),
bigint: None,
regex: None,
}
}
}

impl<'a> From<&'a BigIntLiteral<'a>> for ESTreeLiteral<'a, ()> {
fn from(lit: &'a BigIntLiteral) -> Self {
impl<'a> From<&BigIntLiteral<'a>> for ESTreeLiteral<'a, ()> {
fn from(lit: &BigIntLiteral<'a>) -> Self {
let src = &lit.raw.strip_suffix('n').unwrap().cow_replace('_', "");

let src = match lit.base {
Expand Down Expand Up @@ -111,8 +111,8 @@ pub struct SerRegExpValue {
#[allow(clippy::empty_structs_with_brackets)]
pub struct EmptyObject {}

impl<'a> From<&'a RegExpLiteral<'a>> for ESTreeLiteral<'a, Option<EmptyObject>> {
fn from(lit: &'a RegExpLiteral) -> Self {
impl<'a> From<&RegExpLiteral<'a>> for ESTreeLiteral<'a, Option<EmptyObject>> {
fn from(lit: &RegExpLiteral<'a>) -> Self {
Self {
span: lit.span,
raw: lit.raw.as_ref().map(Atom::as_str),
Expand Down
Loading