-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fix 9068 newlines emcc error #9088
Fix 9068 newlines emcc error #9088
Conversation
…s on Windows This fixes a patch applied to acorn.js for quoting error-causing text in parse errors (acornjs/acorn#793). Previously it splitted binary data on \n to get lines, which was inconsistent with the rest of the parser and caused excess \r in the error message on Windows. Now it uses the same regex as the rest of acorn.js (e.g. getLineInfo used by error reporting).
@@ -2769,7 +2769,7 @@ pp$4.raise = function(pos, message) { | |||
message += " (" + loc.line + ":" + loc.column + ")"; | |||
// XXX EMSCRIPTEN: add a quote of the error text, point to where | |||
// https://github.com/acornjs/acorn/pull/793 | |||
var lines = this.input.split('\n'); | |||
var lines = this.input.split(lineBreak); | |||
message = message + '\n' + lines[loc.line - 1] + '\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this \n
goes to the error message string, which is later displayed by Node exception handler. Hence, it's a usual string, not bytes, newlines are transformed automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that was remarkably simple! Thanks! @kripken do you have any worries about modifying acorn.js like this?
Great find @yeputons! This is totally my fault - this is the local patch we have for acorn. I should have noticed they have a |
* Fix emscripten-core#9068: get rid of malformed newlines in emcc errors on Windows This fixes a patch applied to acorn.js for quoting error-causing text in parse errors (acornjs/acorn#793). Previously it splitted binary data on \n to get lines, which was inconsistent with the rest of the parser and caused excess \r in the error message on Windows. Now it uses the same regex as the rest of acorn.js (e.g. getLineInfo used by error reporting). * Fix emscripten-core#9057 by fixing by emscripten-core#9068
This fixes a patch applied to
acorn.js
for quoting error-causing text in parse errors (acornjs/acorn#793). Previously it splitted binary data on\n
to get lines, which was inconsistent with the rest of the parser and caused excess\r
in the error message on Windows, which caused #9057. Now it uses the same regex as the rest of acorn.js (e.g.getLineInfo
used by error reporting).It also fixes #9057 automatically, hence I enabled corresponding test and removed unnecessary change from #9052.
Tests ran on Windows: