refactor(traverse): move generated files into separate folder (#5115)

Move generated files in `oxc_traverse` crate into separate folder, to match `ast_tools`.

Also amend the header on generated files to match files generated by `ast_tools`.
This commit is contained in:
overlookmotel 2024-08-23 12:49:31 +00:00
parent 525d664aa9
commit c6590aeee3
5 changed files with 23 additions and 11 deletions

View file

@ -22,11 +22,13 @@ import generateWalkFunctionsCode from './lib/walk.mjs';
const execAsync = promisify(exec);
const PREAMBLE = '// Generated by `scripts/build.mjs`.\n\n';
const PREAMBLE = '// Auto-generated code, DO NOT EDIT DIRECTLY!\n'
+ '// Generated by `oxc_traverse/scripts/build.mjs`.\n'
+ '// To alter this generated file you have to edit the codegen.\n\n';
const types = await getTypesFromCode();
const outputDirPath = pathJoin(fileURLToPath(import.meta.url), '../../src');
const outputDirPath = pathJoin(fileURLToPath(import.meta.url), '../../src/generated');
await writeToFile('traverse.rs', generateTraverseTraitCode(types));
await writeToFile('ancestor.rs', generateAncestorsCode(types));
await writeToFile('walk.rs', generateWalkFunctionsCode(types));

View file

@ -1,4 +1,6 @@
// Generated by `scripts/build.mjs`.
// Auto-generated code, DO NOT EDIT DIRECTLY!
// Generated by `oxc_traverse/scripts/build.mjs`.
// To alter this generated file you have to edit the codegen.
#![allow(
unsafe_code,

View file

@ -1,4 +1,6 @@
// Generated by `scripts/build.mjs`.
// Auto-generated code, DO NOT EDIT DIRECTLY!
// Generated by `oxc_traverse/scripts/build.mjs`.
// To alter this generated file you have to edit the codegen.
use oxc_allocator::Vec;
#[allow(clippy::wildcard_imports)]

View file

@ -1,4 +1,6 @@
// Generated by `scripts/build.mjs`.
// Auto-generated code, DO NOT EDIT DIRECTLY!
// Generated by `oxc_traverse/scripts/build.mjs`.
// To alter this generated file you have to edit the codegen.
#![allow(
unsafe_code,

View file

@ -64,14 +64,18 @@ use oxc_allocator::Allocator;
use oxc_ast::ast::Program;
use oxc_semantic::{ScopeTree, SymbolTable};
pub mod ancestor;
pub use ancestor::Ancestor;
mod context;
pub use context::{TraverseAncestry, TraverseCtx, TraverseScoping};
#[allow(clippy::module_inception)]
mod traverse;
pub use traverse::Traverse;
mod walk;
mod generated {
pub mod ancestor;
pub mod traverse;
pub(super) mod walk;
}
pub use generated::ancestor;
pub use generated::ancestor::Ancestor;
pub use generated::traverse::Traverse;
use generated::walk;
mod compile_fail_tests;