Skip to content

Commit

Permalink
ci(transformer): move post-transform checker to tasks crate (#6288)
Browse files Browse the repository at this point in the history
Move post-transform checker into a `tasks` crate. It doesn't feel like it belongs in `oxc_semantic`. It also feels like too heavy a lump of code to put in `tasks/common`.
  • Loading branch information
overlookmotel committed Oct 5, 2024
1 parent d4f2ee9 commit e19deaa
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 10 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ oxc_linter = { path = "crates/oxc_linter" }
oxc_macros = { path = "crates/oxc_macros" }
oxc_prettier = { path = "crates/oxc_prettier" }
oxc_tasks_common = { path = "tasks/common" }
oxc_tasks_transform_checker = { path = "tasks/transform_checker" }

napi = "3.0.0-alpha"
napi-build = "2.1.3"
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_semantic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub use oxc_syntax::{
};

pub mod dot;
pub mod post_transform_checker;

mod binder;
mod builder;
Expand Down
1 change: 1 addition & 0 deletions tasks/coverage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ doctest = false
oxc = { workspace = true, features = ["full", "isolated_declarations", "serialize", "sourcemap"] }
oxc_prettier = { workspace = true }
oxc_tasks_common = { workspace = true }
oxc_tasks_transform_checker = { workspace = true }

console = { workspace = true }
encoding_rs = { workspace = true }
Expand Down
9 changes: 4 additions & 5 deletions tasks/coverage/src/driver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::{ops::ControlFlow, path::PathBuf};

use rustc_hash::FxHashSet;

use oxc::{
allocator::Allocator,
ast::{ast::Program, Trivias},
Expand All @@ -8,15 +10,12 @@ use oxc::{
minifier::CompressOptions,
parser::{ParseOptions, ParserReturn},
regular_expression::{Parser, ParserOptions},
semantic::{
post_transform_checker::{check_semantic_after_transform, check_semantic_ids},
Semantic, SemanticBuilderReturn,
},
semantic::{Semantic, SemanticBuilderReturn},
span::{SourceType, Span},
transformer::{TransformOptions, TransformerReturn},
CompilerInterface,
};
use rustc_hash::FxHashSet;
use oxc_tasks_transform_checker::{check_semantic_after_transform, check_semantic_ids};

use crate::suite::TestResult;

Expand Down
24 changes: 24 additions & 0 deletions tasks/transform_checker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "oxc_tasks_transform_checker"
version = "0.0.0"
edition.workspace = true
license.workspace = true
publish = false

[lints]
workspace = true

[lib]
test = false
doctest = false

[dependencies]
oxc_allocator = { workspace = true }
oxc_ast = { workspace = true }
oxc_diagnostics = { workspace = true }
oxc_semantic = { workspace = true }
oxc_span = { workspace = true }
oxc_syntax = { workspace = true }

indexmap = { workspace = true }
rustc-hash = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,17 @@ use indexmap::IndexMap;
use rustc_hash::FxHasher;

use oxc_allocator::{Allocator, CloneIn};
#[allow(clippy::wildcard_imports)]
#[allow(clippy::wildcard_imports, clippy::allow_attributes)]
use oxc_ast::{ast::*, visit::walk, Visit};
use oxc_diagnostics::OxcDiagnostic;
use oxc_semantic::{ScopeTree, SemanticBuilder, SymbolTable};
use oxc_span::CompactStr;
use oxc_syntax::{
reference::ReferenceId,
scope::{ScopeFlags, ScopeId},
symbol::SymbolId,
};

use crate::{ScopeTree, SemanticBuilder, SymbolTable};

type FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;

/// Check `ScopeTree` and `SymbolTable` are correct after transform
Expand Down
1 change: 1 addition & 0 deletions tasks/transform_conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ doctest = false
[dependencies]
oxc = { workspace = true, features = ["full"] }
oxc_tasks_common = { workspace = true }
oxc_tasks_transform_checker = { workspace = true }

cow-utils = { workspace = true }
indexmap = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion tasks/transform_conformance/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use oxc::{
codegen::{CodeGenerator, CodegenOptions},
diagnostics::OxcDiagnostic,
mangler::Mangler,
semantic::post_transform_checker::check_semantic_after_transform,
span::SourceType,
transformer::{TransformOptions, TransformerReturn},
CompilerInterface,
};
use oxc_tasks_transform_checker::check_semantic_after_transform;

pub struct Driver {
check_semantic: bool,
Expand Down

0 comments on commit e19deaa

Please sign in to comment.