MCPcopy Index your code
hub / github.com/compiler-explorer/compiler-explorer / processYulOutput

Method processYulOutput

lib/base-compiler.ts:1772–1796  ·  view source on GitHub ↗
(
        defaultOutputFilename: string,
        result: CompilationResult,
        yulOptions: YulBackendOptions,
    )

Source from the content-addressed store, hash-verified

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.

Callers 1

doCompilationMethod · 0.95

Calls 5

getYulOutputFilenameMethod · 0.95
fileExistsMethod · 0.80
readFileMethod · 0.80
pushMethod · 0.80
matchMethod · 0.80

Tested by

no test coverage detected