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

Add checking for basic loops (while, for with condition, ...) #95

Closed kaleidawave closed 6 months ago

kaleidawave commented 7 months ago

Fixes #73

To implement

kaleidawave commented 6 months ago

Realised that a the unknown updates after a loop that dependent on a poly type is the same problem as #60 . So need to do some more thinking about how to tackle that

kaleidawave commented 6 months ago

For of will require symbols as well...

kaleidawave commented 6 months ago

👑 image

(also made some progress on #60)

Still some more to do though

kaleidawave commented 6 months ago

Should be just for of and for in left to do, as well as some more tests

kaleidawave commented 6 months ago

Think this is okay to merge. Up to 129 specification tests passing now !!

IMPORTANT: This PR does not implement for in and for of. There is some technicalities (symbols, non constant objects etc) to resolve that would cause this PR to go on forever. So going to implement them after taking a break from iteration code.

Also although Array methods .map, .filter, .includes do work, they are a bit flaky and I don't think they should be default while both the binary types and event cache is still out and #74 doesn't work for function arguments. So leaving them out for now.

Added more constant functions, which should be useful for debugging.