aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/golang.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r--lib/compilers/golang.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index 8a3b2f393..196cf8b02 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -51,10 +51,10 @@ class GolangCompiler extends BaseCompiler {
let file = null;
let fileCount = 0;
let func = null;
- let funcCollisions = {};
- let labels = {};
- let usedLabels = {};
- let lines = code.map(obj => {
+ const funcCollisions = {};
+ const labels = {};
+ const usedLabels = {};
+ const lines = code.map(obj => {
let pcMatch = null;
let fileMatch = null;
let lineMatch = null;
@@ -132,12 +132,12 @@ class GolangCompiler extends BaseCompiler {
});
// Find unused pseudo-labels so they can be filtered out.
- let unusedLabels = _.mapObject(labels, (val, key) => { return !usedLabels[key]; });
+ const unusedLabels = _.mapObject(labels, (val, key) => !usedLabels[key]);
return _.chain(lines)
.flatten()
.compact()
- .filter((line) => { return !unusedLabels[line]; })
+ .filter(line => !unusedLabels[line])
.value()
.join("\n");
}
@@ -145,13 +145,13 @@ class GolangCompiler extends BaseCompiler {
replaceJump(func, collisions, ins, args, usedLabels) {
// Check if last argument is a decimal number.
const re = /(\s+)([0-9]+)(\s?)$/;
- let match = args.match(re);
+ const match = args.match(re);
if (!match) {
return args;
}
// Check instruction has a jump prefix
- if (_.any(jumpPrefixes, (prefix) => { return ins.startsWith(prefix); })) {
+ if (_.any(jumpPrefixes, prefix => ins.startsWith(prefix))) {
let label = `${func}_pc${match[2]}`;
if (collisions > 0) {
label += `_${collisions}`;
@@ -165,16 +165,16 @@ class GolangCompiler extends BaseCompiler {
extractLogging(stdout) {
const reLogging = /^<source>:([0-9]*):([0-9]*):\s(.*)/i;
- return stdout.filter(obj => obj.text.match(reLogging)).
- map(obj => obj.text).
- join('\n');
+ return stdout.filter(obj => obj.text.match(reLogging))
+ .map(obj => obj.text)
+ .join('\n');
}
- postProcess(result) {
+ async postProcess(result) {
const logging = this.extractLogging(result.stdout);
result.asm = this.convertNewGoL(result.stdout);
result.stdout = utils.parseOutput(logging, result.inputFilename);
- return Promise.resolve([result, ""]);
+ return [result, ""];
}
optionsForFilter(filters, outputFilename) {