diff options
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/ada.js | 16 | ||||
-rw-r--r-- | lib/compilers/assembly.js | 45 |
2 files changed, 27 insertions, 34 deletions
diff --git a/lib/compilers/ada.js b/lib/compilers/ada.js index 26f4d7102..51a1f77b5 100644 --- a/lib/compilers/ada.js +++ b/lib/compilers/ada.js @@ -61,7 +61,7 @@ class AdaCompiler extends BaseCompiler { return source; } - runCompiler(compiler, options, inputFilename, execOptions) { + async runCompiler(compiler, options, inputFilename, execOptions) { if (!execOptions) { execOptions = this.getDefaultExecOptions(); } @@ -71,20 +71,18 @@ class AdaCompiler extends BaseCompiler { // find where the '-cargs' flag is in options. This is to allow us to set the // output as 'output.s' and not end up with 'example.s'. If the output is left // as 'example.s' CE can't find it and thus you get no output. - let inputFileName = options.pop(); + const inputFileName = options.pop(); for (let i = 0; i < options.length; i++) { if (options[i] === '-cargs') { options.splice(i, 0, inputFileName); break; } } - return this.exec(compiler, options, execOptions) - .then(result => { - result.inputFilename = inputFilename; - result.stdout = utils.parseOutput(result.stdout, inputFilename); - result.stderr = utils.parseOutput(result.stderr, inputFilename); - return result; - }); + const result = await this.exec(compiler, options, execOptions); + result.inputFilename = inputFilename; + result.stdout = utils.parseOutput(result.stdout, inputFilename); + result.stderr = utils.parseOutput(result.stderr, inputFilename); + return result; } } diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js index 076b83c01..25156ae22 100644 --- a/lib/compilers/assembly.js +++ b/lib/compilers/assembly.js @@ -49,25 +49,24 @@ class AssemblyCompiler extends BaseCompiler { return []; } - runCompiler(compiler, options, inputFilename, execOptions) { + async runCompiler(compiler, options, inputFilename, execOptions) { if (!execOptions) { execOptions = this.getDefaultExecOptions(); } execOptions.customCwd = path.dirname(inputFilename); - return this.exec(compiler, options, execOptions).then(result => { - result.inputFilename = inputFilename; - result.stdout = utils.parseOutput(result.stdout, inputFilename); - result.stderr = utils.parseOutput(result.stderr, inputFilename); - return result; - }); + const result = await this.exec(compiler, options, execOptions); + result.inputFilename = inputFilename; + result.stdout = utils.parseOutput(result.stdout, inputFilename); + result.stderr = utils.parseOutput(result.stderr, inputFilename); + return result; } checkOutputFileAndDoPostProcess(asmResult, outputFilename, filters) { return this.postProcess(asmResult, outputFilename, filters); } - getGeneratedOutputfilename(inputFilename) { + getGeneratedOutputFilename(inputFilename) { const outputFolder = path.dirname(inputFilename); return new Promise((resolve, reject) => { @@ -82,24 +81,20 @@ class AssemblyCompiler extends BaseCompiler { }); } - objdump(outputFilename, result, maxSize, intelAsm, demangle) { - return this.getGeneratedOutputfilename(outputFilename) - .then((realOutputFilename) => { - const dirPath = path.dirname(realOutputFilename); - let args = ["-d", realOutputFilename, "-l", "--insn-width=16"]; - if (demangle) args = args.concat("-C"); - if (intelAsm) args = args.concat(["-M", "intel"]); - return this.exec(this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}) - .then(objResult => { - result.asm = objResult.stdout; - if (objResult.code !== 0) { - result.asm = "<No output: objdump returned " + objResult.code + ">"; - } - return result; - }); - }); + async objdump(outputFilename, result, maxSize, intelAsm, demangle) { + const realOutputFilename = await this.getGeneratedOutputFilename(outputFilename); + const dirPath = path.dirname(realOutputFilename); + let args = ["-d", realOutputFilename, "-l", "--insn-width=16"]; + if (demangle) args = args.concat("-C"); + if (intelAsm) args = args.concat(["-M", "intel"]); + const objResult = await this.exec( + this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}); + result.asm = objResult.stdout; + if (objResult.code !== 0) { + result.asm = "<No output: objdump returned " + objResult.code + ">"; + } + return result; } } - module.exports = AssemblyCompiler; |