Open aralroca opened 4 weeks ago
c2 is a ParserState in meriyah, not a function.
bun 1.1.30 doesn't have this bug.
Comparing to output of bun 1.1.30:
case 67174411:
return function(e2, n2, o3, r2, a3, i3, s2, l3, c3) {
e2.flags = 128 ^ (128 | e2.flags);
const { tokenIndex: u3, tokenLine: d3, tokenColumn: g3 } = e2;
J(e2, 67117056 | n2);
const k2 = 16 & n2 ? ue({ parent: undefined, type: 2 }, 1024) : undefined;
if (n2 = 33554432 ^ (33554432 | n2), Q(e2, n2, 16))
return yn(e2, n2, k2, o3, [], r2, 0, s2, l3, c3);
Note it uses e2 here, and the function call is yn(...
, not e2(...
.
yn
is a function defined in outer (global) scope.
function yn(e, n, o2, r2, a2, i2, s, l2, c2, u2) {
i2 || t(e, 57);
for (let n2 = 0;n2 < a2.length; ++n2)
ne(e, a2[n2]);
return Cn(e, n, o2, r2, a2, s, l2, c2, u2);
}
So this is a reference collision issue. The latest bun bundler somehow didn't realise reference c2
is already defined in outer scope, and it re-defined c2
in that local function scope.
What version of Bun is running?
1.1.31-canary.53+5532e1af1
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
Reproduce it: way 1
I am getting this error when parsing this code with meriyah
6.0.2
, but the problem only comes after build all the client code withBun.build
, using meriyah without build, is working fine.Error from meriyah library after build with this code:
Reproduce it: way 2
This code is used in our Playground, so it is used in the client. So it is easy to reproduce it with these steps:
localhost:3000/playground
What is the expected behavior?
that the meriyah library would work after the build process.
What do you see instead?
Library error (but comes after build with Bun)
Additional information
At first, I thought it was a bug in our parser (meriyah) and reported it here: https://github.com/meriyah/meriyah/issues/344 . Then we realized that it happened after the meriyah build process by Bun build.