Skip to content

Commit

Permalink
Remove HIR (#917)
Browse files Browse the repository at this point in the history
closes #273
closes #814

HIR is removed from this PR, with the minifier being commented out.

HIR is a wonderful idea for compiling to lower languages, but after
sitting on it for a few months I found that it only adds confusion and
uncertainties to both myself and future contributors.

It also adds too much burden to maintainers if we plan to support more
downstream tools.

1 AST is the only way.
  • Loading branch information
Boshen authored Sep 15, 2023
1 parent 38bbc96 commit ceeee59
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 8,484 deletions.
2 changes: 0 additions & 2 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ ignore:
- "crates/oxc_ast/src/visit_mut.rs"
- "crates/oxc_ast/src/ast_kind.rs"
- "crates/oxc_ast/src/span.rs"
- "crates/oxc_hir/src/hir_kind.rs"
- "crates/oxc_hir/src/span.rs"
- "crates/oxc_wasm" # Remove this once wasm is completed
- "crates/oxc_napi"
- "crates/oxc_parser/fuzz"
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
A-ast:
- any: ['crates/oxc_ast/**/*', 'crates/oxc_ast_lower/**/*']
- any: ['crates/oxc_ast/**/*']

A-cli:
- any: ['crates/oxc_cli/**/*', 'npm/**/*']
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- run: cargo coverage

- run: cargo minsize
# - run: cargo minsize

- name: Check for snapshot diff
run: git diff --exit-code
150 changes: 0 additions & 150 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
resolver = "2"
members = ["crates/*", "tasks/*", "editor/vscode/server"]
exclude = ["crates/oxc_minifier", "tasks/minsize"]

[workspace.package]
authors = ["Boshen <boshenc@gmail.com>", "Oxc contributors"]
Expand All @@ -18,12 +19,10 @@ rust-version = "1.60"
oxc = { version = "0.2.0", path = "crates/oxc" }
oxc_allocator = { version = "0.2.0", path = "crates/oxc_allocator" }
oxc_ast = { version = "0.2.0", path = "crates/oxc_ast" }
oxc_ast_lower = { version = "0.2.0", path = "crates/oxc_ast_lower" }
oxc_diagnostics = { version = "0.2.0", path = "crates/oxc_diagnostics" }
oxc_formatter = { version = "0.2.0", path = "crates/oxc_formatter" }
oxc_hir = { version = "0.2.0", path = "crates/oxc_hir" }
oxc_index = { version = "0.2.0", path = "crates/oxc_index" }
oxc_minifier = { version = "0.2.0", path = "crates/oxc_minifier" }
# oxc_minifier = { version = "0.2.0", path = "crates/oxc_minifier" }
oxc_parser = { version = "0.2.0", path = "crates/oxc_parser" }
oxc_semantic = { version = "0.2.0", path = "crates/oxc_semantic" }
oxc_span = { version = "0.2.0", path = "crates/oxc_span" }
Expand Down
4 changes: 0 additions & 4 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ sed -i '' 's/0.1.3/0.2.0/' Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_allocator/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_ast/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_ast_lower/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_diagnostics/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_formatter/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_hir/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_index/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_minifier/Cargo.toml
sed -i '' 's/0.1.3/0.2.0/' crates/oxc_parser/Cargo.toml
Expand All @@ -37,8 +35,6 @@ cargo publish -p oxc_diagnostics
cargo publish -p oxc_parser
cargo publish -p oxc_semantic
cargo publish -p oxc_formatter
cargo publish -p oxc_hir
cargo publish -p oxc_ast_lower
cargo publish -p oxc_minifier
cargo publish -p oxc
```
6 changes: 2 additions & 4 deletions crates/oxc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ oxc_span = { workspace = true }
oxc_syntax = { workspace = true }
oxc_semantic = { workspace = true, optional = true }
oxc_formatter = { workspace = true, optional = true }
oxc_ast_lower = { workspace = true, optional = true }
oxc_hir = { workspace = true, optional = true }
oxc_minifier = { workspace = true, optional = true }
# oxc_minifier = { workspace = true, optional = true }

[features]
formatter = ["oxc_formatter"]
semantic = ["oxc_semantic"]
minifier = ["oxc_hir", "oxc_ast_lower", "oxc_minifier"]
# minifier = ["oxc_minifier"]
22 changes: 5 additions & 17 deletions crates/oxc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ pub mod ast {
pub use oxc_ast::*;
}

#[cfg(feature = "minifier")]
pub mod ast_lower {
#[doc(inline)]
pub use oxc_ast_lower::*;
}

pub mod diagnostics {
#[doc(inline)]
pub use oxc_diagnostics::*;
Expand All @@ -29,22 +23,16 @@ pub mod formatter {
pub use oxc_formatter::*;
}

#[cfg(feature = "minifier")]
pub mod hir {
#[doc(inline)]
pub use oxc_hir::*;
}

pub mod index {
#[doc(inline)]
pub use oxc_index::*;
}

#[cfg(feature = "minifier")]
pub mod minifier {
#[doc(inline)]
pub use oxc_minifier::*;
}
// #[cfg(feature = "minifier")]
// pub mod minifier {
// #[doc(inline)]
// pub use oxc_minifier::*;
// }

pub mod parser {
#[doc(inline)]
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod serialize;
pub mod ast;
mod ast_builder;
mod ast_kind;
pub mod precedence;
mod span;
pub mod syntax_directed_operations;
mod trivia;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use oxc_syntax::{
precedence::{GetPrecedence, Precedence},
};

use crate::hir::{
use crate::ast::{
ArrowExpression, AssignmentExpression, AwaitExpression, BinaryExpression, CallExpression,
ConditionalExpression, Expression, LogicalExpression, MemberExpression, NewExpression,
SequenceExpression, UnaryExpression, UpdateExpression, YieldExpression,
Expand Down
Loading

0 comments on commit ceeee59

Please sign in to comment.