Skip to content

Commit

Permalink
Bump Acorn JS version to ES2018 (#11435)
Browse files Browse the repository at this point in the history
We set the version to 6 (2015) when we added Acorn, probably to
keep it as close as possible to the old pre-Acorn parser. But the
default in our version is 9 (2018) so we may as well switch to that,
and that fixes #11431 (8 - 2017 - would have been enough for
that specific bug).
  • Loading branch information
kripken committed Jun 17, 2020
1 parent c884129 commit 56dc964
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8628,12 +8628,12 @@ def build():
self.assertIdentical(normal, huge)

def test_EM_ASM_ES6(self):
# check we show a proper understandable error for JS parse problems
create_test_file('src.cpp', r'''
#include <emscripten.h>
int main() {
EM_ASM({
var x = (a, b) => 5; // valid ES6!
var x = (a, b) => 5; // valid ES6
async function y() {} // valid ES2017
out('hello!');
});
}
Expand Down
3 changes: 1 addition & 2 deletions tools/acorn-optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ if (extraInfoStart > 0) {
// Collect all JS code comments to this array so that we can retain them in the outputted code
// if --closureFriendly was requested.
var sourceComments = [];
var ast = acorn.parse(input, { ecmaVersion: 6, preserveParens: closureFriendly, onComment: closureFriendly ? sourceComments : undefined });
var ast = acorn.parse(input, { ecmaVersion: 2018, preserveParens: closureFriendly, onComment: closureFriendly ? sourceComments : undefined });

var minifyWhitespace = false;
var noPrint = false;
Expand Down Expand Up @@ -1337,4 +1337,3 @@ if (!noPrint) {
});
print(output);
}

0 comments on commit 56dc964

Please sign in to comment.