Skip to content

Conversation

@cjihrig
Copy link
Contributor

The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro.

Refs: #4100
R=@bnoordhuis

@Fishrock123Fishrock123 added the c++ Issues and PRs that require attention from people who are familiar with C++. label Dec 2, 2015
@mscdexmscdex added the util Issues and PRs related to the built-in util module. label Dec 2, 2015
Copy link
Member

Choose a reason for hiding this comment

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

You can improve on this with a map macro:

#defineVALUE_METHOD_MAP(V) \ V(isArrayBuffer, IsArrayBuffer) \ V(isDataView, IsDataView) \ // etc.

Then:

#defineV(_, ucname) \ staticvoiducname(const FunctionCallbackInfo<Value>& args){\ // etc.VALUE_METHOD_MAP(V) #undef V

And further down below:

#defineV(lcname, ucname) env->SetMethod(target, #lcname, ucname); VALUE_METHOD_MAP(V) #undef V

@cjihrig
Copy link
ContributorAuthor

@bnoordhuis updated

@jasnell
Copy link
Member

LGTM

@jasnell
Copy link
Member

Marking this as an LTS watch but I'm not convinced yet we should land it there.

@bnoordhuis
Copy link
Member

LGTM

@cjihrig
Copy link
ContributorAuthor

@cjihrigcjihrig closed this Dec 4, 2015
cjihrig added a commit to cjihrig/node that referenced this pull request Dec 4, 2015
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: nodejs#4100 PR-URL: nodejs#4118 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
@cjihrigcjihrig merged commit 46af397 into nodejs:masterDec 4, 2015
@cjihrigcjihrig deleted the macros branch December 4, 2015 03:35
cjihrig added a commit that referenced this pull request Dec 5, 2015
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: #4100 PR-URL: #4118 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
@rvaggrvagg mentioned this pull request Dec 17, 2015
@MylesBorins
Copy link
Contributor

this relies on #4100 to land

cjihrig added a commit to cjihrig/node that referenced this pull request Jan 7, 2016
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: nodejs#4100 PR-URL: nodejs#4118 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Conflicts: src/node_util.cc
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: #4100 PR-URL: #4118 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Conflicts: src/node_util.cc
@MylesBorinsMylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
The Is* type checking functions in node_util.cc are mostly the same boilerplate. This commit defines them using a macro. Refs: nodejs#4100 PR-URL: nodejs#4118 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
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++.utilIssues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@cjihrig@jasnell@bnoordhuis@MylesBorins@mscdex@Fishrock123