aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/nim.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/nim.js')
-rw-r--r--lib/compilers/nim.js39
1 files changed, 14 insertions, 25 deletions
diff --git a/lib/compilers/nim.js b/lib/compilers/nim.js
index 5d24bb923..215a1d1d7 100644
--- a/lib/compilers/nim.js
+++ b/lib/compilers/nim.js
@@ -27,20 +27,16 @@ import path from 'path';
import fs from 'fs-extra';
import _ from 'underscore';
-import { BaseCompiler } from '../base-compiler';
+import {BaseCompiler} from '../base-compiler';
-import { NimParser } from './argument-parsers';
+import {NimParser} from './argument-parsers';
-const NimCommands = [
- 'compile', 'compileToC', 'c',
- 'compileToCpp', 'cpp', 'cc',
- 'compileToOC', 'objc',
- 'js',
- 'check',
-];
+const NimCommands = ['compile', 'compileToC', 'c', 'compileToCpp', 'cpp', 'cc', 'compileToOC', 'objc', 'js', 'check'];
export class NimCompiler extends BaseCompiler {
- static get key() { return 'nim'; }
+ static get key() {
+ return 'nim';
+ }
constructor(info, env) {
super(info, env);
@@ -74,24 +70,18 @@ export class NimCompiler extends BaseCompiler {
isCpp = ['compileToCpp', 'cpp', 'cc'],
isObjC = ['compileToOC', 'objc'];
- if (isC.includes(command))
- return '.c.o';
- else if (isCpp.includes(command))
- return '.cpp.o';
- else if (isObjC.includes(command))
- return '.m.o';
- else
- return null;
+ if (isC.includes(command)) return '.c.o';
+ else if (isCpp.includes(command)) return '.cpp.o';
+ else if (isObjC.includes(command)) return '.m.o';
+ else return null;
}
getCacheFile(options, inputFilename, cacheDir) {
const commandsInOptions = _.intersection(options, NimCommands);
- if (commandsInOptions.length === 0)
- return null;
+ if (commandsInOptions.length === 0) return null;
const command = commandsInOptions[0];
const extension = this.expectedExtensionFromCommand(command);
- if (!extension)
- return null;
+ if (!extension) return null;
const moduleName = path.basename(inputFilename);
const resultName = '@m' + moduleName + extension;
return path.join(cacheDir, resultName);
@@ -101,8 +91,7 @@ export class NimCompiler extends BaseCompiler {
const options = result.compilationOptions;
const cacheDir = this.cacheDir(outputFilename);
try {
- if (_.intersection(options, ['js', 'check']).length > 0)
- filters.binary = false;
+ if (_.intersection(options, ['js', 'check']).length > 0) filters.binary = false;
else {
filters.binary = true;
const objFile = this.getCacheFile(options, result.inputFilename, cacheDir);
@@ -134,7 +123,7 @@ export class NimCompiler extends BaseCompiler {
libLinks,
userOptions,
[this.filename(inputFilename)],
- staticLibLinks,
+ staticLibLinks
);
}
}