diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-19 16:01:09 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-19 16:01:09 -0700 |
commit | e59bfd4f6cd7afe39411e34b65a161b09ccbbedf (patch) | |
tree | c494770db32f5bf61d6e1e5aa3e30a197b0269df /src/analyzer.js | |
parent | b5550f0d6fc6980e1d841ba4d318139481583810 (diff) |
simplify and correct the logic for falling back to the entry ident when an invalid label id shows up; fixes #1399
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index de9a7940..1d32d7fc 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1433,15 +1433,14 @@ function analyzer(data, sidePass) { func.labelsDict = {}; func.labelIds = {}; func.labelIdsInverse = {}; - func.labelIds[toNiceIdent('%0')] = 1; - func.labelIdsInverse[0] = toNiceIdent('%0'); - func.labelIdCounter = 2; + func.labelIdCounter = 1; func.labels.forEach(function(label) { if (!(label.ident in func.labelIds)) { func.labelIds[label.ident] = func.labelIdCounter++; func.labelIdsInverse[func.labelIdCounter-1] = label.ident; } }); + var entryIdent = func.labels[0].ident; // Minify label ids to numeric ids. func.labels.forEach(function(label) { @@ -1478,7 +1477,7 @@ function analyzer(data, sidePass) { function getActualLabelId(labelId) { if (func.labelsDict[labelId]) return labelId; // If not present, it must be a surprisingly-named entry (or undefined behavior, in which case, still ok to use the entry) - labelId = func.labelIds[ENTRY_IDENT]; + labelId = func.labelIds[entryIdent]; assert(func.labelsDict[labelId]); return labelId; } |