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 src/ast/e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ pub struct Yield {
}

pub struct If {
pub test_: ExprNodeIndex,
pub test: ExprNodeIndex,
pub yes: ExprNodeIndex,
pub no: ExprNodeIndex,
}
Expand Down
2 changes: 1 addition & 1 deletion src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ impl Data {
}
Data::EIf(el) => {
let item = bump.alloc(E::If {
test_: el.test_.deep_clone_no_detach(bump)?,
test: el.test.deep_clone_no_detach(bump)?,
yes: el.yes.deep_clone_no_detach(bump)?,
no: el.no.deep_clone_no_detach(bump)?,
});
Expand Down
12 changes: 6 additions & 6 deletions src/ast/s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ pub struct Class {
}

pub struct If {
pub test_: ExprNodeIndex,
pub test: ExprNodeIndex,
pub yes: StmtNodeIndex,
pub no: Option<StmtNodeIndex>,
}

pub struct For {
/// May be a SConst, SLet, SVar, or SExpr
pub init: Option<StmtNodeIndex>, // = None
pub test_: Option<ExprNodeIndex>, // = None
pub test: Option<ExprNodeIndex>, // = None
pub update: Option<ExprNodeIndex>, // = None
pub body: StmtNodeIndex,
}
Expand All @@ -156,11 +156,11 @@ pub struct ForOf {

pub struct DoWhile {
pub body: StmtNodeIndex,
pub test_: ExprNodeIndex,
pub test: ExprNodeIndex,
}

pub struct While {
pub test_: ExprNodeIndex,
pub test: ExprNodeIndex,
pub body: StmtNodeIndex,
}

Expand All @@ -174,12 +174,12 @@ pub struct Try {
pub body_loc: crate::Loc,
pub body: StmtNodeList,

pub catch_: Option<Catch>, // = None
pub catch: Option<Catch>, // = None
pub finally: Option<Finally>, // = None
}

pub struct Switch {
pub test_: ExprNodeIndex,
pub test: ExprNodeIndex,
pub body_loc: crate::Loc,
pub cases: StoreSlice<Case>, // arena-owned
}
Expand Down
38 changes: 19 additions & 19 deletions src/bunfig/bunfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,34 +411,34 @@ impl<'a> Parser<'a> {
}

if cmd == CommandTag::TestCommand {
if let Some(test_) = json.get(b"test") {
if let Some(root) = test_.get(b"root") {
if let Some(test) = json.get(b"test") {
if let Some(root) = test.get(b"root") {
self.ctx.debug.test_directory = root.as_string(self.bump).unwrap_or(b"").into();
}

if let Some(expr) = test_.get(b"preload") {
if let Some(expr) = test.get(b"preload") {
self.load_preload(&expr)?;
}

if let Some(expr) = test_.get(b"smol") {
if let Some(expr) = test.get(b"smol") {
self.expect(&expr, ExprTag::EBoolean)?;
self.ctx.runtime_options.smol =
expr.as_bool().expect("infallible: type checked");
}

if let Some(expr) = test_.get(b"coverage") {
if let Some(expr) = test.get(b"coverage") {
self.expect(&expr, ExprTag::EBoolean)?;
self.ctx.test_options.coverage.enabled =
expr.as_bool().expect("infallible: type checked");
}

if let Some(expr) = test_.get(b"onlyFailures") {
if let Some(expr) = test.get(b"onlyFailures") {
self.expect(&expr, ExprTag::EBoolean)?;
self.ctx.test_options.reporters.only_failures =
expr.as_bool().expect("infallible: type checked");
}

if let Some(expr) = test_.get(b"reporter") {
if let Some(expr) = test.get(b"reporter") {
self.expect(&expr, ExprTag::EObject)?;
if let Some(junit_expr) = expr.get(b"junit") {
self.expect_string(&junit_expr)?;
Expand All @@ -457,7 +457,7 @@ impl<'a> Parser<'a> {
}
}

if let Some(expr) = test_.get(b"coverageReporter") {
if let Some(expr) = test.get(b"coverageReporter") {
'brk: {
self.ctx.test_options.coverage.reporters = CoverageReporters {
text: false,
Expand All @@ -478,7 +478,7 @@ impl<'a> Parser<'a> {
}
}

if let Some(expr) = test_.get(b"coverageDir") {
if let Some(expr) = test.get(b"coverageDir") {
self.expect_string(&expr)?;
self.ctx.test_options.coverage.reports_directory = estring_to_owned(
expr.data
Expand All @@ -489,7 +489,7 @@ impl<'a> Parser<'a> {
);
}

if let Some(expr) = test_.get(b"coverageThreshold") {
if let Some(expr) = test.get(b"coverageThreshold") {
'outer: {
if let ExprData::ENumber(n) = expr.data {
let v = n.value();
Expand Down Expand Up @@ -523,28 +523,28 @@ impl<'a> Parser<'a> {
}

// This mostly exists for debugging.
if let Some(expr) = test_.get(b"coverageIgnoreSourcemaps") {
if let Some(expr) = test.get(b"coverageIgnoreSourcemaps") {
self.expect(&expr, ExprTag::EBoolean)?;
self.ctx.test_options.coverage.ignore_sourcemap =
expr.as_bool().expect("infallible: type checked");
}

if let Some(expr) = test_.get(b"coverageSkipTestFiles") {
if let Some(expr) = test.get(b"coverageSkipTestFiles") {
self.expect(&expr, ExprTag::EBoolean)?;
self.ctx.test_options.coverage.skip_test_files =
expr.as_bool().expect("infallible: type checked");
}

let mut randomize_from_config: Option<bool> = None;

if let Some(expr) = test_.get(b"randomize") {
if let Some(expr) = test.get(b"randomize") {
self.expect(&expr, ExprTag::EBoolean)?;
randomize_from_config = expr.as_bool();
self.ctx.test_options.randomize =
expr.as_bool().expect("infallible: type checked");
}

if let Some(expr) = test_.get(b"seed") {
if let Some(expr) = test.get(b"seed") {
self.expect(&expr, ExprTag::ENumber)?;
let seed_value =
num_to_u32(expr.as_number().expect("infallible: type checked"));
Expand All @@ -562,7 +562,7 @@ impl<'a> Parser<'a> {
self.ctx.test_options.seed = Some(seed_value);
}

if let Some(expr) = test_.get(b"rerunEach") {
if let Some(expr) = test.get(b"rerunEach") {
self.expect(&expr, ExprTag::ENumber)?;
if self.ctx.test_options.retry != 0 {
self.add_error(expr.loc, b"\"rerunEach\" cannot be used with \"retry\"")?;
Expand All @@ -572,7 +572,7 @@ impl<'a> Parser<'a> {
num_to_u32(expr.as_number().expect("infallible: type checked"));
}

if let Some(expr) = test_.get(b"retry") {
if let Some(expr) = test.get(b"retry") {
self.expect(&expr, ExprTag::ENumber)?;
if self.ctx.test_options.repeat_count != 0 {
self.add_error(expr.loc, b"\"retry\" cannot be used with \"rerunEach\"")?;
Expand All @@ -582,7 +582,7 @@ impl<'a> Parser<'a> {
num_to_u32(expr.as_number().expect("infallible: type checked"));
}

if let Some(expr) = test_.get(b"concurrentTestGlob") {
if let Some(expr) = test.get(b"concurrentTestGlob") {
match &expr.data {
ExprData::EString(s) => {
if s.len() == 0 {
Expand Down Expand Up @@ -634,7 +634,7 @@ impl<'a> Parser<'a> {
}
}

if let Some(expr) = test_.get(b"coveragePathIgnorePatterns") {
if let Some(expr) = test.get(b"coveragePathIgnorePatterns") {
'brk: {
match &expr.data {
ExprData::EString(s) => {
Expand Down Expand Up @@ -670,7 +670,7 @@ impl<'a> Parser<'a> {
}
}

if let Some(expr) = test_.get(b"pathIgnorePatterns") {
if let Some(expr) = test.get(b"pathIgnorePatterns") {
'brk: {
// Only skip if --path-ignore-patterns was explicitly passed via CLI
if self.ctx.test_options.path_ignore_patterns_from_cli {
Expand Down
4 changes: 2 additions & 2 deletions src/css/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ impl VendorPrefix {
/// Returns VendorPrefix::None if empty.
#[inline]
pub fn or_none(self) -> VendorPrefix {
self.or_(VendorPrefix::NONE)
self.or(VendorPrefix::NONE)
}

/// **WARNING**: NOT THE SAME as bitwise-or!!
#[inline]
pub fn or_(self, other: VendorPrefix) -> VendorPrefix {
pub fn or(self, other: VendorPrefix) -> VendorPrefix {
if self.is_empty() { other } else { self }
}

Expand Down
2 changes: 1 addition & 1 deletion src/css/selectors/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ pub mod serialize {
dest.write_str(b":not(")?;
}
Component::Any { vendor_prefix, .. } => {
let vp = dest.vendor_prefix.or_(*vendor_prefix);
let vp = dest.vendor_prefix.or(*vendor_prefix);
if vp.contains(VendorPrefix::WEBKIT) || vp.contains(VendorPrefix::MOZ) {
dest.write_char(b':')?;
vp.to_css(dest)?;
Expand Down
6 changes: 3 additions & 3 deletions src/dotenv/env_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ impl<'a> Parser<'a> {
Ok(Some(self.value_buffer.as_slice()))
}

fn _parse<const OVERRIDE: bool, const IS_PROCESS: bool, const EXPAND: bool>(
fn parse<const OVERRIDE: bool, const IS_PROCESS: bool, const EXPAND: bool>(
&mut self,
map: &mut Map,
) -> Result<(), AllocError> {
Expand Down Expand Up @@ -1236,7 +1236,7 @@ impl<'a> Parser<'a> {
if !IS_PROCESS && EXPAND {
// borrowck — index-based iteration: clone the value bytes, run
// expansion against an immutable `&Map`, then write back via
// `values_mut()`. Values are dupe'd by `_parse` above, so length
// `values_mut()`. Values are dupe'd by `parse` above, so length
// is bounded by file size.
let total = map.map.count();
let mut idx = count;
Expand Down Expand Up @@ -1272,7 +1272,7 @@ impl<'a> Parser<'a> {
src: strings::without_utf8_bom(src),
value_buffer,
};
parser._parse::<OVERRIDE, IS_PROCESS, EXPAND>(map)
parser.parse::<OVERRIDE, IS_PROCESS, EXPAND>(map)
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/event_loop/MiniEventLoop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct MiniEventLoop {
// Raw pointer because the loop is C-owned
// (created by `uws_get_loop`/`us_create_loop`) and outlives this struct.
pub loop_: *mut UwsLoop,
pub file_polls_: Option<Box<FilePollStore>>,
pub file_polls: Option<Box<FilePollStore>>,
/// Mutable; callers (shell spawn,
/// `createNullDelimitedEnvMap`) write through it. Stored as `NonNull`
/// (BACKREF) so [`EventLoopHandle::env`] can hand out a `*mut` with
Expand Down Expand Up @@ -239,14 +239,14 @@ impl MiniEventLoop {
///
/// # Safety
/// `this` must point to a live `MiniEventLoop`. Caller must not hold a
/// live `&mut` to `file_polls_` itself across this call. (Not eligible for
/// live `&mut` to `file_polls` itself across this call. (Not eligible for
/// `unsafe-fn-narrow`: every unsafe op below derefs the caller-supplied
/// `this`; the body cannot discharge that precondition.)
pub unsafe fn file_polls_raw(this: *mut Self) -> *mut FilePollStore {
// SAFETY: caller guarantees `this` points to a live `MiniEventLoop` (see fn `# Safety`);
// `addr_of_mut!` projects to `file_polls_` without forming `&mut Self`.
// `addr_of_mut!` projects to `file_polls` without forming `&mut Self`.
unsafe {
let slot = core::ptr::addr_of_mut!((*this).file_polls_);
let slot = core::ptr::addr_of_mut!((*this).file_polls);
if (*slot).is_none() {
slot.write(Some(Box::new(FilePollStore::init())));
}
Expand All @@ -264,7 +264,7 @@ impl MiniEventLoop {
tasks: Queue::init(),
concurrent_tasks: ConcurrentTaskQueue::default(),
loop_: UwsLoop::get(),
file_polls_: None,
file_polls: None,
env: None,
top_level_dir: Box::default(),
after_event_loop_callback_ctx: None,
Expand Down
6 changes: 3 additions & 3 deletions src/install/PackageManager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ bun_output::declare_scope!(PackageManager, hidden);
// ──────────────────────────────────────────────────────────────────────────

pub struct PackageManager {
pub cache_directory_: Option<bun_sys::Dir>,
pub cache_directory: Option<bun_sys::Dir>,
pub cache_directory_path: ZBox, // owned; process lifetime via the leaked singleton
pub root_dir: &'static mut fs::DirEntry,
// allocator dropped per §Allocators (was `bun.default_allocator`). For the
Expand Down Expand Up @@ -1855,7 +1855,7 @@ pub fn init(
(*p).preallocated_resolve_tasks
));

wr!(cache_directory_, None);
wr!(cache_directory, None);
wr!(cache_directory_path, ZBox::from_bytes(b""));
wr!(options, options);
wr!(
Expand Down Expand Up @@ -2281,7 +2281,7 @@ pub(crate) fn init_with_runtime_once(
(*p).preallocated_resolve_tasks
));

wr!(cache_directory_, None);
wr!(cache_directory, None);
wr!(cache_directory_path, ZBox::from_bytes(b""));
wr!(
options,
Expand Down
12 changes: 6 additions & 6 deletions src/install/PackageManager/PackageManagerDirectories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use super::{Command, Options, PackageManager, ProgressStrings, Subcommand};

impl PackageManager {
/// Borrowed view of the cached cache-directory fd. Returns `Fd` (not `Dir`)
/// because the descriptor is owned by `self.cache_directory_` — handing out
/// because the descriptor is owned by `self.cache_directory` — handing out
/// an owning `Dir` would close the cached fd when the caller drops it.
/// Callers that need `Dir` methods should use `Dir::borrow(&fd)`.
#[inline]
Expand Down Expand Up @@ -68,7 +68,7 @@ impl PackageManager {
// ───────────────────────────── cache directory ────────────────────────────────

/// Returns a borrowed view (`Fd`) of the lazily-opened cache directory. The
/// descriptor is owned by `PackageManager::cache_directory_` (closed only if
/// descriptor is owned by `PackageManager::cache_directory` (closed only if
/// the singleton is ever dropped). Callers must not close the returned `Fd`;
/// use `Dir::borrow(&fd)` to call `&self` `Dir` methods on it.
#[inline]
Expand All @@ -81,7 +81,7 @@ pub fn get_cache_directory(this: &mut PackageManager) -> Fd {
/// Raw-pointer entry for callers that hold a disjoint `&mut this.manifests`
/// borrow (see `PackageManifestMap::by_name_hash_allow_expired`). Never
/// materializes a `&mut PackageManager` covering the whole struct — only the
/// disjoint `cache_directory_`, `cache_directory_path`, `options.enable`, and
/// disjoint `cache_directory`, `cache_directory_path`, `options.enable`, and
/// `env` fields are projected, so an outstanding `&mut manifests` derived
/// from the same provenance root stays valid under Stacked Borrows.
///
Expand All @@ -90,17 +90,17 @@ pub fn get_cache_directory(this: &mut PackageManager) -> Fd {
/// caller must hold no live borrow that overlaps the fields listed above.
#[inline]
pub unsafe fn get_cache_directory_raw(this: *mut PackageManager) -> Fd {
// SAFETY: caller contract — `cache_directory_` is disjoint from any
// SAFETY: caller contract — `cache_directory` is disjoint from any
// borrow the caller holds.
if let Some(d) = unsafe { (*this).cache_directory_.as_ref() } {
if let Some(d) = unsafe { (*this).cache_directory.as_ref() } {
return d.fd();
}
// SAFETY: caller contract — `this` is valid and no live borrow overlaps
// `options.enable`/`options.cache_directory`/`env`/`cache_directory_path`.
let d = unsafe { ensure_cache_directory(this) };
let fd = d.fd();
// SAFETY: as above; single writer.
unsafe { (*this).cache_directory_ = Some(d) };
unsafe { (*this).cache_directory = Some(d) };
fd
}

Expand Down
2 changes: 1 addition & 1 deletion src/install/PackageManagerTask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl<'a> Task<'a> {
manifest.name.slice(),
loaded_manifest,
// SAFETY: see `manager` decl — short-lived `&mut` at call
// boundary only (callee touches `cache_directory_` /
// boundary only (callee touches `cache_directory` /
// `temporary_directory` lazily).
unsafe { &mut *manager },
is_extended_manifest,
Expand Down
Loading
Loading