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

tools: dedupe property access in doc/type-parser #20387

Closed
wants to merge 1 commit into from
Closed

tools: dedupe property access in doc/type-parser #20387

wants to merge 1 commit into from

Conversation

vsemozhetbyt
Copy link
Contributor

@vsemozhetbyt vsemozhetbyt commented Apr 28, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

There is no need to get this property twice in this rather hot spot: if there is no such key, the typeUrl will be undefined, which suffices for the boolean check in the next line.

For consistency, undefined can also be made the default value.

@vsemozhetbyt vsemozhetbyt added the fast-track PRs that do not need to wait for 48 hours to land. label Apr 28, 2018
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory. labels Apr 28, 2018
@vsemozhetbyt
Copy link
Contributor Author

Please, add 👍 here to approve fast-tracking.

@vsemozhetbyt
Copy link
Contributor Author

@vsemozhetbyt vsemozhetbyt added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 29, 2018
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

LGTM while I suggest to change the typeUrl default to undefined.

@vsemozhetbyt
Copy link
Contributor Author

@BridgeAR It seems this would violate our lint rule:

'no-undef-init': 'error',

Refs: https://eslint.org/docs/rules/no-undef-init

@BridgeAR
Copy link
Member

@vsemozhetbyt sorry for not being clear with my comment: if you just do: let typeUrl; it is fine for the linter. That rule is only to prevent writing: let typeUrl = undefined; because it is the same as the former and the former is shorter.

There is no need to get this property twice in this rather hot spot:
if there is no such key, the `typeUrl` will be `undefined`,
which suffices for the boolean check in the next line.

For consistency, `undefined` can also be made the default value.
@vsemozhetbyt
Copy link
Contributor Author

@BridgeAR I've updated the code and commit message.

@BridgeAR, @tniessen, @trivikr Is this still OK for you?

CI-lite: https://ci.nodejs.org/job/node-test-pull-request-lite/622/

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

Still LG

@tniessen
Copy link
Member

Yep.

Copy link
Member

@trivikr trivikr left a comment

Choose a reason for hiding this comment

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

LGTM

@vsemozhetbyt
Copy link
Contributor Author

Landed in 1c530e8
Thank you all for the reviews.

@vsemozhetbyt vsemozhetbyt deleted the tools-doc-type-parser-cache branch May 2, 2018 02:51
vsemozhetbyt added a commit that referenced this pull request May 2, 2018
There is no need to get this property twice in this rather hot spot:
if there is no such key, the `typeUrl` will be `undefined`,
which suffices for the boolean check in the next line.

For consistency, `undefined` can also be made the default value.

PR-URL: #20387
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request May 4, 2018
There is no need to get this property twice in this rather hot spot:
if there is no such key, the `typeUrl` will be `undefined`,
which suffices for the boolean check in the next line.

For consistency, `undefined` can also be made the default value.

PR-URL: #20387
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request May 8, 2018
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. doc Issues and PRs related to the documentations. fast-track PRs that do not need to wait for 48 hours to land. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants