-
Notifications
You must be signed in to change notification settings - Fork 465
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
src: Add an operator to retrieve raw napi_callback_info
from CallbackInfo
#1253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Exposing conversion api to fetch underlying napi_callback_info from CallBackInfo - Add test coverage for CallbackInfo SetData method PR-URL: #1253 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
There's a new compilation error with
https://github.com/lovell/sharp/actions/runs/3924810417/jobs/6709314064 The code that triggers this is relatively straightforward (and hasn't changed): Napi::Value metadata(const Napi::CallbackInfo& info) {
...
Napi::Object options = info[0].As<Napi::Object>(); // compilation error occurs here https://github.com/lovell/sharp/blob/flow/src/metadata.cc#L279 I'm still investigating this, but can anyone spot anything wrong with the way |
Hi @lovell, I believe this particular issue is indeed related to this PR. I dug a little around C2666 on Stackoverflow. From what I understand, by introducing this conversion operator for |
@JckXia Thank you very much for investigating, I agree with your findings. The docs do say the https://github.com/nodejs/node-addon-api/blob/main/doc/callbackinfo.md#operator- I've unpinned via commit lovell/sharp@bdc50e1 and everything is compiling happily again. Hopefully someone might be able to work out why the existing |
Yep I agree @lovell, and thank you for catching this! We have a windows ci pipeline running but for some reason the checks wasn't able to flag the error. Will bring up this issue in our weekly meetings. |
I am getting this exact error in the latest Windows CI builds of node-sword-interface. |
@JckXia do you have any suggestions for a good way to fix the issue? Trying to understand if we should think about backing out the change (although that would potentially be SemVer major as well) |
@mhdawson I think there might be a few options we can explore.
On a side note, I couldn't reproduce this error locally using MSVC 2019 |
@JckXia thanks for the outline. I don't know the nuances of the implicit conversions well enough to know of the top of my head but my first thought might be that changing from size_t to int could affect people who had declared index as a size_t. Let us know what you figure out in the deeper dive. |
- Exposing conversion api to fetch underlying napi_callback_info from CallBackInfo - Add test coverage for CallbackInfo SetData method PR-URL: nodejs/node-addon-api#1253 Reviewed-By: Michael Dawson <midawson@redhat.com Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Resolves #1234, and also complete unit test coverage for #1048