Skip to content

src: add FromV8Value<T>() for integral and enum types #57931

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aditi-1400
Copy link
Contributor

@Aditi-1400 Aditi-1400 commented Apr 18, 2025

From the following comment in the pull request: #57146 (comment)

Add a template utility method FromV8Value<T>() to replace the repetitive static_cast<...>(value.As<>()‑>Value()) pattern. It also additionally adds compile‑time range checks for integers.

I've also replaced a bunch of static_casts with the new FromV8Value<T>()

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. 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 Apr 18, 2025
Copy link

codecov bot commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.27%. Comparing base (9cc0195) to head (fabec6a).

Files with missing lines Patch % Lines
src/util-inl.h 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57931      +/-   ##
==========================================
- Coverage   90.28%   90.27%   -0.01%     
==========================================
  Files         630      630              
  Lines      186158   186160       +2     
  Branches    36484    36476       -8     
==========================================
- Hits       168067   168057      -10     
+ Misses      10974    10970       -4     
- Partials     7117     7133      +16     
Files with missing lines Coverage Δ
src/crypto/crypto_keys.cc 72.57% <100.00%> (+0.27%) ⬆️
src/node_file.cc 76.76% <100.00%> (+0.04%) ⬆️
src/node_util.cc 81.73% <100.00%> (-0.06%) ⬇️
src/node_v8.cc 80.67% <100.00%> (-0.05%) ⬇️
src/node_zlib.cc 78.76% <100.00%> (+0.34%) ⬆️
src/process_wrap.cc 66.66% <100.00%> (ø)
src/udp_wrap.cc 78.62% <100.00%> (ø)
src/util-inl.h 80.68% <66.66%> (-0.30%) ⬇️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

joyeecheung
joyeecheung previously approved these changes Apr 18, 2025
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 18, 2025
Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

hmm, actually the CHECKs should be more specific..

@joyeecheung joyeecheung dismissed their stale review April 18, 2025 19:53

need more specific CHECKs

@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Apr 18, 2025
Copy link
Contributor

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/14540925539

@joyeecheung joyeecheung added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. request-ci Add this label to start a Jenkins CI on a PR. labels Apr 23, 2025
@joyeecheung
Copy link
Member

This now has a conflict with the main branch, can you rebase?

Add a template utility method FromV8Value<T>() to replace the
repetitive static_cast<...>(value.As<>()‑>Value()) pattern.
It also additionally adds compile‑time range checks for
integers.

Refs: nodejs#57146 (comment)
Sign up for free to 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 / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants