Skip to content

Commit

Permalink
bugsFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Javadyakuza committed Aug 7, 2023
1 parent 5df5023 commit c85a8d0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/ast-builder/compile-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ export const compileAst = async (config: Config) => {
let astOutputPath = resolve(config.root!, config.astOutputDir!);
deleteDirectoryIfExists(astOutputPath);

let astCachePath = `ast-cache`;
let astCachePath = resolve(config.root!, `ast-cache`);
let astPath = resolve(config.root!, "ast");

createDirectoryIfNotExists(resolve(config.root!, astCachePath));
createDirectoryIfNotExists(astCachePath);
createDirectoryIfNotExists(astPath);

contracts.forEach((contract) => {
execSync(
`${config.compilerPath} --ast-compact-json ${config.sourcesDir}/${contract} --output-dir=$PWD/${astCachePath}`
`${config.compilerPath} --ast-compact-json ${config.sourcesDir}/${contract} --output-dir=${astCachePath}`
);
moveFiles(resolve(config.root!, astCachePath), astOutputPath);
moveFiles(astCachePath, astOutputPath);
});

deleteDirectoryIfExists(resolve(config.root!, astCachePath));
deleteDirectoryIfExists(astCachePath);
compileExternalAst(config);
renameAstFiles(astOutputPath);
wrapAstInArray(astOutputPath);
Expand All @@ -67,25 +67,25 @@ export const compileExternalAst = async (config: Config) => {

let astOutputPath = resolve(config.root!, config.astOutputDir!);

let astCachePath = `ast-cache`;
let astCachePath = resolve(config.root!, `ast-cache`);
let astPath = resolve(config.root!, "ast");

createDirectoryIfNotExists(resolve(config.root!, astCachePath));
createDirectoryIfNotExists(astCachePath);
createDirectoryIfNotExists(astPath);

Object.values(fullSources).forEach((source) => {
for (const ast of source.asts) {
const absolutePath = ast.absolutePath;
if (!absolutePath.startsWith(config.sourcesDir!)) {
execSync(
`${config.compilerPath} --ast-compact-json $PWD/${absolutePath} --output-dir=$PWD/${astCachePath}`
`${config.compilerPath} --ast-compact-json $PWD/${absolutePath} --output-dir=${astCachePath}`
);
}
}
moveFiles(resolve(config.root!, astCachePath), astOutputPath);
moveFiles(astCachePath, astOutputPath);
});

deleteDirectoryIfExists(resolve(config.root!, astCachePath));
deleteDirectoryIfExists(astCachePath);
};

const renameAstFiles = (dir: string) => {
Expand Down

0 comments on commit c85a8d0

Please sign in to comment.