Skip to content

Conversation

@daeyeon
Copy link
Member

@daeyeondaeyeon commented Nov 20, 2022

The ways to create properties used as constants are scattered in util internal binding.
This PR gets them created in one code block and creates an object holding all of them.

Similar object patterns can be found in other bindings.

node/lib/dgram.js

Lines 71 to 75 in db88483

const{
constants: {UV_UDP_IPV6ONLY},
UDP,
SendWrap
}=internalBinding('udp_wrap');

const{
constants: {
NODE_PERFORMANCE_MILESTONE_NODE_START,
NODE_PERFORMANCE_MILESTONE_V8_START,
NODE_PERFORMANCE_MILESTONE_LOOP_START,
NODE_PERFORMANCE_MILESTONE_LOOP_EXIT,
NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE,
NODE_PERFORMANCE_MILESTONE_ENVIRONMENT
},
loopIdleTime,
}=internalBinding('performance');

Signed-off-by: Daeyeon Jeong [email protected]

Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]>
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Nov 20, 2022

Review requested:

  • @nodejs/startup
  • @nodejs/cpp-reviewers

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Nov 20, 2022
@daeyeondaeyeon added the c++ Issues and PRs that require attention from people who are familiar with C++. label Nov 20, 2022
@daeyeondaeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 21, 2022
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 21, 2022
@nodejs-github-bot

This comment was marked as outdated.

@daeyeondaeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 23, 2022
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 23, 2022
@nodejs-github-bot

This comment was marked as outdated.

@daeyeondaeyeonforce-pushed the main.util-constants-221120.Sun.a9c7 branch from e1cc165 to 397662eCompareNovember 23, 2022 06:40
@daeyeondaeyeon added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 23, 2022
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 23, 2022
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@daeyeondaeyeon added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 24, 2022
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 24, 2022
@nodejs-github-botnodejs-github-bot merged commit be9cd3e into nodejs:mainNov 24, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in be9cd3e

@daeyeondaeyeon deleted the main.util-constants-221120.Sun.a9c7 branch November 24, 2022 02:56
@ruyadorno
Copy link
Member

@daeyeonbe9cd3e does not land cleanly on the release branch v19.x-staging. It will need backporting.

marco-ippolito pushed a commit to marco-ippolito/node that referenced this pull request Nov 24, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: nodejs#45539 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
daeyeon added a commit to daeyeon/node that referenced this pull request Nov 29, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: nodejs#45539 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
daeyeon added a commit to daeyeon/node that referenced this pull request Nov 29, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: nodejs#45539 Backport-PR-URL: nodejs#45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
targos pushed a commit that referenced this pull request Dec 12, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
@targostargos mentioned this pull request Dec 12, 2022
targos pushed a commit that referenced this pull request Dec 13, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 4, 2023
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 5, 2023
Properties used as constants in `util` internal binding are scattered. This suggests using an object holding all of them for better maintenance. Signed-off-by: Daeyeon Jeong <[email protected]> PR-URL: #45539 Backport-PR-URL: #45674 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
@harrisiharrisi mentioned this pull request Feb 19, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@daeyeon@nodejs-github-bot@ruyadorno@joyeecheung@JungMinu@legendecas@RaisinTen@targos