-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Conversation
tools/doc/apilinks.js
Outdated
@@ -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; |
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.
Nit: should probably be lhs.type
(and yes, that applies to the line below too).
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.
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.
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.
Thanks!
Looks like #22706 should replace part of my fix, I've rebased and I'm retesting locally before pushing. |
Rebased and passing tests. |
Landed in 3bdc61d |
* Prevent crash when setting root properties * Allow return outside of function PR-URL: #22721 Reviewed-By: Sam Ruby <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
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), orvcbuild test
(Windows) passes