Skip to content

Commit

Permalink
refactor(codegen): rename vars in CodeBuffer methods (#6506)
Browse files Browse the repository at this point in the history
Pure refactor. Consistently use `byte` for bytes, and `ch` for `char`s.
  • Loading branch information
overlookmotel committed Oct 13, 2024
1 parent c8fa2eb commit cd9fe9e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/oxc_codegen/src/code_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl CodeBuffer {
/// Push a single ASCII byte into the buffer.
///
/// # Panics
/// If `b` is not an ASCII byte (`0 - 0x7F`).
/// If `byte` is not an ASCII byte (`0 - 0x7F`).
///
/// # Example
/// ```
Expand All @@ -153,12 +153,12 @@ impl CodeBuffer {
/// assert_eq!(source, "foo");
/// ```
#[inline]
pub fn print_ascii_byte(&mut self, b: u8) {
pub fn print_ascii_byte(&mut self, byte: u8) {
// NOTE: since this method is inlined, this assertion should get
// optimized away by the compiler when the value of `b` is known,
// optimized away by the compiler when the value of `byte` is known,
// e.g. when printing a constant.
assert!(b.is_ascii(), "byte {b} is not ASCII");
self.buf.push(b);
assert!(byte.is_ascii(), "byte {byte} is not ASCII");
self.buf.push(byte);
}

/// Push a byte to the buffer, without checking that the buffer still represents a valid
Expand Down Expand Up @@ -201,8 +201,8 @@ impl CodeBuffer {
/// [`take_source_text`]: CodeBuffer::take_source_text
/// [`print_unchecked`]: CodeBuffer::print_unchecked
#[inline]
pub unsafe fn print_byte_unchecked(&mut self, ch: u8) {
self.buf.push(ch);
pub unsafe fn print_byte_unchecked(&mut self, byte: u8) {
self.buf.push(byte);
}

/// Push a single Unicode character into the buffer.
Expand Down

0 comments on commit cd9fe9e

Please sign in to comment.