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

repl: minor improvements #25731

Closed
wants to merge 4 commits into from

Conversation

BridgeAR
Copy link
Member

Please have a look at the commit messages for further descriptions. This is mainly something I stumbled upon while working on #20803.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

The completion lists used a hand crafted list of global entries that
was redundant due to also using the actual global properties for tab
completion. Those entries ended up in an separated completion group
which did not seem useful.
In case no error has occurred during the evaluation of some code,
`undefined` has been returned in some cases as error argument instead
of `null`. This is fixed by this patch.
It is checked if an command buffer exists or not. This code branch
can only be reached if non exist, so there's no need to clear that
buffer again.
The removed line does not add anything of value to the test. It was
removed to simplify the test.
@nodejs-github-bot nodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Jan 27, 2019
@BridgeAR
Copy link
Member Author

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 27, 2019
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

There's a typo in the third commit log: s/non/none/

for (const name of Object.getOwnPropertyNames(global)) {
Object.defineProperty(context, name,
Object.getOwnPropertyDescriptor(global, name));
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this really skip console like it used to? Raw V8 contexts have a (primordial) console property.

It's quite possible the answer is "it doesn't matter either way" but I thought I'd ask anyway. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not skip it. Instead, it just sets it twice. The overhead should be minimal and it's less code that way, so it seemed fine to me.

@danbev
Copy link
Contributor

danbev commented Feb 6, 2019

Landed in 3732d77, 8c12a78, f9fe037, and e3055dc.

@danbev danbev closed this Feb 6, 2019
danbev pushed a commit that referenced this pull request Feb 6, 2019
The completion lists used a hand crafted list of global entries that
was redundant due to also using the actual global properties for tab
completion. Those entries ended up in an separated completion group
which did not seem useful.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
danbev pushed a commit that referenced this pull request Feb 6, 2019
In case no error has occurred during the evaluation of some code,
`undefined` has been returned in some cases as error argument instead
of `null`. This is fixed by this patch.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
danbev pushed a commit that referenced this pull request Feb 6, 2019
It is checked if an command buffer exists or not. This code branch
can only be reached if none exist, so there's no need to clear that
buffer again.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
danbev pushed a commit that referenced this pull request Feb 6, 2019
The removed line does not add anything of value to the test. It was
removed to simplify the test.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 6, 2019
The completion lists used a hand crafted list of global entries that
was redundant due to also using the actual global properties for tab
completion. Those entries ended up in an separated completion group
which did not seem useful.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 6, 2019
In case no error has occurred during the evaluation of some code,
`undefined` has been returned in some cases as error argument instead
of `null`. This is fixed by this patch.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 6, 2019
It is checked if an command buffer exists or not. This code branch
can only be reached if none exist, so there's no need to clear that
buffer again.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 6, 2019
The removed line does not add anything of value to the test. It was
removed to simplify the test.

PR-URL: #25731
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@targos targos mentioned this pull request Feb 14, 2019
starkwang added a commit to starkwang/node that referenced this pull request Jun 4, 2019
The global object in repl conetxt is copied from main context,
which breaks the behavior of `instanceof`.

This change reverts nodejs#25731.

Fixes: nodejs#27859
Refs: nodejs#25731
@starkwang starkwang mentioned this pull request Jun 4, 2019
3 tasks
@BridgeAR BridgeAR deleted the minor-repl-improvements branch January 20, 2020 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants