aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers')
-rw-r--r--lib/compilers/_all.js76
-rw-r--r--lib/compilers/ada.js11
-rw-r--r--lib/compilers/analysis-tool.js7
-rw-r--r--lib/compilers/argument-parsers.js51
-rw-r--r--lib/compilers/assembly.js21
-rw-r--r--lib/compilers/cc65.js7
-rw-r--r--lib/compilers/clang.js10
-rw-r--r--lib/compilers/clean.js15
-rw-r--r--lib/compilers/default.js6
-rw-r--r--lib/compilers/dmd.js14
-rw-r--r--lib/compilers/ellcc.js8
-rw-r--r--lib/compilers/ewavr.js11
-rw-r--r--lib/compilers/fake-for-test.js7
-rw-r--r--lib/compilers/fortran.js11
-rw-r--r--lib/compilers/gcc.js6
-rw-r--r--lib/compilers/golang.js16
-rw-r--r--lib/compilers/haskell.js11
-rw-r--r--lib/compilers/index.js11
-rw-r--r--lib/compilers/ispc.js11
-rw-r--r--lib/compilers/java.js26
-rw-r--r--lib/compilers/ldc.js21
-rw-r--r--lib/compilers/llc.js11
-rw-r--r--lib/compilers/llvm-mca.js11
-rw-r--r--lib/compilers/nim.js19
-rw-r--r--lib/compilers/nvcc.js18
-rw-r--r--lib/compilers/ocaml.js9
-rw-r--r--lib/compilers/opt.js11
-rw-r--r--lib/compilers/pascal.js22
-rw-r--r--lib/compilers/ppci.js10
-rw-r--r--lib/compilers/ptxas.js21
-rw-r--r--lib/compilers/python.js15
-rw-r--r--lib/compilers/rust.js17
-rw-r--r--lib/compilers/sdcc.js8
-rw-r--r--lib/compilers/swift.js11
-rw-r--r--lib/compilers/tendra.js7
-rw-r--r--lib/compilers/win32-vc.js15
-rw-r--r--lib/compilers/win32.js18
-rw-r--r--lib/compilers/wine-vc.js24
-rw-r--r--lib/compilers/wsl-vc.js18
-rw-r--r--lib/compilers/zig.js14
40 files changed, 287 insertions, 349 deletions
diff --git a/lib/compilers/_all.js b/lib/compilers/_all.js
index fe935c331..07e0afa8f 100644
--- a/lib/compilers/_all.js
+++ b/lib/compilers/_all.js
@@ -1,39 +1,37 @@
-module.exports = {
- AdaCompiler: require('./ada'),
- AnalysisTool: require('./analysis-tool'),
- AssemblyCompiler: require('./assembly'),
- Cc65Compiler: require('./cc65'),
- ClangCompiler: require('./clang'),
- CleanCompiler: require('./clean'),
- DefaultCompiler: require('./default'),
- DMDCompiler: require('./dmd'),
- EllccCompiler: require('./ellcc'),
- EWAVRCompiler: require('./ewavr'),
- FakeCompiler: require('./fake-for-test'),
- FortranCompiler: require('./fortran'),
- GCCCompiler: require('./gcc'),
- GolangCompiler: require('./golang'),
- HaskellCompiler: require('./haskell'),
- ISPCCompiler: require('./ispc'),
- JavaCompiler: require('./java'),
- LDCCompiler: require('./ldc'),
- LLCCompiler: require('./llc'),
- LLVMmcaTool: require('./llvm-mca'),
- NimCompiler: require('./nim'),
- NvccCompiler: require('./nvcc'),
- OCamlCompiler: require('./ocaml'),
- OptCompiler: require('./opt'),
- FPCCompiler: require('./pascal'),
- PPCICompiler: require('./ppci'),
- PtxAssembler: require('./ptxas'),
- PythonCompiler: require('./python'),
- RustCompiler: require('./rust'),
- SdccCompiler: require('./sdcc'),
- SwiftCompiler: require('./swift'),
- TenDRACompiler: require('./tendra'),
- Win32Compiler: require('./win32'),
- Win32VcCompiler: require('./win32-vc'),
- WineVcCompiler: require('./wine-vc'),
- WslVcCompiler: require('./wsl-vc'),
- ZigCompiler: require('./zig'),
-};
+export { AdaCompiler } from './ada';
+export { AnalysisTool } from './analysis-tool';
+export { AssemblyCompiler } from './assembly';
+export { Cc65Compiler } from './cc65';
+export { ClangCompiler } from './clang';
+export { CleanCompiler } from './clean';
+export { DefaultCompiler } from './default';
+export { DMDCompiler } from './dmd';
+export { EllccCompiler } from './ellcc';
+export { EWAVRCompiler } from './ewavr';
+export { FakeCompiler } from './fake-for-test';
+export { FortranCompiler } from './fortran';
+export { GCCCompiler } from './gcc';
+export { GolangCompiler } from './golang';
+export { HaskellCompiler } from './haskell';
+export { ISPCCompiler } from './ispc';
+export { JavaCompiler } from './java';
+export { LDCCompiler } from './ldc';
+export { LLCCompiler } from './llc';
+export { LLVMmcaTool } from './llvm-mca';
+export { NimCompiler } from './nim';
+export { NvccCompiler } from './nvcc';
+export { OCamlCompiler } from './ocaml';
+export { OptCompiler } from './opt';
+export { FPCCompiler } from './pascal';
+export { PPCICompiler } from './ppci';
+export { PtxAssembler } from './ptxas';
+export { PythonCompiler } from './python';
+export { RustCompiler } from './rust';
+export { SdccCompiler } from './sdcc';
+export { SwiftCompiler } from './swift';
+export { TenDRACompiler } from './tendra';
+export { Win32Compiler } from './win32';
+export { Win32VcCompiler } from './win32-vc';
+export { WineVcCompiler } from './wine-vc';
+export { WslVcCompiler } from './wsl-vc';
+export { ZigCompiler } from './zig';
diff --git a/lib/compilers/ada.js b/lib/compilers/ada.js
index 56ed8fe09..8814c1aab 100644
--- a/lib/compilers/ada.js
+++ b/lib/compilers/ada.js
@@ -22,11 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- utils = require('../utils'),
- path = require('path');
+import path from 'path';
-class AdaCompiler extends BaseCompiler {
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+export class AdaCompiler extends BaseCompiler {
static get key() { return 'ada'; }
constructor(info, env) {
@@ -104,5 +105,3 @@ class AdaCompiler extends BaseCompiler {
return result;
}
}
-
-module.exports = AdaCompiler;
diff --git a/lib/compilers/analysis-tool.js b/lib/compilers/analysis-tool.js
index e7bcd2f6b..6c88a31ac 100644
--- a/lib/compilers/analysis-tool.js
+++ b/lib/compilers/analysis-tool.js
@@ -22,10 +22,10 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler');
+import { BaseCompiler } from '../base-compiler';
// Plain compiler, which just runs the tool and returns whatever the output was
-class AnalysisTool extends BaseCompiler {
+export class AnalysisTool extends BaseCompiler {
static get key() { return 'analysis-tool'; }
constructor(info, env) {
@@ -46,6 +46,3 @@ class AnalysisTool extends BaseCompiler {
};
}
}
-
-
-module.exports = AnalysisTool;
diff --git a/lib/compilers/argument-parsers.js b/lib/compilers/argument-parsers.js
index 744a1d4ab..66c9b98a8 100644
--- a/lib/compilers/argument-parsers.js
+++ b/lib/compilers/argument-parsers.js
@@ -22,11 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const _ = require('underscore'),
- logger = require('../logger').logger,
- utils = require('../utils');
+import _ from 'underscore';
-class BaseParser {
+import { logger } from '../logger';
+import * as utils from '../utils';
+
+export class BaseParser {
static hasSupport(options, forOption) {
return _.keys(options).find(option => option.includes(forOption));
}
@@ -79,7 +80,7 @@ class BaseParser {
}
}
-class GCCParser extends BaseParser {
+export class GCCParser extends BaseParser {
static async parse(compiler) {
const results = await Promise.all([
GCCParser.getOptions(compiler, '-fsyntax-only --target-help'),
@@ -91,14 +92,11 @@ class GCCParser extends BaseParser {
logger.debug(`gcc-like compiler options: ${keys.join(' ')}`);
if (BaseParser.hasSupport(options, '-masm=')) {
// -masm= may be available but unsupported by the compiler.
- // eslint-disable-next-line promise/catch-or-return
- compiler.exec(compiler.compiler.exe, ['-fsyntax-only', '--target-help', '-masm=intel'])
- .then(result => {
- if (result.code === 0) {
- compiler.compiler.intelAsm = '-masm=intel';
- compiler.compiler.supportsIntel = true;
- }
- });
+ const res = await compiler.exec(compiler.compiler.exe, ['-fsyntax-only', '--target-help', '-masm=intel']);
+ if (res.code === 0) {
+ compiler.compiler.intelAsm = '-masm=intel';
+ compiler.compiler.supportsIntel = true;
+ }
}
if (BaseParser.hasSupport(options, '-fdiagnostics-color')) {
if (compiler.compiler.options) compiler.compiler.options += ' ';
@@ -121,7 +119,7 @@ class GCCParser extends BaseParser {
}
}
-class ClangParser extends BaseParser {
+export class ClangParser extends BaseParser {
static async parse(compiler) {
const options = await ClangParser.getOptions(compiler, '--help');
logger.debug(`clang-like compiler options: ${_.keys(options).join(' ')}`);
@@ -145,14 +143,14 @@ class ClangParser extends BaseParser {
}
}
-class PascalParser extends BaseParser {
+export class PascalParser extends BaseParser {
static async parse(compiler) {
await PascalParser.getOptions(compiler, '-help');
return compiler;
}
}
-class ISPCParser extends BaseParser {
+export class ISPCParser extends BaseParser {
static async parse(compiler) {
const options = await ISPCParser.getOptions(compiler, '--help');
if (BaseParser.hasSupport(options, '--x86-asm-syntax')) {
@@ -172,14 +170,14 @@ class ISPCParser extends BaseParser {
}
}
-class JavaParser extends BaseParser {
+export class JavaParser extends BaseParser {
static async parse(compiler) {
await JavaParser.getOptions(compiler, '-help');
return compiler;
}
}
-class VCParser extends BaseParser {
+export class VCParser extends BaseParser {
static async parse(compiler) {
await VCParser.getOptions(compiler, '/help');
return compiler;
@@ -250,8 +248,7 @@ class VCParser extends BaseParser {
}
}
-
-class RustParser extends BaseParser {
+export class RustParser extends BaseParser {
static async parse(compiler) {
const results = await Promise.all([
RustParser.getOptions(compiler, '--help'),
@@ -285,21 +282,9 @@ class RustParser extends BaseParser {
}
}
-class NimParser extends BaseParser {
+export class NimParser extends BaseParser {
static async parse(compiler) {
await NimParser.getOptions(compiler, '-help');
return compiler;
}
}
-
-module.exports = {
- Base: BaseParser,
- Clang: ClangParser,
- GCC: GCCParser,
- Java: JavaParser,
- VC: VCParser,
- Pascal: PascalParser,
- ISPC: ISPCParser,
- Rust: RustParser,
- Nim: NimParser,
-};
diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js
index 536dae77b..c6b5e9d12 100644
--- a/lib/compilers/assembly.js
+++ b/lib/compilers/assembly.js
@@ -21,16 +21,17 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
-const BaseCompiler = require('../base-compiler'),
- AsmRaw = require('../asm-raw').AsmParser,
- utils = require('../utils'),
- fs = require('fs'),
- path = require('path'),
- argumentParsers = require('./argument-parsers');
+import fs from 'fs';
+import path from 'path';
-class AssemblyCompiler extends BaseCompiler {
+import { AsmRaw } from '../asm-raw';
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+import { BaseParser } from './argument-parsers';
+
+export class AssemblyCompiler extends BaseCompiler {
static get key() { return 'assembly'; }
constructor(info, env) {
@@ -43,7 +44,7 @@ class AssemblyCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Base;
+ return BaseParser;
}
optionsForFilter(filters) {
@@ -98,5 +99,3 @@ class AssemblyCompiler extends BaseCompiler {
return result;
}
}
-
-module.exports = AssemblyCompiler;
diff --git a/lib/compilers/cc65.js b/lib/compilers/cc65.js
index 533ee3b8d..1bc704dc9 100644
--- a/lib/compilers/cc65.js
+++ b/lib/compilers/cc65.js
@@ -22,15 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const
- BaseCompiler = require('../base-compiler');
+import { BaseCompiler } from '../base-compiler';
-class Cc65Compiler extends BaseCompiler {
+export class Cc65Compiler extends BaseCompiler {
static get key() { return 'cc65'; }
optionsForFilter(filters, outputFilename) {
return ['-g', '-o', this.filename(outputFilename)];
}
}
-
-module.exports = Cc65Compiler;
diff --git a/lib/compilers/clang.js b/lib/compilers/clang.js
index 011e9df2f..6c2bacb60 100644
--- a/lib/compilers/clang.js
+++ b/lib/compilers/clang.js
@@ -22,11 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const
- BaseCompiler = require('../base-compiler'),
- path = require('path');
+import path from 'path';
-class ClangCompiler extends BaseCompiler {
+import { BaseCompiler } from '../base-compiler';
+
+export class ClangCompiler extends BaseCompiler {
static get key() { return 'clang'; }
runCompiler(compiler, options, inputFilename, execOptions) {
@@ -39,5 +39,3 @@ class ClangCompiler extends BaseCompiler {
return super.runCompiler(compiler, options, inputFilename, execOptions);
}
}
-
-module.exports = ClangCompiler;
diff --git a/lib/compilers/clean.js b/lib/compilers/clean.js
index 477a19e04..dd998b655 100644
--- a/lib/compilers/clean.js
+++ b/lib/compilers/clean.js
@@ -22,13 +22,14 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const
- BaseCompiler = require('../base-compiler'),
- fs = require('fs-extra'),
- path = require('path'),
- utils = require('../utils');
+import path from 'path';
-class CleanCompiler extends BaseCompiler {
+import fs from 'fs-extra';
+
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+export class CleanCompiler extends BaseCompiler {
static get key() { return 'clean'; }
optionsForFilter(filters) {
@@ -106,5 +107,3 @@ class CleanCompiler extends BaseCompiler {
return result;
}
}
-
-module.exports = CleanCompiler;
diff --git a/lib/compilers/default.js b/lib/compilers/default.js
index a5ce3b614..3ef32f19b 100644
--- a/lib/compilers/default.js
+++ b/lib/compilers/default.js
@@ -22,10 +22,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler');
+import { BaseCompiler } from '../base-compiler';
-class DefaultCompiler extends BaseCompiler {
+export class DefaultCompiler extends BaseCompiler {
static get key() { return 'default'; }
}
-
-module.exports = DefaultCompiler;
diff --git a/lib/compilers/dmd.js b/lib/compilers/dmd.js
index d50d4b3bb..c3cb46889 100644
--- a/lib/compilers/dmd.js
+++ b/lib/compilers/dmd.js
@@ -22,11 +22,13 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers'),
- path = require('path');
+import path from 'path';
-class DMDCompiler extends BaseCompiler {
+import { BaseCompiler } from '../base-compiler';
+
+import { ClangParser } from './argument-parsers';
+
+export class DMDCompiler extends BaseCompiler {
static get key() { return 'dmd'; }
constructor(compiler, env) {
@@ -75,12 +77,10 @@ class DMDCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
filterUserOptions(userOptions) {
return userOptions.filter(option => option !== '-run' && option !== '-man' && !option.startsWith('-Xf'));
}
}
-
-module.exports = DMDCompiler;
diff --git a/lib/compilers/ellcc.js b/lib/compilers/ellcc.js
index be90e8eb8..362b4ef5d 100644
--- a/lib/compilers/ellcc.js
+++ b/lib/compilers/ellcc.js
@@ -21,10 +21,10 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const
- ClangCompiler = require('./clang');
-class EllccCompiler extends ClangCompiler {
+import { ClangCompiler } from './clang';
+
+export class EllccCompiler extends ClangCompiler {
static get key() { return 'ellcc'; }
getSharedLibraryPathsAsArguments() {
@@ -33,5 +33,3 @@ class EllccCompiler extends ClangCompiler {
return this.compiler.ldPath.map(path => pathFlag + path);
}
}
-
-module.exports = EllccCompiler;
diff --git a/lib/compilers/ewavr.js b/lib/compilers/ewavr.js
index 5de44a72f..9a5672ada 100644
--- a/lib/compilers/ewavr.js
+++ b/lib/compilers/ewavr.js
@@ -22,13 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
+import temp from 'temp';
-const BaseCompiler = require('../base-compiler'),
- temp = require('temp'),
- AsmEWAVRParser = require('../asm-parser-ewavr');
+import { AsmEWAVRParser } from '../asm-parser-ewavr';
+import { BaseCompiler } from '../base-compiler';
-class EWAVRCompiler extends BaseCompiler {
+export class EWAVRCompiler extends BaseCompiler {
static get key() { return 'ewavr'; }
constructor(info, env) {
@@ -60,5 +59,3 @@ class EWAVRCompiler extends BaseCompiler {
];
}
}
-
-module.exports = EWAVRCompiler;
diff --git a/lib/compilers/fake-for-test.js b/lib/compilers/fake-for-test.js
index e2b1c49ae..a3f7f45a7 100644
--- a/lib/compilers/fake-for-test.js
+++ b/lib/compilers/fake-for-test.js
@@ -22,9 +22,9 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const _ = require('underscore');
+import _ from 'underscore';
-class FakeCompiler {
+export class FakeCompiler {
static get key() { return 'fake-for-test'; }
constructor(info) {
@@ -63,6 +63,3 @@ class FakeCompiler {
return null;
}
}
-
-
-module.exports = FakeCompiler;
diff --git a/lib/compilers/fortran.js b/lib/compilers/fortran.js
index 54b3cba2f..92a8dda62 100644
--- a/lib/compilers/fortran.js
+++ b/lib/compilers/fortran.js
@@ -23,11 +23,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- path = require('path'),
- utils = require('../utils');
+import path from 'path';
-class FortranCompiler extends BaseCompiler {
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+export class FortranCompiler extends BaseCompiler {
static get key() { return 'fortran'; }
async runCompiler(compiler, options, inputFilename, execOptions) {
@@ -46,5 +47,3 @@ class FortranCompiler extends BaseCompiler {
return result;
}
}
-
-module.exports = FortranCompiler;
diff --git a/lib/compilers/gcc.js b/lib/compilers/gcc.js
index 6c9a1e1ca..592dde321 100644
--- a/lib/compilers/gcc.js
+++ b/lib/compilers/gcc.js
@@ -22,10 +22,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler');
+import { BaseCompiler } from '../base-compiler';
-class GCCCompiler extends BaseCompiler {
+export class GCCCompiler extends BaseCompiler {
static get key() { return 'gcc'; }
}
-
-module.exports = GCCCompiler;
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index 434e3a693..423030500 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -22,10 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers'),
- _ = require('underscore'),
- utils = require('../utils');
+import _ from 'underscore';
+
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+import { ClangParser } from './argument-parsers';
// Each arch has a list of jump instructions in
// Go source src/cmd/asm/internal/arch.
@@ -42,7 +44,7 @@ const jumpPrefixes = [
'cmpub',
];
-class GolangCompiler extends BaseCompiler {
+export class GolangCompiler extends BaseCompiler {
static get key() { return 'golang'; }
convertNewGoL(code) {
@@ -229,8 +231,6 @@ class GolangCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
}
-
-module.exports = GolangCompiler;
diff --git a/lib/compilers/haskell.js b/lib/compilers/haskell.js
index 5b5742b5f..08453535e 100644
--- a/lib/compilers/haskell.js
+++ b/lib/compilers/haskell.js
@@ -22,10 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers');
+import { BaseCompiler } from '../base-compiler';
-class HaskellCompiler extends BaseCompiler {
+import { ClangParser } from './argument-parsers';
+
+export class HaskellCompiler extends BaseCompiler {
static get key() { return 'haskell'; }
optionsForFilter(filters, outputFilename) {
@@ -33,8 +34,6 @@ class HaskellCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
}
-
-module.exports = HaskellCompiler;
diff --git a/lib/compilers/index.js b/lib/compilers/index.js
index 3da4214c5..e33e540eb 100644
--- a/lib/compilers/index.js
+++ b/lib/compilers/index.js
@@ -1,6 +1,7 @@
-const makeKeyedTypeGetter = require('../keyed-type').makeKeyedTypeGetter;
-const all = require('./_all');
+import { makeKeyedTypeGetter } from '../keyed-type';
-module.exports = {
- getCompilerTypeByKey: makeKeyedTypeGetter('compiler', all),
-};
+import * as all from './_all';
+
+export * from './_all';
+
+export const getCompilerTypeByKey = makeKeyedTypeGetter('compiler', all);
diff --git a/lib/compilers/ispc.js b/lib/compilers/ispc.js
index d38976037..fccf39ab5 100644
--- a/lib/compilers/ispc.js
+++ b/lib/compilers/ispc.js
@@ -22,10 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers');
+import { BaseCompiler } from '../base-compiler';
-class ISPCCompiler extends BaseCompiler {
+import { ISPCParser } from './argument-parsers';
+
+export class ISPCCompiler extends BaseCompiler {
static get key() { return 'ispc'; }
optionsForFilter(filters, outputFilename) {
@@ -37,12 +38,10 @@ class ISPCCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.ISPC;
+ return ISPCParser;
}
isCfgCompiler(/*compilerVersion*/) {
return true;
}
}
-
-module.exports = ISPCCompiler;
diff --git a/lib/compilers/java.js b/lib/compilers/java.js
index 9453c5581..140532af8 100644
--- a/lib/compilers/java.js
+++ b/lib/compilers/java.js
@@ -22,14 +22,17 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers'),
- fs = require('fs-extra'),
- utils = require('../utils'),
- path = require('path'),
- logger = require('../logger').logger;
-
-class JavaCompiler extends BaseCompiler {
+import path from 'path';
+
+import fs from 'fs-extra';
+
+import { BaseCompiler } from '../base-compiler';
+import { logger } from '../logger';
+import * as utils from '../utils';
+
+import { JavaParser } from './argument-parsers';
+
+export class JavaCompiler extends BaseCompiler {
static get key() { return 'java'; }
constructor(compilerInfo, env) {
@@ -90,9 +93,8 @@ class JavaCompiler extends BaseCompiler {
];
}
-
getArgumentParser() {
- return argumentParsers.Java;
+ return JavaParser;
}
getOutputFilename(dirPath) {
@@ -194,7 +196,6 @@ class JavaCompiler extends BaseCompiler {
};
methods.push(method);
-
for (const codeLineCandidate of utils.splitLines(codeAndLineNumberTable)) {
// Match
// 1: invokespecial #1 // Method java/lang/Object."<init>":()V
@@ -212,7 +213,6 @@ class JavaCompiler extends BaseCompiler {
}
}
-
let lineRegex = /line\s*(\d+):\s*(\d+)/g;
let m;
let currentInstr = 0;
@@ -275,5 +275,3 @@ class JavaCompiler extends BaseCompiler {
};
}
}
-
-module.exports = JavaCompiler;
diff --git a/lib/compilers/ldc.js b/lib/compilers/ldc.js
index fc3d1a66f..823730572 100644
--- a/lib/compilers/ldc.js
+++ b/lib/compilers/ldc.js
@@ -22,14 +22,17 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers'),
- fs = require('fs-extra'),
- logger = require('./../logger').logger,
- path = require('path'),
- semverParser = require('semver');
+import path from 'path';
-class LDCCompiler extends BaseCompiler {
+import fs from 'fs-extra';
+import semverParser from 'semver';
+
+import { BaseCompiler } from '../base-compiler';
+import { logger } from '../logger';
+
+import { ClangParser } from './argument-parsers';
+
+export class LDCCompiler extends BaseCompiler {
static get key() { return 'ldc'; }
constructor(info, env) {
@@ -51,7 +54,7 @@ class LDCCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
filterUserOptions(userOptions) {
@@ -100,5 +103,3 @@ class LDCCompiler extends BaseCompiler {
.replace('.s', '.ll');
}
}
-
-module.exports = LDCCompiler;
diff --git a/lib/compilers/llc.js b/lib/compilers/llc.js
index 3bc22a396..2d0b8fa64 100644
--- a/lib/compilers/llc.js
+++ b/lib/compilers/llc.js
@@ -22,10 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers');
+import { BaseCompiler } from '../base-compiler';
-class LLCCompiler extends BaseCompiler {
+import { ClangParser } from './argument-parsers';
+
+export class LLCCompiler extends BaseCompiler {
static get key() { return 'llc'; }
constructor(info, env) {
@@ -45,8 +46,6 @@ class LLCCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
}
-
-module.exports = LLCCompiler;
diff --git a/lib/compilers/llvm-mca.js b/lib/compilers/llvm-mca.js
index 26459731c..d320352a4 100644
--- a/lib/compilers/llvm-mca.js
+++ b/lib/compilers/llvm-mca.js
@@ -22,11 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const AnalysisTool = require('./analysis-tool'),
- argumentParsers = require('./argument-parsers');
+import { AnalysisTool } from './analysis-tool';
+import { ClangParser } from './argument-parsers';
// Plain compiler, which just runs the tool and returns whatever the output was
-class LLVMmcaTool extends AnalysisTool {
+export class LLVMmcaTool extends AnalysisTool {
static get key() { return 'llvm-mca'; }
supportsObjdump() { return false; }
@@ -44,9 +44,6 @@ class LLVMmcaTool extends AnalysisTool {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
}
-
-
-module.exports = LLVMmcaTool;
diff --git a/lib/compilers/nim.js b/lib/compilers/nim.js
index cec0471e1..cc1225e2b 100644
--- a/lib/compilers/nim.js
+++ b/lib/compilers/nim.js
@@ -22,11 +22,14 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- _ = require('underscore'),
- path = require('path'),
- argumentParsers = require('./argument-parsers'),
- fs = require('fs-extra');
+import path from 'path';
+
+import fs from 'fs-extra';
+import _ from 'underscore';
+
+import { BaseCompiler } from '../base-compiler';
+
+import { NimParser } from './argument-parsers';
const NimCommands = [
'compile', 'compileToC', 'c',
@@ -36,7 +39,7 @@ const NimCommands = [
'check',
];
-class NimCompiler extends BaseCompiler {
+export class NimCompiler extends BaseCompiler {
static get key() { return 'nim'; }
constructor(info, env) {
@@ -115,12 +118,10 @@ class NimCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Nim;
+ return NimParser;
}
isCfgCompiler(/*compilerVersion*/) {
return true;
}
}
-
-module.exports = NimCompiler;
diff --git a/lib/compilers/nvcc.js b/lib/compilers/nvcc.js
index 97f27a513..8a3f00646 100644
--- a/lib/compilers/nvcc.js
+++ b/lib/compilers/nvcc.js
@@ -22,18 +22,20 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- path = require('path'),
- argumentParsers = require('./argument-parsers'),
- AsmParserSass = require('../asm-parser-sass');
+import path from 'path';
-class NvccCompiler extends BaseCompiler {
+import { SassAsmParser } from '../asm-parser-sass';
+import { BaseCompiler } from '../base-compiler';
+
+import { ClangParser } from './argument-parsers';
+
+export class NvccCompiler extends BaseCompiler {
static get key() { return 'nvcc'; }
constructor(info, env) {
super(info, env);
- this.asm = new AsmParserSass();
+ this.asm = new SassAsmParser();
}
// TODO: (for all of CUDA)
@@ -47,7 +49,7 @@ class NvccCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
async objdump(outputFilename, result, maxSize) {
@@ -63,5 +65,3 @@ class NvccCompiler extends BaseCompiler {
return result;
}
}
-
-module.exports = NvccCompiler;
diff --git a/lib/compilers/ocaml.js b/lib/compilers/ocaml.js
index bc92d5438..91641954a 100644
--- a/lib/compilers/ocaml.js
+++ b/lib/compilers/ocaml.js
@@ -22,12 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
+import path from 'path';
-const BaseCompiler = require('../base-compiler'),
- path = require('path');
+import { BaseCompiler } from '../base-compiler';
-class OCamlCompiler extends BaseCompiler {
+export class OCamlCompiler extends BaseCompiler {
static get key() { return 'ocaml'; }
optionsForFilter() {
@@ -38,5 +37,3 @@ class OCamlCompiler extends BaseCompiler {
return path.join(dirPath, `${path.basename(this.compileFilename, this.lang.extensions[0])}.s`);
}
}
-
-module.exports = OCamlCompiler;
diff --git a/lib/compilers/opt.js b/lib/compilers/opt.js
index 4b5697ec3..763f41ffd 100644
--- a/lib/compilers/opt.js
+++ b/lib/compilers/opt.js
@@ -22,10 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers');
+import { BaseCompiler } from '../base-compiler';
-class OptCompiler extends BaseCompiler {
+import { ClangParser } from './argument-parsers';
+
+export class OptCompiler extends BaseCompiler {
static get key() { return 'opt'; }
optionsForFilter(filters, outputFilename) {
@@ -33,8 +34,6 @@ class OptCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
}
-
-module.exports = OptCompiler;
diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js
index b30a0c312..104f1fbc7 100644
--- a/lib/compilers/pascal.js
+++ b/lib/compilers/pascal.js
@@ -21,16 +21,18 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
-const BaseCompiler = require('../base-compiler'),
- utils = require('../utils'),
- _ = require('underscore'),
- fs = require('fs-extra'),
- path = require('path'),
- argumentParsers = require('./argument-parsers');
+import path from 'path';
-class FPCCompiler extends BaseCompiler {
+import fs from 'fs-extra';
+import _ from 'underscore';
+
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+import { PascalParser } from './argument-parsers';
+
+export class FPCCompiler extends BaseCompiler {
static get key() { return 'pascal'; }
constructor(info, env) {
@@ -165,7 +167,7 @@ class FPCCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Pascal;
+ return PascalParser;
}
getExtraAsmHint(asm) {
@@ -209,5 +211,3 @@ class FPCCompiler extends BaseCompiler {
return asmLines;
}
}
-
-module.exports = FPCCompiler;
diff --git a/lib/compilers/ppci.js b/lib/compilers/ppci.js
index 9ff086d99..ac9aba87b 100644
--- a/lib/compilers/ppci.js
+++ b/lib/compilers/ppci.js
@@ -22,9 +22,9 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- exec = require('../exec'),
- logger = require('../logger').logger;
+import { BaseCompiler } from '../base-compiler';
+import * as exec from '../exec';
+import { logger } from '../logger';
const forbiddenOptions = new Set([
'--report',
@@ -32,7 +32,7 @@ const forbiddenOptions = new Set([
'--html-report',
]);
-class PPCICompiler extends BaseCompiler {
+export class PPCICompiler extends BaseCompiler {
static get key() { return 'ppci'; }
filterUserOptions(args) {
@@ -62,5 +62,3 @@ class PPCICompiler extends BaseCompiler {
}
}
}
-
-module.exports = PPCICompiler;
diff --git a/lib/compilers/ptxas.js b/lib/compilers/ptxas.js
index 7a5361a75..b66ab577a 100644
--- a/lib/compilers/ptxas.js
+++ b/lib/compilers/ptxas.js
@@ -21,21 +21,22 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
-const BaseCompiler = require('../base-compiler'),
- AsmParserSass = require('../asm-parser-sass'),
- utils = require('../utils'),
- path = require('path'),
- argumentParsers = require('./argument-parsers');
+import path from 'path';
-class PtxAssembler extends BaseCompiler {
+import { SassAsmParser } from '../asm-parser-sass';
+import { BaseCompiler } from '../base-compiler';
+import * as utils from '../utils';
+
+import { BaseParser } from './argument-parsers';
+
+export class PtxAssembler extends BaseCompiler {
static get key() { return 'ptxas'; }
constructor(info, env) {
super(info, env);
this.compileFilename = 'example.ptxas';
- this.asm = new AsmParserSass();
+ this.asm = new SassAsmParser();
}
parsePtxOutput(lines, inputFilename, pathPrefix) {
@@ -74,7 +75,7 @@ class PtxAssembler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Base;
+ return BaseParser;
}
optionsForFilter(filters) {
@@ -118,5 +119,3 @@ class PtxAssembler extends BaseCompiler {
return result;
}
}
-
-module.exports = PtxAssembler;
diff --git a/lib/compilers/python.js b/lib/compilers/python.js
index 843024552..4afd6acd5 100644
--- a/lib/compilers/python.js
+++ b/lib/compilers/python.js
@@ -22,11 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers'),
- path = require('path');
+import { BaseCompiler } from '../base-compiler';
+import { resolvePathFromAppRoot } from '../utils';
-class PythonCompiler extends BaseCompiler {
+import { BaseParser } from './argument-parsers';
+
+export class PythonCompiler extends BaseCompiler {
static get key() { return 'python'; }
constructor(compilerInfo, env) {
@@ -68,7 +69,7 @@ class PythonCompiler extends BaseCompiler {
getDisasmScriptPath() {
const script = this.compilerProps('disasmScript');
- return script || path.resolve(__dirname, '..', '..', 'etc', 'scripts', 'dis_all.py');
+ return script || resolvePathFromAppRoot('etc', 'scripts', 'dis_all.py');
}
optionsForFilter(filters, outputFilename) {
@@ -80,8 +81,6 @@ class PythonCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Base;
+ return BaseParser;
}
}
-
-module.exports = PythonCompiler;
diff --git a/lib/compilers/rust.js b/lib/compilers/rust.js
index 9806f4275..936554ade 100644
--- a/lib/compilers/rust.js
+++ b/lib/compilers/rust.js
@@ -22,12 +22,15 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- _ = require('underscore'),
- path = require('path'),
- argumentParsers = require('./argument-parsers');
+import path from 'path';
-class RustCompiler extends BaseCompiler {
+import _ from 'underscore';
+
+import { BaseCompiler } from '../base-compiler';
+
+import { RustParser } from './argument-parsers';
+
+export class RustCompiler extends BaseCompiler {
static get key() { return 'rust'; }
constructor(info, env) {
@@ -68,12 +71,10 @@ class RustCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Rust;
+ return RustParser;
}
isCfgCompiler(/*compilerVersion*/) {
return true;
}
}
-
-module.exports = RustCompiler;
diff --git a/lib/compilers/sdcc.js b/lib/compilers/sdcc.js
index 6f1b352f3..5a23b6823 100644
--- a/lib/compilers/sdcc.js
+++ b/lib/compilers/sdcc.js
@@ -21,10 +21,10 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const
- GccCompiler = require('./gcc');
-class SdccCompiler extends GccCompiler {
+import { GCCCompiler } from './gcc';
+
+export class SdccCompiler extends GCCCompiler {
static get key() { return 'sdcc'; }
optionsForFilter(filters, outputFilename) {
@@ -33,5 +33,3 @@ class SdccCompiler extends GccCompiler {
return options;
}
}
-
-module.exports = SdccCompiler;
diff --git a/lib/compilers/swift.js b/lib/compilers/swift.js
index f1fa0137c..2951169bc 100644
--- a/lib/compilers/swift.js
+++ b/lib/compilers/swift.js
@@ -22,10 +22,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- argumentParsers = require('./argument-parsers');
+import { BaseCompiler } from '../base-compiler';
-class SwiftCompiler extends BaseCompiler {
+import { ClangParser } from './argument-parsers';
+
+export class SwiftCompiler extends BaseCompiler {
static get key() { return 'swift'; }
getSharedLibraryPathsAsArguments() {
@@ -33,12 +34,10 @@ class SwiftCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.Clang;
+ return ClangParser;
}
isCfgCompiler(/*compilerVersion*/) {
return true;
}
}
-
-module.exports = SwiftCompiler;
diff --git a/lib/compilers/tendra.js b/lib/compilers/tendra.js
index 2301521f7..eeafaf1b3 100644
--- a/lib/compilers/tendra.js
+++ b/lib/compilers/tendra.js
@@ -1,7 +1,6 @@
-const
- GccCompiler = require('./gcc');
+import { GCCCompiler } from './gcc';
-class TenDRACompiler extends GccCompiler {
+export class TenDRACompiler extends GCCCompiler {
static get key() { return 'tendra'; }
optionsForFilter(filters, outputFilename) {
@@ -10,5 +9,3 @@ class TenDRACompiler extends GccCompiler {
return options;
}
}
-
-module.exports = TenDRACompiler;
diff --git a/lib/compilers/win32-vc.js b/lib/compilers/win32-vc.js
index 51ed4a9c4..0fb31deaf 100644
--- a/lib/compilers/win32-vc.js
+++ b/lib/compilers/win32-vc.js
@@ -22,21 +22,20 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const Win32Compiler = require('./win32'),
- argumentParsers = require('./argument-parsers'),
- AsmParser = require('../asm-parser-vc');
+import { VcAsmParser } from '../asm-parser-vc';
-class Win32VcCompiler extends Win32Compiler {
+import { VCParser } from './argument-parsers';
+import { Win32Compiler } from './win32';
+
+export class Win32VcCompiler extends Win32Compiler {
static get key() { return 'win32-vc'; }
constructor(info, env) {
super(info, env);
- this.asm = new AsmParser(this.compilerProps);
+ this.asm = new VcAsmParser(this.compilerProps);
}
getArgumentParser() {
- return argumentParsers.VC;
+ return VCParser;
}
}
-
-module.exports = Win32VcCompiler;
diff --git a/lib/compilers/win32.js b/lib/compilers/win32.js
index cd8af33f7..91f4c4b81 100644
--- a/lib/compilers/win32.js
+++ b/lib/compilers/win32.js
@@ -22,16 +22,16 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-'use strict';
+import path from 'path';
-const BaseCompiler = require('../base-compiler'),
- temp = require('temp'),
- path = require('path'),
- _ = require('underscore'),
- PELabelReconstructor = require('../pe32-support').labelReconstructor,
- MapFileReaderVS = require('../map-file-vs').MapFileReader;
+import temp from 'temp';
+import _ from 'underscore';
-class Win32Compiler extends BaseCompiler {
+import { BaseCompiler } from '../base-compiler';
+import { MapFileReaderVS } from '../map-file-vs';
+import { PELabelReconstructor } from '../pe32-support';
+
+export class Win32Compiler extends BaseCompiler {
static get key() { return 'win32'; }
newTempDir() {
@@ -171,5 +171,3 @@ class Win32Compiler extends BaseCompiler {
return super.exec(compiler, args, options);
}
}
-
-module.exports = Win32Compiler;
diff --git a/lib/compilers/wine-vc.js b/lib/compilers/wine-vc.js
index 16cb02a63..2e77a713b 100644
--- a/lib/compilers/wine-vc.js
+++ b/lib/compilers/wine-vc.js
@@ -22,20 +22,22 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- AsmParser = require('../asm-parser-vc'),
- argumentParsers = require('./argument-parsers'),
- path = require('path'),
- PELabelReconstructor = require('../pe32-support').labelReconstructor,
- MapFileReaderVS = require('../map-file-vs').MapFileReader;
-
-class WineVcCompiler extends BaseCompiler {
+import path from 'path';
+
+import { VcAsmParser } from '../asm-parser-vc';
+import { BaseCompiler } from '../base-compiler';
+import { MapFileReaderVS } from '../map-file-vs';
+import { PELabelReconstructor } from '../pe32-support';
+
+import { VCParser } from './argument-parsers';
+
+export class WineVcCompiler extends BaseCompiler {
static get key() { return 'wine-vc'; }
constructor(info, env) {
info.supportsFiltersInBinary = true;
super(info, env);
- this.asm = new AsmParser();
+ this.asm = new VcAsmParser();
}
filename(fn) {
@@ -53,7 +55,7 @@ class WineVcCompiler extends BaseCompiler {
}
getArgumentParser() {
- return argumentParsers.VC;
+ return VCParser;
}
getExecutableFilename(dirPath, outputFilebase) {
@@ -111,5 +113,3 @@ class WineVcCompiler extends BaseCompiler {
}
}
}
-
-module.exports = WineVcCompiler;
diff --git a/lib/compilers/wsl-vc.js b/lib/compilers/wsl-vc.js
index d78219d18..1576f7653 100644
--- a/lib/compilers/wsl-vc.js
+++ b/lib/compilers/wsl-vc.js
@@ -22,21 +22,23 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-
// The main difference from wine-vc.js is that we translate
// compiler path from Unix mounted volume (/mnt/c/tmp) to Windows (c:/tmp)
-const Win32VcCompiler = require('./win32-vc'),
- AsmParser = require('../asm-parser-vc'),
- path = require('path'),
- temp = require('temp');
+import path from 'path';
+
+import temp from 'temp';
+
+import { VcAsmParser } from '../asm-parser-vc';
-class WslVcCompiler extends Win32VcCompiler {
+import { Win32VcCompiler } from './win32-vc';
+
+export class WslVcCompiler extends Win32VcCompiler {
static get key() { return 'wsl-vc'; }
constructor(info, env) {
super(info, env);
- this.asm = new AsmParser();
+ this.asm = new VcAsmParser();
}
filename(fn) {
@@ -92,5 +94,3 @@ class WslVcCompiler extends Win32VcCompiler {
return super.runCompiler(compiler, options, inputFilename, execOptions);
}
}
-
-module.exports = WslVcCompiler;
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js
index c7d2bb4a7..35115581b 100644
--- a/lib/compilers/zig.js
+++ b/lib/compilers/zig.js
@@ -22,12 +22,14 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-const BaseCompiler = require('../base-compiler'),
- _ = require('underscore'),
- path = require('path'),
- Semver = require('semver');
+import path from 'path';
-class ZigCompiler extends BaseCompiler {
+import Semver from 'semver';
+import _ from 'underscore';
+
+import { BaseCompiler } from '../base-compiler';
+
+export class ZigCompiler extends BaseCompiler {
static get key() { return 'zig'; }
constructor(info, env) {
@@ -102,5 +104,3 @@ class ZigCompiler extends BaseCompiler {
return true;
}
}
-
-module.exports = ZigCompiler;