Skip to content

Commit c71529f

Browse files
committed
docs(ast/estree): document ranges methods (#12011)
1 parent 8f83067 commit c71529f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

crates/oxc_estree/src/serialize/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub trait Config {
77

88
fn new(ranges: bool) -> Self;
99

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

crates/oxc_estree/src/serialize/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub trait Serializer: SerializerPrivate {
4444
/// Type of sequence serializer this serializer uses.
4545
type SequenceSerializer: SequenceSerializer;
4646

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

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

184+
/// Get whether output should contain `range` fields.
183185
#[inline(always)]
184186
fn ranges(&self) -> bool {
185187
self.config.ranges()

crates/oxc_estree/src/serialize/structs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub trait StructSerializer {
4040
/// Finish serializing struct.
4141
fn end(self);
4242

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

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

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

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

299+
/// Get whether output should contain `range` fields.
297300
#[inline(always)]
298301
fn ranges(&self) -> bool {
299302
self.0.ranges()

0 commit comments

Comments
 (0)