We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
acornjs不支持ES2018对象扩展方式:示例 const A = {a: 1, b:2}; const B = { ...A, c:3}; 以上通过acornjs检测报语法错误
The text was updated successfully, but these errors were encountered:
Sorry, this is not enough to go on without a repro sample we could run.
Also, please raise an issue in English - none of the maintainers speak Chinese, and automatic translation might lead to misunderstandings.
Sorry, something went wrong.
const acorn = require('acorn'); const code = `
// Unexpected token (ES2018 spread object ) const A = {a:1, b:2}; const A1 = {...A, c:6}; // correct (ES2018 spread array) const C = [1,2,3]; const D = [4,5,6]; const C1 = [...C, ...D];
`; try { acorn.parse(code, { sourceType: 'script', ecmaVersion: '8', locations: true, allowReserved: true }); return true; } catch (ex) { const len = 30; console.log('...' + code.substr(ex.pos - len, len * 2) + '...'); console.log(new Array(len + 3).join('-') + '^'); console.log(ex.message); return false; }
// Run all of the above code and get the Unexpected token, but the correct thing to do is not to output anything, thanks
ecmaVersion: '8',
This needs to be 2018 not 8 if you want to use ES2018.
2018
8
No branches or pull requests
acornjs不支持ES2018对象扩展方式:示例
const A = {a: 1, b:2};
const B = { ...A, c:3};
以上通过acornjs检测报语法错误
The text was updated successfully, but these errors were encountered: