diff options
author | RabsRincon <rubrinbla@gmail.com> | 2018-01-18 19:43:10 +0100 |
---|---|---|
committer | RabsRincon <rubrinbla@gmail.com> | 2018-01-18 19:43:10 +0100 |
commit | a54faefb4c8668d9c9f93c78bd6bc639d1f0c219 (patch) | |
tree | 6465bf3e1d8e270cc53e67c04277c5773b16f7d6 /lib/compilers/Wine-CL.js | |
parent | 7bd30b4c4b10f93f26db81fbbe492149b8d487eb (diff) | |
download | compiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.tar.gz compiler-explorer-a54faefb4c8668d9c9f93c78bd6bc639d1f0c219.zip |
ES6fy compilers inheritance
Diffstat (limited to 'lib/compilers/Wine-CL.js')
-rw-r--r-- | lib/compilers/Wine-CL.js | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/lib/compilers/Wine-CL.js b/lib/compilers/Wine-CL.js index c2cd4eaa3..1bce97e65 100644 --- a/lib/compilers/Wine-CL.js +++ b/lib/compilers/Wine-CL.js @@ -22,54 +22,59 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -var Compile = require('../base-compiler'); -var asm = require('../asm-cl'); -var RunCLDemangler = require('../cl-support').RunCLDemangler; +const BaseCompiler = require('../base-compiler'), + asmCl = require('../asm-cl'), + RunCLDemangler = require('../cl-support').RunCLDemangler, + argumentParsers = require("./argument-parsers"); -function compileCl(info, env) { - var compile = new Compile(info, env); - compile.asm = new asm.AsmParser(compile.compilerProps); - info.supportsFiltersInBinary = true; - if ((process.platform === "linux") || (process.platform === "darwin")) { - var wine = env.ceProps("wine"); - var origExec = compile.exec; - compile.exec = function (command, args, options) { - if (command.toLowerCase().endsWith(".exe")) { - args.unshift(command); - command = wine; - } - return origExec(command, args, options); - }; - compile.filename = function (fn) { - return 'Z:' + fn; - }; + +class CLCompiler extends BaseCompiler { + constructor(info, env) { + info.supportsFiltersInBinary = true; + super(info, env); + this.asm = new asmCl.AsmParser(); + + if (info.unitTestMode) { + this.initialise(); + return this; + } else { + return this.initialise(); + } + } + + exec(command, args, options) { + if ((process.platform === "linux" || process.platform === "darwin") && command.toLowerCase().endsWith(".exe")) { + args.unshift(command); + command = this.env.ceProps("wine"); + } + return super.exec(command, args, options); } - compile.supportsObjdump = function () { + + filename(fn) { + return process.platform === "linux" || process.platform === "darwin" ? 'Z:' + fn : super.filename(fn); + } + + supportsObjdump() { return false; - }; + } - compile.getArgumentParser = () => (compiler) => compiler; + getArgumentParser() { + return argumentParsers.Base; + } - compile.postProcessAsm = function(result) { + postProcessAsm(result) { return RunCLDemangler(this, result); - }; + } - compile.optionsForFilter = function (filters, outputFilename, userOptions) { + optionsForFilter(filters, outputFilename, userOptions) { return [ '/FAsc', '/c', '/Fa' + this.filename(outputFilename), '/Fo' + this.filename(outputFilename + '.obj') ]; - }; - - if (info.unitTestMode) { - compile.initialise(); - - return compile; - } else { - return compile.initialise(); } + } -module.exports = compileCl; +module.exports = CLCompiler; |