Closed LogvinovLeon closed 3 years ago
AST should be present in the artifacts when requested
It's not there even though Solidity returns it. It does not make it's way to the artifacts file
In the https://github.com/0xProject/0x-monorepo/blob/development/packages/sol-compiler/src/compiler.ts#L396 Change from:
const { id } = compilerOutput.sources[sourceContractPath]; allSources[sourceContractPath] = { id, content }; } const usedSources = getSourcesWithDependencies(contractPath, allSources, importRemappings); const contractVersion: ContractVersionData = { compilerOutput: compiledContract, sourceTreeHashHex, sources: _.mapValues(usedSources, ({ id }) => ({ id })),
to
const { id, ast } = compilerOutput.sources[sourceContractPath]; allSources[sourceContractPath] = { id, ast, content }; } const usedSources = getSourcesWithDependencies(contractPath, allSources, importRemappings); const contractVersion: ContractVersionData = { compilerOutput: compiledContract, sourceTreeHashHex, sources: usedSources,
Compile any contract and request AST in the output.
Trying to get an AST of the contract using sol-compiler
└─ @0x/sol-compiler@4.4.3
@merklejerk Could you please take a look when you have a moment? Should be a quick fix
Good to see you're still around, Leo. This should be fixed in sol-compiler@4.5.0, which I just published.
sol-compiler@4.5.0
Expected Behavior
AST should be present in the artifacts when requested
Current Behavior
It's not there even though Solidity returns it. It does not make it's way to the artifacts file
Possible Solution
In the https://github.com/0xProject/0x-monorepo/blob/development/packages/sol-compiler/src/compiler.ts#L396 Change from:
to
Steps to Reproduce (for bugs)
Compile any contract and request AST in the output.
Context
Trying to get an AST of the contract using sol-compiler
Your Environment
└─ @0x/sol-compiler@4.4.3