mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
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:
parent
525d664aa9
commit
c6590aeee3
5 changed files with 23 additions and 11 deletions
|
|
@ -22,11 +22,13 @@ import generateWalkFunctionsCode from './lib/walk.mjs';
|
||||||
|
|
||||||
const execAsync = promisify(exec);
|
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 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('traverse.rs', generateTraverseTraitCode(types));
|
||||||
await writeToFile('ancestor.rs', generateAncestorsCode(types));
|
await writeToFile('ancestor.rs', generateAncestorsCode(types));
|
||||||
await writeToFile('walk.rs', generateWalkFunctionsCode(types));
|
await writeToFile('walk.rs', generateWalkFunctionsCode(types));
|
||||||
|
|
|
||||||
|
|
@ -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(
|
#![allow(
|
||||||
unsafe_code,
|
unsafe_code,
|
||||||
|
|
@ -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;
|
use oxc_allocator::Vec;
|
||||||
#[allow(clippy::wildcard_imports)]
|
#[allow(clippy::wildcard_imports)]
|
||||||
|
|
@ -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(
|
#![allow(
|
||||||
unsafe_code,
|
unsafe_code,
|
||||||
|
|
@ -64,14 +64,18 @@ use oxc_allocator::Allocator;
|
||||||
use oxc_ast::ast::Program;
|
use oxc_ast::ast::Program;
|
||||||
use oxc_semantic::{ScopeTree, SymbolTable};
|
use oxc_semantic::{ScopeTree, SymbolTable};
|
||||||
|
|
||||||
pub mod ancestor;
|
|
||||||
pub use ancestor::Ancestor;
|
|
||||||
mod context;
|
mod context;
|
||||||
pub use context::{TraverseAncestry, TraverseCtx, TraverseScoping};
|
pub use context::{TraverseAncestry, TraverseCtx, TraverseScoping};
|
||||||
#[allow(clippy::module_inception)]
|
|
||||||
mod traverse;
|
mod generated {
|
||||||
pub use traverse::Traverse;
|
pub mod ancestor;
|
||||||
mod walk;
|
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;
|
mod compile_fail_tests;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue