(
compiler: string,
options: string[],
inputFilename: string,
execOptions: ExecutionOptionsWithEnv,
filters?: ParseFiltersAndOutputOptions,
)
| 87 | } |
| 88 | |
| 89 | override async runCompiler( |
| 90 | compiler: string, |
| 91 | options: string[], |
| 92 | inputFilename: string, |
| 93 | execOptions: ExecutionOptionsWithEnv, |
| 94 | filters?: ParseFiltersAndOutputOptions, |
| 95 | ): Promise<CompilationResult> { |
| 96 | // `options` are all fed into the compile step except for `--prebuilt-runtimes` which is |
| 97 | // used for linking. |
| 98 | const [runtimesOpt, otherOptions] = this.removePrebuiltRuntimesFromOptions(options); |
| 99 | const compileOptions = ['compile'].concat(otherOptions); |
| 100 | const result = await super.runCompiler(compiler, compileOptions, inputFilename, execOptions, filters); |
| 101 | if (result.code !== 0) { |
| 102 | return result; |
| 103 | } |
| 104 | |
| 105 | // The output of runCompiler is either an asm file or object file. It is an object file if |
| 106 | // we want to produce a binary, in which case we link it into a binary, overwriting the output |
| 107 | // path of the compile step. |
| 108 | if (filters?.binary) { |
| 109 | const compileOutputFilePath = this.getOutputPathFileFromOptions(options); |
| 110 | const objectFilePath = await this.moveFileToTemp(compileOutputFilePath); |
| 111 | const linkOptions = [runtimesOpt, 'link', `--output=${compileOutputFilePath}`, objectFilePath]; |
| 112 | const linkResult = await this.exec(this.compiler.exe, linkOptions, execOptions); |
| 113 | return {...result, ...this.transformToCompilationResult(linkResult, inputFilename)}; |
| 114 | } |
| 115 | |
| 116 | return result; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | export class CarbonExplorerCompiler extends BaseCompiler { |
nothing calls this directly
no test coverage detected