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_estree/src/serialize/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub trait Config {

fn new(ranges: bool) -> Self;

/// Whether to include range information in the serialized output
/// Get whether output should contain `range` fields.
fn ranges(&self) -> bool;
}

Expand Down
2 changes: 2 additions & 0 deletions crates/oxc_estree/src/serialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub trait Serializer: SerializerPrivate {
/// Type of sequence serializer this serializer uses.
type SequenceSerializer: SequenceSerializer;

/// Get whether output should contain `range` fields.
fn ranges(&self) -> bool;

/// Serialize struct.
Expand Down Expand Up @@ -180,6 +181,7 @@ impl<'s, C: Config, F: Formatter> Serializer for &'s mut ESTreeSerializer<C, F>
type StructSerializer = ESTreeStructSerializer<'s, C, F>;
type SequenceSerializer = ESTreeSequenceSerializer<'s, C, F>;

/// Get whether output should contain `range` fields.
#[inline(always)]
fn ranges(&self) -> bool {
self.config.ranges()
Expand Down
5 changes: 4 additions & 1 deletion crates/oxc_estree/src/serialize/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait StructSerializer {
/// Finish serializing struct.
fn end(self);

/// Whether to include range information in the serialized output
/// Get whether output should contain `range` fields.
fn ranges(&self) -> bool;
}

Expand Down Expand Up @@ -150,6 +150,7 @@ impl<C: Config, F: Formatter> StructSerializer for ESTreeStructSerializer<'_, C,
buffer.print_ascii_byte(b'}');
}

/// Get whether output should contain `range` fields.
#[inline(always)]
fn ranges(&self) -> bool {
self.serializer.ranges()
Expand Down Expand Up @@ -224,6 +225,7 @@ impl<'p, P: StructSerializer> Serializer for FlatStructSerializer<'p, P> {
}
}

/// Get whether output should contain `range` fields.
#[inline(always)]
fn ranges(&self) -> bool {
self.0.ranges()
Expand Down Expand Up @@ -294,6 +296,7 @@ impl<P: StructSerializer> StructSerializer for FlatStructSerializer<'_, P> {
// No-op - there may be more fields to be added to the struct in the parent
}

/// Get whether output should contain `range` fields.
#[inline(always)]
fn ranges(&self) -> bool {
self.0.ranges()
Expand Down
Loading