mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 06:49:47 -06:00
Adds some ts typings to base-compiler.ts (#3966)
Mostly to help #3961, but changed some I found along the way. Lots of work still needed here, but babysteps :)
This commit is contained in:
+24
-8
@@ -451,7 +451,7 @@ export class BaseCompiler {
|
||||
return fn;
|
||||
}
|
||||
|
||||
getGccDumpFileName(outputFilename) {
|
||||
getGccDumpFileName(outputFilename: string) {
|
||||
return outputFilename.replace(path.extname(outputFilename), '.dump');
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ export class BaseCompiler {
|
||||
// Returns a list of additional options that may be required by some backend options.
|
||||
// Meant to be overloaded by compiler classes.
|
||||
// Default handles the GCC compiler with some debug dump enabled.
|
||||
optionsForBackend(backendOptions, outputFilename) {
|
||||
optionsForBackend(backendOptions: Record<string, any>, outputFilename: string): string[] {
|
||||
let addOpts: string[] = [];
|
||||
|
||||
if (backendOptions.produceGccDump && backendOptions.produceGccDump.opened && this.compiler.supportsGccDump) {
|
||||
@@ -533,7 +533,7 @@ export class BaseCompiler {
|
||||
return addOpts;
|
||||
}
|
||||
|
||||
protected optionsForFilter(filters: ParseFilters, outputFilename, userOptions?) {
|
||||
protected optionsForFilter(filters: ParseFilters, outputFilename: string, userOptions?: string[]): string[] {
|
||||
let options = ['-g', '-o', this.filename(outputFilename)];
|
||||
if (this.compiler.intelAsm && filters.intel && !filters.binary) {
|
||||
options = options.concat(this.compiler.intelAsm.split(' '));
|
||||
@@ -563,8 +563,8 @@ export class BaseCompiler {
|
||||
return result;
|
||||
}
|
||||
|
||||
findAutodetectStaticLibLink(linkname): SelectedLibraryVersion | false {
|
||||
const foundLib = _.findKey(this.supportedLibraries as object, lib => {
|
||||
findAutodetectStaticLibLink(linkname: string): SelectedLibraryVersion | false {
|
||||
const foundLib = _.findKey(this.supportedLibraries as Record<string, Library>, lib => {
|
||||
return (
|
||||
lib.versions.autodetect &&
|
||||
lib.versions.autodetect.staticliblink &&
|
||||
@@ -775,7 +775,16 @@ export class BaseCompiler {
|
||||
);
|
||||
}
|
||||
|
||||
orderArguments(options, inputFilename, libIncludes, libOptions, libPaths, libLinks, userOptions, staticLibLinks) {
|
||||
orderArguments(
|
||||
options: string[],
|
||||
inputFilename: string,
|
||||
libIncludes: any[], // TODO: Fix this type
|
||||
libOptions: any[],
|
||||
libPaths: string[],
|
||||
libLinks: string[],
|
||||
userOptions: string[],
|
||||
staticLibLinks: string[],
|
||||
) {
|
||||
return options.concat(
|
||||
userOptions,
|
||||
[this.filename(inputFilename)],
|
||||
@@ -787,7 +796,14 @@ export class BaseCompiler {
|
||||
);
|
||||
}
|
||||
|
||||
prepareArguments(userOptions, filters: ParseFilters, backendOptions, inputFilename, outputFilename, libraries) {
|
||||
prepareArguments(
|
||||
userOptions: string[],
|
||||
filters: ParseFilters,
|
||||
backendOptions: Record<string, any>,
|
||||
inputFilename: string,
|
||||
outputFilename: string,
|
||||
libraries,
|
||||
) {
|
||||
let options = this.optionsForFilter(filters, outputFilename, userOptions);
|
||||
backendOptions = backendOptions || {};
|
||||
|
||||
@@ -831,7 +847,7 @@ export class BaseCompiler {
|
||||
return options;
|
||||
}
|
||||
|
||||
filterUserOptions(userOptions) {
|
||||
filterUserOptions(userOptions: string[]): string[] {
|
||||
return userOptions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user