Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ pub struct FunctionBody<'a> {
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
#[estree(
add_fields(generator = false, id = ()),
add_fields(generator = false, id = crate::serialize::NULL),
add_ts = "generator: false; id: null"
)]
pub struct ArrowFunctionExpression<'a> {
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_ast/src/ast/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct BooleanLiteral {
#[estree(
rename = "Literal",
add_fields(
value = (),
value = crate::serialize::NULL,
raw = crate::serialize::null_literal_raw(self),
),
add_ts = "value: null, raw: \"null\" | null",
Expand Down Expand Up @@ -103,7 +103,7 @@ pub struct StringLiteral<'a> {
#[estree(
rename = "Literal",
add_fields(
value = (),
value = crate::serialize::NULL,
bigint = crate::serialize::bigint_literal_bigint(self),
),
add_ts = "value: null, bigint: string",
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_ast/src/generated/derive_estree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ impl Serialize for ArrowFunctionExpression<'_> {
map.serialize_entry("returnType", &self.return_type)?;
map.serialize_entry("body", &self.body)?;
map.serialize_entry("generator", &false)?;
map.serialize_entry("id", &())?;
map.serialize_entry("id", &crate::serialize::NULL)?;
map.end()
}
}
Expand Down Expand Up @@ -1910,7 +1910,7 @@ impl Serialize for NullLiteral {
map.serialize_entry("type", "Literal")?;
map.serialize_entry("start", &self.span.start)?;
map.serialize_entry("end", &self.span.end)?;
map.serialize_entry("value", &())?;
map.serialize_entry("value", &crate::serialize::NULL)?;
map.serialize_entry("raw", &crate::serialize::null_literal_raw(self))?;
map.end()
}
Expand Down Expand Up @@ -1947,7 +1947,7 @@ impl Serialize for BigIntLiteral<'_> {
map.serialize_entry("start", &self.span.start)?;
map.serialize_entry("end", &self.span.end)?;
map.serialize_entry("raw", &self.raw)?;
map.serialize_entry("value", &())?;
map.serialize_entry("value", &crate::serialize::NULL)?;
map.serialize_entry("bigint", &crate::serialize::bigint_literal_bigint(self))?;
map.end()
}
Expand Down
3 changes: 3 additions & 0 deletions crates/oxc_ast/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ use oxc_syntax::number::BigintBase;

use crate::ast::*;

/// Constant value that will be serialized as `null` in JSON.
pub(crate) const NULL: () = ();

// --------------------
// Literals
// --------------------
Expand Down
Loading