Skip to content

Commit ac1e861

Browse files
feat(unstable): align lint ast with TSEStree
1 parent 15cfa05 commit ac1e861

File tree

5 files changed

+2158
-964
lines changed

5 files changed

+2158
-964
lines changed

cli/tools/lint/ast_buffer/buffer.rs

+16
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,22 @@ impl SerializeCtx {
485485
};
486486
}
487487

488+
/// Helper for writing optional node offsets with undefined as empty value
489+
pub fn write_maybe_undef_ref<P>(
490+
&mut self,
491+
prop: P,
492+
parent: &PendingRef,
493+
value: Option<NodeRef>,
494+
) where
495+
P: Into<u8> + Display + Clone,
496+
{
497+
if let Some(v) = value {
498+
self.write_ref(prop, parent, v);
499+
} else {
500+
self.write_undefined(prop);
501+
};
502+
}
503+
488504
/// Write a vec of node offsets into the property. The necessary space
489505
/// has been reserved earlier.
490506
pub fn write_ref_vec<P>(

0 commit comments

Comments
 (0)