Skip to content

src: use Local version of ToBoolean() - #24924

Merged
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:toboolean
Dec 11, 2018
Merged

src: use Local version of ToBoolean()#24924
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:toboolean

Conversation

@cjihrig

Copy link
Copy Markdown
Contributor

This fixes a deprecation warning.

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

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Dec 9, 2018
@targos

Copy link
Copy Markdown
Member

Isn't this removing a check? I'm not familiar with this code but it removes something about a boolean expected?

@cjihrig

Copy link
Copy Markdown
ContributorAuthor

I don't think so. The compiler warning is:

warning: 'ToBoolean' is deprecated: ToBoolean can never throw. Use Local version.

And, the CHECK_TO_TYPE macro that this previously expanded to does have some additional argument checks, but those exact checks are already present in napi_coerce_to_bool() (the function being modified).

@addaleax

Copy link
Copy Markdown
Member

@targos I’m not sure which check you’re referring to – CHECK_MAYBE_EMPTY? The reason that the Maybe<> variant of ToBoolean() is deprecated that the conversion can never actually fail, so I think that part is okay?

@targos

Copy link
Copy Markdown
Member

It's just that I see napi_boolean_expected in the old code. It looks like some kind of error that was returned if a non-boolean was passed? I'm on mobile so I'm probably missing a lot of context. If that "error" couldn't be triggered before, it LGTM.

@addaleax

Copy link
Copy Markdown
Member

@targosnapi_boolean_expected was the status argument of CHECK_TO_TYPE, which in turn was only used for CHECK_MAYBE_EMPTY, so yes, I think we’re good here.

@danbev

Copy link
Copy Markdown
Contributor

@TrottTrott mentioned this pull request Dec 10, 2018
2 tasks
@cjihrig

Copy link
Copy Markdown
ContributorAuthor

This fixes a deprecation warning.
PR-URL: nodejs#24924
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@cjihrig
cjihrig merged commit 91c1f8a into nodejs:masterDec 11, 2018
@cjihrig
cjihrig deleted the toboolean branch December 11, 2018 21:02
BethGriggs pushed a commit that referenced this pull request Dec 17, 2018
This fixes a deprecation warning.
PR-URL: #24924
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BethGriggsBethGriggs mentioned this pull request Dec 18, 2018
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
This fixes a deprecation warning.
PR-URL: nodejs#24924
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@cjihrig@nodejs-github-bot@targos@addaleax@danbev@fhinkel@jasnell@joyeecheung@BethGriggs