kaleidawave / ezno

A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.3k stars 42 forks source link

feat: Add import meta #141

Closed Brayan-724 closed 1 month ago

Brayan-724 commented 1 month ago

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 type ImportMeta. import.meta.env is setted to type ImportEnv.

Secondary fix

Before, dynamic import was searching OpenParentheses instead of CloseParentheses.

const _ = import("file");
                       ^ Expected OpenParentheses, ...

Before, dynamic import search for string literals, but do nothing in other cases. After, dynamic import throws error if encounter another thing

This opens an issue. Limit dynamic import to string literals, no variables or expressions

Brayan-724 commented 1 month ago

Thanks for review my contribution, your feedback and suggestions are so clear. I'm working on.

kaleidawave commented 1 month ago

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!