diff options
Diffstat (limited to 'lib/compilers/Wine-CL.js')
-rw-r--r-- | lib/compilers/Wine-CL.js | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/lib/compilers/Wine-CL.js b/lib/compilers/Wine-CL.js index c2cd4eaa3..b2c8f738b 100644 --- a/lib/compilers/Wine-CL.js +++ b/lib/compilers/Wine-CL.js @@ -22,54 +22,52 @@ // 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(); + } + + 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; |