Skip to content
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

tools,doc: apilinks should handle root scenarios #22721

Merged
merged 0 commits into from
Sep 10, 2018

Conversation

kfarnung
Copy link
Contributor

@kfarnung kfarnung commented Sep 6, 2018

  • Prevent crash when setting root properties
  • Allow return outside of function

In Node-ChakraCore we ran into some issues with this script. Rather than fix them downstream I think the fixes are potentially valuable here.

Root properties example: https://github.com/nodejs/node-chakracore/blob/a3d02b2794fa7fdf03be48d3b4a8cd87b7345402/lib/trace_mgr.js#L618

Return outside of function example: https://github.com/nodejs/node-chakracore/blob/a3d02b2794fa7fdf03be48d3b4a8cd87b7345402/lib/v8.js#L17-L19

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@kfarnung kfarnung self-assigned this Sep 6, 2018
@kfarnung kfarnung requested a review from rubys September 6, 2018 00:55
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory. labels Sep 6, 2018
@@ -67,6 +69,7 @@ process.argv.slice(2).forEach((file) => {
if (expr.type !== 'AssignmentExpression') return;

let lhs = expr.left;
if (expr.left.type !== 'MemberExpression') return;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: should probably be lhs.type (and yes, that applies to the line below too).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! While doing this I noticed the redundant check and removed it. The logic should be that we only look for the object in cases where it's already a MemberExpression and only replace it in cases where the object is also MemberExpression. I compared the output with and without my changes and it's identical, so I think this logic is sound.

@kfarnung
Copy link
Contributor Author

kfarnung commented Sep 6, 2018

@kfarnung kfarnung changed the title doc: update apilinks to handle other scenarios tools,doc: apilinks should handle root scenarios Sep 6, 2018
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Thanks!

@kfarnung
Copy link
Contributor Author

kfarnung commented Sep 8, 2018

@kfarnung
Copy link
Contributor Author

kfarnung commented Sep 9, 2018

Looks like #22706 should replace part of my fix, I've rebased and I'm retesting locally before pushing.

@kfarnung
Copy link
Contributor Author

kfarnung commented Sep 9, 2018

Rebased and passing tests.

@kfarnung
Copy link
Contributor Author

kfarnung commented Sep 9, 2018

@kfarnung
Copy link
Contributor Author

Landed in 3bdc61d

@kfarnung kfarnung closed this Sep 10, 2018
@kfarnung kfarnung deleted the apilinks branch September 10, 2018 01:10
@kfarnung kfarnung merged commit 3bdc61d into nodejs:master Sep 10, 2018
targos pushed a commit that referenced this pull request Sep 10, 2018
* Prevent crash when setting root properties
* Allow return outside of function

PR-URL: #22721
Reviewed-By: Sam Ruby <rubys@intertwingly.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants