Skip to content

feat: repl command #323

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

Merged
merged 4 commits into from
Jul 18, 2024
Merged

feat: repl command #323

merged 4 commits into from
Jul 18, 2024

Conversation

load1n9
Copy link
Member

@load1n9 load1n9 commented Jul 17, 2024

No description provided.

andreubotella
andreubotella previously approved these changes Jul 17, 2024
Copy link
Collaborator

@andreubotella andreubotella left a comment

Choose a reason for hiding this comment

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

LGTM. This wouldn't properly handle let or const variable definitions, because each line runs in its own script. But this is good for a start and can be tweaked later.

@load1n9 load1n9 changed the title feat(WIP): repl command feat: repl command Jul 18, 2024
@load1n9 load1n9 requested a review from andreubotella July 18, 2024 08:31
@load1n9 load1n9 requested review from aapoalas and removed request for andreubotella July 18, 2024 08:32
Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

LGTM!

@aapoalas aapoalas merged commit fac6484 into trynova:main Jul 18, 2024
1 check passed
andreubotella added a commit to andreubotella/nova that referenced this pull request Jul 21, 2024
In order to add a repl to the cli, trynova#323 moved the
`initialize_global_object` and `exit_with_parse_errors` functions into
a new `helper` module. However, this still left duplicate code between
the `eval` and `repl` commands.

This patch moves the isolate and realm initialization, as well as the
script execution and microtask checkpoint, to a new `CliRunner` struct
that lives in the `helper` module.

Aside from just refactoring, this patch makes two visible changes
related to promise jobs:
  - When passing multiple files to `eval`, now promise jobs run after
    each script execution, rather than at the end.
  - In `repl` mode it used to be that promise jobs were never run.
    Now, all promise jobs enqueued when running a line of JS are run
    before the result is printed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants