-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: Add import meta #141
Conversation
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.
Awesome this is an important feature! Thanks for opening an issue and trying to tackle it. Parsing logic looks great. Have left a couple of changes needed to make it perfect!
I was going to make a comment about looking into type checking it but it looks like you have already started! What you have nearly works just needs a few changes I have requested for it to work.
Once you have done that, could you add a simple test for import.meta
and dynamic import with and without a string expression and with and without an options object to https://github.com/kaleidawave/ezno/blob/main/parser/tests/expressions.rs
And for type checking you can add something like import.meta.x satisfies number
and show it throws a type error like Expected number, found string | undefined
to here: https://github.com/kaleidawave/ezno/blob/main/checker/specification/specification.md#imports-and-exports
If you are busy then LMK and I can do it. Otherwise once those changes have been made and tests added for them it should be good to merge!
} else { | ||
None | ||
}; | ||
let end = reader.expect_next(TSXToken::CloseParentheses)?; |
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.
👍 😄
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.
👍
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.
Thanks for review my contribution, your feedback and suggestions are so clear. I'm working on. |
…st line and add `import.meta` type tests
All is working, just
Ignoring the fuzzing issue which is from separate I was working on. Everything is good to go. Thanks for the change! |
This Fixes #140.
In this pr is implemented the expression
import.meta
in parser and checker. Also fix some parsing errors related to dynamic import.Primary features
import.meta
is setted to typeImportMeta
.import.meta.env
is setted to typeImportEnv
.Secondary fix
Before, dynamic import was searching OpenParentheses instead of CloseParentheses.
Before, dynamic import search for string literals, but do nothing in other cases.
After, dynamic import throws error if encounter another thing