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.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index ded9bf0a9..a60920892 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -33,20 +33,23 @@ function compilenewgol(info, env) {
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;
return code.map(function (obj) {
var line = obj.text;
var match = line.match(re);
if (match) {
var res = "";
- if (file === null) {
- res += "\t.file 1 \"" + match[2] + "\"\n";
- file = match[1];
+ if (file !== match[2]) {
+ res += "\t.file " + fileCount + ' "' + match[2] + '"\n';
+ file = match[2];
+ fileCount++;
}
if (prevLine !== match[3]) {
- res += "\t.loc 1 " + match[3] + "\n";
+ res += "\t.loc " + fileCount + " " + match[3] + " 0\n";
prevLine = match[3];
}
- return res + "\t" + match[4].toLowerCase() + match[5];
+ var ret = res + "\t" + match[4].toLowerCase() + match[5];
+ return ret;
} else
return null;
}).filter(_.identity).join("\n");