Skip to content
Open
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
14 changes: 0 additions & 14 deletions src/bundler/LinkerGraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,20 +1015,6 @@ pub struct File {
pub quoted_source_contents: Option<bun_alloc::AstVec<u8>>,
}

impl Default for File {
fn default() -> Self {
Self {
// Note: empty static-arm bitset; load() overwrites before any read.
entry_bits: AutoBitSet::init_empty(0).expect("static AutoBitSet"),
input_file: Index::source(0u32),
entry_point_kind: EntryPoint::Kind::None,
entry_point_chunk_index: u32::MAX,
line_offset_table: bun_sourcemap::line_offset_table::List::new_in(bun_alloc::AstAlloc),
quoted_source_contents: None,
}
}
}

pub(crate) type FileList = MultiArrayList<File>;

bun_collections::multi_array_columns! {
Expand Down
10 changes: 0 additions & 10 deletions src/bundler/ParseTask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,11 @@ impl bun_event_loop::Taskable for Result {
pub(crate) enum ResultValue {
Success(Success),
Err(ResultError),
Empty { source_index: Index },
}

impl ResultValue {
pub(crate) fn source_index(&self) -> u32 {
match self {
ResultValue::Empty { source_index } => source_index.get(),
ResultValue::Err(data) => data.source_index.get(),
ResultValue::Success(val) => val.source.index.0,
}
Expand Down Expand Up @@ -2841,13 +2839,6 @@ pub mod parse_worker {
break 'value ResultValue::Success(ast);
}
Err(e) => {
if e == crate::Error::EmptyAST {
drop(log);
break 'value ResultValue::Empty {
source_index: this.source_index,
};
}

break 'value ResultValue::Err(ResultError {
err: e,
step,
Expand Down Expand Up @@ -2931,7 +2922,6 @@ pub mod parse_worker {
match &mut result.value {
ResultValue::Success(s) => drop(core::mem::take(&mut s.log)),
ResultValue::Err(e) => drop(core::mem::take(&mut e.log)),
ResultValue::Empty { .. } => {}
}
}

Expand Down
17 changes: 0 additions & 17 deletions src/bundler/bundle_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7630,23 +7630,6 @@ pub mod bv2_impl {
}

match &mut parse_result.value {
parse_task::ResultValue::Empty {
source_index: empty_source_index,
} => {
let empty_idx = (*empty_source_index).get() as usize;
this.graph.input_files.items_side_effects_mut()[empty_idx] =
bun_ast::SideEffects::NoSideEffectsEmptyAst;
if cfg!(debug_assertions) {
bun_core::scoped_log!(
Bundle,
"onParse({}, {}) = empty",
empty_idx,
bstr::BStr::new(
&this.graph.input_files.items_source()[empty_idx].path.text
)
);
}
}
parse_task::ResultValue::Success(result) => {
// SAFETY: `transpiler.log` is a live BACKREF set in BundleV2::init.
result
Expand Down
6 changes: 0 additions & 6 deletions src/bundler/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum Error {
#[error("ModuleNotFound")]
ModuleNotFound,
#[error("BuildFailed")]
BuildFailed,
#[error("CompilationFailed")]
Expand Down Expand Up @@ -30,8 +28,6 @@ pub enum Error {
MinifyError,
#[error("InvalidNativePlugin")]
InvalidNativePlugin,
#[error("EmptyAST")]
EmptyAST,
#[error("FormatError")]
FormatError,
#[error("ResolveMessage")]
Expand Down Expand Up @@ -102,7 +98,6 @@ impl Error {
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn name(&self) -> &'static str {
match self {
Self::ModuleNotFound => "ModuleNotFound",
Self::BuildFailed => "BuildFailed",
Self::CompilationFailed => "CompilationFailed",
Self::Plugin => "Plugin",
Expand All @@ -117,7 +112,6 @@ impl Error {
Self::SyntaxError => "SyntaxError",
Self::MinifyError => "MinifyError",
Self::InvalidNativePlugin => "InvalidNativePlugin",
Self::EmptyAST => "EmptyAST",
Self::FormatError => "FormatError",
Self::ResolveMessage => "ResolveMessage",
Self::Js(bun_core::JsError::OutOfMemory) => "OutOfMemory",
Expand Down
1 change: 0 additions & 1 deletion src/bundler/transpiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,6 @@ impl<'a> Transpiler<'a> {
ignore_dce_annotations: self.options.ignore_dce_annotations,
preserve_unused_imports_ts: false,
use_define_for_class_fields: this_parse.use_define_for_class_fields,
suppress_warnings_about_weird_code: true,
features: js_ast::RuntimeFeatures::default(),
tree_shaking: self.options.tree_shaking,
bundle: false,
Expand Down
10 changes: 0 additions & 10 deletions src/install/PackageManager/PackageJSONEditor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,23 +1035,13 @@ pub(crate) fn edit(

if let Some(value) = query.expr.as_property(name) {
if matches!(value.expr.data, bun_ast::ExprData::EString(_)) {
// `bun update <pkg>` keeps a `catalog:` reference intact.
let keep_catalog_reference = manager.subcommand
== Subcommand::Update
&& value.expr.as_utf8_string_literal().is_some_and(
|version_literal| {
literal_tag(version_literal)
== dependency::Tag::Catalog
},
);
let in_target_list =
strings::eql_long(list, dependency_list, true);

// `bun update <name>` edits the slot in place; the rebuild below re-sorts the keys.
if request.package_id != INVALID_PACKAGE_ID
&& manager.subcommand != Subcommand::Update
&& in_target_list
&& !keep_catalog_reference
{
replacing += 1;
} else if move_to_target && !in_target_list {
Expand Down
1 change: 0 additions & 1 deletion src/js_parser/function_identities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ impl FunctionIdentities {
options.features.no_macros = true;
options.features.top_level_await = kind == Text::Module;
options.jsc_builtin_syntax = kind == Text::Builtin;
options.suppress_warnings_about_weird_code = true;
let define = crate::Define::default();
let mut log = bun_ast::Log::init();
let parser = crate::Parser::init(options, &mut log, &source, &define, &arena).ok()?;
Expand Down
2 changes: 0 additions & 2 deletions src/js_parser/p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ pub struct P<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> {
pub(crate) allow_private_identifiers: bool,

pub(crate) has_top_level_return: bool,
pub(crate) latest_return_had_semicolon: bool,
pub(crate) has_import_meta: bool,
pub(crate) has_es_module_syntax: bool,
pub(crate) top_level_await_keyword: bun_ast::Range,
Expand Down Expand Up @@ -9834,7 +9833,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
// ─── all remaining fields default ───
allow_private_identifiers: false,
has_top_level_return: false,
latest_return_had_semicolon: false,
has_import_meta: false,
has_es_module_syntax: false,
top_level_await_keyword: bun_ast::Range::NONE,
Expand Down
25 changes: 0 additions & 25 deletions src/js_parser/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
let mut opts = *_opts;
let mut stmts = StmtList::new_in(p.arena);

let mut return_without_semicolon_start: i32 = -1;
opts.lexical_decl = LexicalDecl::AllowAll;
let mut is_directive_prologue = true;

Expand Down Expand Up @@ -1541,30 +1540,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
if !skip {
stmts.push(stmt);
}

// Warn about ASI and return statements. Here's an example of code with
// this problem: https://github.com/rollup/rollup/issues/3729
if !p.options.suppress_warnings_about_weird_code {
let mut needs_check = true;
if let js_ast::stmt::Data::SReturn(ret) = &stmt.data {
if ret.value.is_none() && !p.latest_return_had_semicolon {
return_without_semicolon_start = stmt.loc.start;
needs_check = false;
}
}

if needs_check && return_without_semicolon_start != -1 {
if let js_ast::stmt::Data::SExpr(_) = &stmt.data {
p.log().add_warning(
Some(p.source),
bun_ast::Loc { start: return_without_semicolon_start + 6 },
b"The following expression is not returned because of an automatically-inserted semicolon",
);
}

return_without_semicolon_start = -1;
}
}
}

Ok(stmts)
Expand Down
4 changes: 0 additions & 4 deletions src/js_parser/parse/parse_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ pub struct Options<'a> {
pub ignore_dce_annotations: bool,
pub preserve_unused_imports_ts: bool,
pub use_define_for_class_fields: bool,
pub suppress_warnings_about_weird_code: bool,
pub features: RuntimeFeatures,

pub tree_shaking: bool,
Expand Down Expand Up @@ -172,7 +171,6 @@ impl<'a> Default for Options<'a> {
ignore_dce_annotations: false,
preserve_unused_imports_ts: false,
use_define_for_class_fields: true,
suppress_warnings_about_weird_code: true,
features: RuntimeFeatures::default(),
tree_shaking: false,
bundle: false,
Expand Down Expand Up @@ -223,7 +221,6 @@ impl<'a> Options<'a> {
ignore_dce_annotations: self.ignore_dce_annotations,
preserve_unused_imports_ts: self.preserve_unused_imports_ts,
use_define_for_class_fields: self.use_define_for_class_fields,
suppress_warnings_about_weird_code: self.suppress_warnings_about_weird_code,
features: RuntimeFeatures {
react_fast_refresh: f.react_fast_refresh,
react_compiler: f.react_compiler,
Expand Down Expand Up @@ -330,7 +327,6 @@ impl<'a> Options<'a> {
ignore_dce_annotations: false,
preserve_unused_imports_ts: false,
use_define_for_class_fields: true,
suppress_warnings_about_weird_code: true,
features: RuntimeFeatures::default(),
tree_shaking: false,
bundle: false,
Expand Down
1 change: 0 additions & 1 deletion src/js_parser/parse/parse_stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
{
value = Some(p.parse_expr(Level::Lowest)?);
}
p.latest_return_had_semicolon = p.lexer.token == T::TSemicolon;
p.lexer.expect_or_insert_semicolon()?;

Ok(p.s(S::Return { value }, loc))
Expand Down
18 changes: 0 additions & 18 deletions src/js_parser/parse/parse_suffix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,14 +1392,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
return Ok(Continuation::Done);
}

// Warn about "!a in b" instead of "!(a in b)"
if let ExprData::EUnary(unary) = &left.data {
if unary.op == OpCode::UnNot {
// TODO:
// p.log.addRangeWarning(source: ?Source, r: Range, text: string)
}
}

p.lexer.next()?;
let loc = left.loc;
let prev = *left;
Expand All @@ -1420,16 +1412,6 @@ impl<'a, const TYPESCRIPT: bool, const SCAN_ONLY: bool> P<'a, TYPESCRIPT, SCAN_O
return Ok(Continuation::Done);
}

// Warn about "!a instanceof b" instead of "!(a instanceof b)". Here's an
// example of code with this problem: https://github.com/mrdoob/three.js/pull/11182.
if !p.options.suppress_warnings_about_weird_code {
if let ExprData::EUnary(unary) = &left.data {
if unary.op == OpCode::UnNot {
// TODO:
// p.log.addRangeWarning(source: ?Source, r: Range, text: string)
}
}
}
p.lexer.next()?;
let loc = left.loc;
let prev = *left;
Expand Down
Loading
Loading