diff options
author | Partouf <partouf@gmail.com> | 2018-04-17 19:05:55 +0200 |
---|---|---|
committer | Partouf <partouf@gmail.com> | 2018-04-17 19:05:55 +0200 |
commit | 22a87bcc67551cb8b566268470e118ad53155196 (patch) | |
tree | 2d1fa9f511acdd519ed1a4ee332e280730907c3b /lib/compilers/golang.js | |
parent | b378b4e5f655b17d2d93deb34f4540866aab3896 (diff) | |
download | compiler-explorer-22a87bcc67551cb8b566268470e118ad53155196.tar.gz compiler-explorer-22a87bcc67551cb8b566268470e118ad53155196.zip |
fix unknown source lines in GO asm output
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r-- | lib/compilers/golang.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js index 46c2b2ac9..e4b10dff8 100644 --- a/lib/compilers/golang.js +++ b/lib/compilers/golang.js @@ -28,12 +28,13 @@ const BaseCompiler = require('../base-compiler'), class GolangCompiler extends BaseCompiler { convertNewGoL(code) { const re = /^\s+(0[xX]?[0-9A-Za-z]+)?\s?[0-9]+\s*\(([^:]+):([0-9]+)\)\s*([A-Z]+)(.*)/; + const reUnknown = /^\s+(0[xX]?[0-9A-Za-z]+)?\s?[0-9]+\s*\(<unknown line number>)\s*([A-Z]+)(.*)/; let prevLine = null; let file = null; let fileCount = 0; return _.compact(code.map(obj => { const line = obj.text; - const match = line.match(re); + let match = line.match(re); if (match) { let res = ""; if (file !== match[2]) { @@ -46,8 +47,15 @@ class GolangCompiler extends BaseCompiler { prevLine = match[3]; } return res + "\t" + match[4].toLowerCase() + match[5]; - } else - return null; + } else { + match = line.match(reUnknown); + if (match) { + return "\t" + match[2].toLowerCase() + match[3]; + } else { + return null; + } + } + })).join("\n"); } |