-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Exception message for assert(0) depends on whitespace #30872
Comments
@AndrewFinlay thank you for the report. This should indeed not fail to create the better error message. |
The left curly bracket without a line break before try { assert(0)
} catch (err) {}
function test() { assert(0)
} It looks like the expression parse is intentionally started at the line start. Modifying it from start to the actual offset seems to fix these cases, but not sure if it breaks others. Lines 235 to 239 in 7629fb2
// line 235
-let start = 0
+let start = offset |
@pd4d10 no Lines 239 to 242 in 7629fb2
node = parseExpressionAt(code, start, { ecmaVersion: 11 }); this line will throw error with message
|
and this
|
@himself65 @pd4d10 is correct about that. The start is set to zero to include I am currently looking into it (there is an easy solution but that would waste a lot of CPU time, so I am trying to find a proper fix). |
Fixes: #30872 PR-URL: #46760 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
Fixes: #30872 PR-URL: #46760 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
Fixes: #30872 PR-URL: #46760 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
Fixes: #30872 PR-URL: #46760 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
Under Node 10 and Node 12, generating an exception from an assertion failure returns a different assertion failure message depending on differences in whitespace. It seems that with a certain whitespace configuration we see the Node 8 assertion failure message
0 == true
, other configurations will generate the Node 10 messageThe expression evaluated to a falsy value
. This issue only seems to affect the exception message, all other behaviour seems consistent.This will affect anything that runs minified source.
I have included a simple reproduction of the issue here
The text was updated successfully, but these errors were encountered: