(
defaultOutputFilename: string,
result: CompilationResult,
yulOptions: YulBackendOptions,
)
| 1770 | } |
| 1771 | |
| 1772 | async processYulOutput( |
| 1773 | defaultOutputFilename: string, |
| 1774 | result: CompilationResult, |
| 1775 | yulOptions: YulBackendOptions, |
| 1776 | ): Promise<ResultLine[]> { |
| 1777 | if (result.code !== 0) { |
| 1778 | return [{text: 'Failed to run compiler to get Yul intermediary output'}]; |
| 1779 | } |
| 1780 | |
| 1781 | const outputFilename = this.getYulOutputFilename(defaultOutputFilename); |
| 1782 | if (await utils.fileExists(outputFilename)) { |
| 1783 | const content = await fs.readFile(outputFilename, 'utf8'); |
| 1784 | const result: ResultLine[] = content.split('\n').map(line => ({text: line})); |
| 1785 | const filters: RegExp[] = []; |
| 1786 | |
| 1787 | if (yulOptions.filterDebugInfo) { |
| 1788 | const debugInfoRe = /^\s*\/\/\/ @(use-src|src|ast-id)/; |
| 1789 | filters.push(debugInfoRe); |
| 1790 | } |
| 1791 | |
| 1792 | return result.filter(line => filters.every(re => !line.text.match(re))); |
| 1793 | } |
| 1794 | |
| 1795 | return [{text: 'Internal error: Unable to open output path'}]; |
| 1796 | } |
| 1797 | |
| 1798 | /** |
| 1799 | * Get the LLVM IR output filename. |
no test coverage detected