aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-12 08:47:49 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-12 08:47:49 -0800
commit57b8e5a49801661495b14ddc33c4775c7844e174 (patch)
tree483222e08fbada0e2b4aadeb42e53994375ab059
parent1b031e02d33baa0889f906b7c1ec2f04fabe16d5 (diff)
ignore first L when demangling, literalness is irrelevant to the main name
-rw-r--r--src/preamble.js4
-rw-r--r--tests/test_other.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e552f782..27016c14 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -709,6 +709,7 @@ function demangle(func) {
i++; // skip E
return parts;
}
+ var first = true;
function parse(rawList, limit, allowVoid) { // main parser
limit = limit || Infinity;
var ret = '', list = [];
@@ -723,7 +724,7 @@ function demangle(func) {
if (limit === 0) return rawList ? [name] : name;
} else {
// not namespaced
- if (func[i] === 'K') i++; // ignore const
+ if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L'
var size = parseInt(func.substr(i));
if (size) {
var pre = size.toString().length;
@@ -731,6 +732,7 @@ function demangle(func) {
i += pre + size;
}
}
+ first = false;
if (func[i] === 'I') {
i++;
var iList = parse(true);
diff --git a/tests/test_other.py b/tests/test_other.py
index a2a1448f..3a781042 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1927,6 +1927,7 @@ done.
EM_ASM(Module.print(demangle('_main')));
EM_ASM(Module.print(demangle('__Z2f2v')));
EM_ASM(Module.print(demangle('__Z12abcdabcdabcdi')));
+ EM_ASM(Module.print(demangle('__ZL12abcdabcdabcdi')));
EM_ASM(Module.print(demangle('__Z4testcsifdPvPiPc')));
EM_ASM(Module.print(demangle('__ZN4test5moarrEcslfdPvPiPc')));
EM_ASM(Module.print(demangle('__ZN4Waka1f12a234123412345pointEv')));
@@ -1949,6 +1950,7 @@ done.
_main
f2()
abcdabcdabcd(int)
+abcdabcdabcd(int)
test(char, short, int, float, double, void*, int*, char*)
test::moarr(char, short, long, float, double, void*, int*, char*)
Waka::f::a23412341234::point()