- 
                Notifications
    
You must be signed in to change notification settings  - Fork 212
 
Add ES2020 string export/import name support #1188
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
Add ES2020 string export/import name support #1188
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   | 
    
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.
LGTM module some style comments.
        
          
                quickjs.c
              
                Outdated
          
        
      | js_parse_error(s, "identifier or string expected"); | ||
| return -1; | 
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.
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