jquery / esprima

ECMAScript parsing infrastructure for multipurpose analysis
http://esprima.org
BSD 2-Clause "Simplified" License
7.04k stars 786 forks source link

import('aa.js') not supported #2075

Open jogibear9988 opened 3 years ago

jogibear9988 commented 3 years ago

I've done a fix for this in esprima.net https://github.com/sebastienros/esprima-dotnet/pull/154/commits/272dd32541fb8202e76f9157cbf741bb138921b0

jogibear9988 commented 3 years ago

fix : https://github.com/jquery/esprima/pull/2076

ariya commented 3 years ago

Hi @jogibear9988, thanks for the report and the fix! For our future reference, this likely needs a reference to the specification, as well as some tests.

jogibear9988 commented 3 years ago

there are already tests for "import(xxx)"

jogibear9988 commented 3 years ago

spec: https://github.com/estree/estree/blob/master/es2020.md#importexpression

jogibear9988 commented 3 years ago

for example here: https://github.com/jquery/esprima/blob/main/test/fixtures/es2018/dynamic-import/await-import.js

jogibear9988 commented 3 years ago

my fix has one problem:

import('a','b') is no error (but it should be). but I don't know how this should be fixed atm. I'm not deep enough into esprima

jogibear9988 commented 3 years ago

the import('a', 'b') is now also fixed that it would fail.