diff options
author | Rubén <RabsRincon@users.noreply.github.com> | 2017-12-19 17:19:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 17:19:47 +0100 |
commit | e4ef9cf303c6605b73d5a07dc4432353271de5b5 (patch) | |
tree | 3e9b1b3862023014f0062ca46329917bd7718446 /lib/compilers/golang.js | |
parent | f1f5bafc4d5bf89ce4083de643b4c7055196a3aa (diff) | |
parent | 6e7e30bf4988958664a7c713053c4203dd6caf74 (diff) | |
download | compiler-explorer-e4ef9cf303c6605b73d5a07dc4432353271de5b5.tar.gz compiler-explorer-e4ef9cf303c6605b73d5a07dc4432353271de5b5.zip |
Merge branch 'master' into unification
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r-- | lib/compilers/golang.js | 29 |
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; } |