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

gen: reduce hardcoded JS for some compiler-magic features #23

Open
5 tasks
serkonda7 opened this issue May 9, 2023 · 0 comments
Open
5 tasks

gen: reduce hardcoded JS for some compiler-magic features #23

serkonda7 opened this issue May 9, 2023 · 0 comments
Milestone

Comments

@serkonda7
Copy link
Member

serkonda7 commented May 9, 2023

Describe the feature

As of writing. the following places in jsgen have lot's of JS hardcoded in strings:

  • for_in_loop
  • for_in_map
  • assert_stmt
  • gen_test_main
  • The whole file lib/bait/gen/js/str_methods.bt

This is prone to misspellings and errors if things are moved, renamed, etc.

Proposed Solution

The JS in strings should where possible be removed.
Instead in the parser or checker stage manipulate the AST and insert exprs or stmts that will lead to the generation of equivalent code utilizing the normal jsgen methods.

Additional Information

For example in the parser script_mode_main artificially inserts a FunDecl.

serkonda7 pushed a commit that referenced this issue May 9, 2023
serkonda7 added a commit that referenced this issue May 9, 2023
@serkonda7 serkonda7 added this to the Backlog milestone May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant