docs(ast/estree): document ranges methods (#12011)

This commit is contained in:
overlookmotel committed 2025-07-01 16:51:43 +00:00
1 parent 8f830672f0
commit c71529fea0
3 files changed
+7 -2

No files matched your search

+1 -1
View File
@@ -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;
}
+2
View File
@@ -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.
@@ -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()
+4 -1
View File
@@ -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;
}
@@ -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()
@@ -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()
@@ -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()