Add ES2020 string export/import name support#1188
Add ES2020 string export/import name support#1188bnoordhuis merged 5 commits intoquickjs-ng:masterfrom
Conversation
support for ES2020 arbitrary module namespace identifier names, which allows
using string literals as export/import names.
Examples:
```js
export { foo as "string-name" }
import { "string-name" as foo }
export * as "string-name" from "./mod.js"
```
|
Nice! Do you know if test262 covers this? Great that you added a test btw! |
|
Yes, I believe they're all under the |
|
Can you enable the feature so we start testing it? I'd say partial support is ok, just check in the failures so we can track them. |
Added another export case, export name as string:
```js
export { "☿" } from ...
```
|
There are now 3 cases failing, but they're all error cases that should return an error. Two are related to erroring on invalid unicode. I couldn't find an example of making sure a |
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM module some style comments.
| js_parse_error(s, "identifier or string expected"); | ||
| return -1; |
There was a problem hiding this comment.
Can be condensed to (here and elsewhere):
| js_parse_error(s, "identifier or string expected"); | |
| return -1; | |
| return js_parse_error(s, "identifier or string expected"); |
|
Thanks, Karl! |
support for ES2020 arbitrary module namespace identifier names, which allows using string literals as export/import names.
Examples:
See https://tc39.es/ecma262/#prod-ModuleExportName