Skip to content
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 iteration and other events related things #187

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

kaleidawave
Copy link
Owner

@kaleidawave kaleidawave commented Aug 8, 2024

  • Add basic destructuring into array declaration based on iterator protocol object
  • Symbols -> Symbol
  • Adds Accumulator, a structure for handling returns state (sort of control flow graph, but not really)
  • Adds --basic flag that basically turns off event application (in an attempt to simplify)
  • Add loop unrolling inside of event application. This enables Array.prototype.contains narrowing for arrays with known members and length
  • Basic TypeScript enum support
  • Map.prototype.get and Map.prototype.set constant functionality

TODO

  • Destructuring assignment for declarations
  • for of
  • Generators
  • Promises
  • Length calculation
  • Spreads
  • Array.prototype[Symbol.iterator]
  • More testing on actual codebases
  • More array methods working on unknown
  • Array.prototype.filter narrowing and possibly Map?
  • Map item checking
  • Maybe more RegExp narrowing
  • More unknown object stuff (examples in staging.md)

- Add basic destructuring into array declaration based on iterator protocol object
@kaleidawave kaleidawave added enhancement New feature or request checking Issues around checking labels Aug 9, 2024
- `var` in for loop treat as `let`
- Allow `function` after `return`
- Change `examples.yml` to not short-circuit (hopefully)
- Fix class hoisting issues
- Move some things in specification.md
- Change some things around `max_inline`
- Fix printing flush issue in reporting in CLI
@kaleidawave kaleidawave changed the title Add iteration and related Add iteration and other events related things Aug 27, 2024
None
} else {

let should_create_dependent_output = !types
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lemueldls found the fix for function newRegExp(name: string) { return new RegExp(name) }. Turns out for new RegExp with some non-constant string it creates a new object with regexp prototype (bc it is a constructor), which I think is fine. But the problem is because it is just an object, it is considered constant and so didn't generate a non-constant result for the function call. Now fixed by changing adding this condition to account for the edge case.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cool to get String.prototype.match and String.prototype.matchAll etc working but need to do some investigation into all the oddities of the Symbol.match stuff

Also just sent you an invite to the contributor and sponsor repository that contains the LSP if you want to try it out (like I did earlier. Repository here https://github.com/eznolab/super-ezno-and-lsp

- Use for return state
- Move return state from LocalInformation -> Syntax
- Add parseFloat
- Iteration parts broken
- Default value side effect broken
- Still things in staging
- Enables `contains` narrowing
- Implementation is a little spaghetti but sorta makes sense!
- Fix merge problems
- Fix clippy
@kaleidawave
Copy link
Owner Author

Would love to merge some of the improvements now (for the release) but unfortunately I think a lot more could be done on this. I have tested this a bit on some projects and unfortunately while there are improvements it doesn't quite completely clear some event / control flow issues.

There are a few issues with the parent field handling on SubstitutionArguments but unfortunately the changes caused a bunch of regressions.

- Change SubstitutionArguments
- `contains` -> `includes` 🤦‍♂️
- Formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checking Issues around checking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant