mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
prepare_report: Handle internal compiler errors in Standard JSON as errors, not missing bytecode
This commit is contained in:
@@ -24,10 +24,25 @@ for (const optimize of [false, true])
|
||||
|
||||
const result = JSON.parse(compiler.compile(JSON.stringify(input)))
|
||||
|
||||
let internalCompilerError = false
|
||||
if ('errors' in result)
|
||||
{
|
||||
for (const error of result['errors'])
|
||||
// JSON interface still returns contract metadata in case of an internal compiler error while
|
||||
// CLI interface does not. To make reports comparable we must force this case to be detected as
|
||||
// an error in both cases.
|
||||
if (['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError'].includes(error['type']))
|
||||
{
|
||||
internalCompilerError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!('contracts' in result) ||
|
||||
Object.keys(result['contracts']).length === 0 ||
|
||||
Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0)
|
||||
Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0) ||
|
||||
internalCompilerError
|
||||
)
|
||||
// NOTE: do not exit here because this may be run on source which cannot be compiled
|
||||
console.log(filename + ': <ERROR>')
|
||||
|
||||
Reference in New Issue
Block a user