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.js29
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index b550ee0d6..776461d04 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -22,34 +22,33 @@
// 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 _ = require('underscore-node');
+const Compile = require('../base-compiler'),
+ _ = require('underscore-node');
function compilenewgol(info, env, langId) {
- var compiler = new Compile(info, env, langId);
+ const compiler = new Compile(info, env, langId);
compiler.originalGetDefaultExecOptions = compiler.getDefaultExecOptions;
function convertNewGoL(code) {
- var re = /^\s+(0[xX]?[0-9A-Za-z]+)?\s?[0-9]+\s*\(([^:]+):([0-9]+)\)\s*([A-Z]+)(.*)/;
- var prevLine = null;
- var file = null;
- var fileCount = 1;
+ const re = /^\s+(0[xX]?[0-9A-Za-z]+)?\s?[0-9]+\s*\(([^:]+):([0-9]+)\)\s*([A-Z]+)(.*)/;
+ let prevLine = null;
+ let file = null;
+ let fileCount = 0;
return code.map(function (obj) {
- var line = obj.text;
- var match = line.match(re);
+ const line = obj.text;
+ const match = line.match(re);
if (match) {
- var res = "";
+ let res = "";
if (file !== match[2]) {
+ fileCount++;
res += "\t.file " + fileCount + ' "' + match[2] + '"\n';
file = match[2];
- fileCount++;
}
if (prevLine !== match[3]) {
res += "\t.loc " + fileCount + " " + match[3] + " 0\n";
prevLine = match[3];
}
- var ret = res + "\t" + match[4].toLowerCase() + match[5];
- return ret;
+ return res + "\t" + match[4].toLowerCase() + match[5];
} else
return null;
}).filter(_.identity).join("\n");
@@ -70,8 +69,8 @@ function compilenewgol(info, env, langId) {
};
compiler.getDefaultExecOptions = function () {
- var execOptions = this.originalGetDefaultExecOptions();
- var goroot = this.compilerProps("compiler." + this.compiler.id + ".goroot");
+ const execOptions = this.originalGetDefaultExecOptions();
+ const goroot = this.compilerProps("compiler." + this.compiler.id + ".goroot");
if (goroot) {
execOptions.env.GOROOT = goroot;
}