-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect column number in stack traces repro #236
Comments
case '\n':
p++;
line_terminator:
s->eol = &p[-1];
s->mark = p;
case ' ':
case '\t':
s->mark = ++p;
goto redo; case '/':
if (p[1] == '*') {
/* comment */
// ...
s->mark = p; it will work in most case, since human typed sources always have proper whitespace in set, but in your case, there is no whitespace between if (typeof print === 'undefined') globalThis.print = console.log;
function r(){return e()}function e(){return new Error("bad")}print( r().stack) then you will get a more reasonable error stack:
|
I had a quick look and I think there are two things going on here, one simple, one less so:
Likely the best solution to (2) is to emit source locations explicitly instead of having them created implicitly. Onerous but gives the most control. 1 I'm taking some creative liberties here. It's literally true for the first two parse phases but in the final phase they're stripped from the bytecode and stored in a side table. |
Running minified code, I'm seeing incorrect column number on the generated stack trace, leading to source maps being incorrect traced. Example:
In quickjs:
Compared to Node.js:
Notes:
new
, QuickJS starts atError
. This might be OK, but I figured I'd note the difference.r()
function is invoked.Not clear to me, but maybe this is related to #232?
The text was updated successfully, but these errors were encountered: