-
Notifications
You must be signed in to change notification settings - Fork 30k
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: fix js2c regression #27980
tools: fix js2c regression #27980
Conversation
This comment has been minimized.
This comment has been minimized.
f473fa2
to
e302589
Compare
This comment has been minimized.
This comment has been minimized.
e302589
to
84aca5c
Compare
This comment has been minimized.
This comment has been minimized.
protected: | ||
|
||
static const NativeModuleRecordMap get_sources_for_test() { | ||
return NativeModuleLoader::instance_.source_; |
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.
The builds are failing because this is private. I guess it would also make sense to add a public method to just return the source in a copy, though.
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.
I made it a friend
https://github.com/nodejs/node/blob/84aca5ca594f86ce9b6b86e6af039e78f90deaef/src/node_native_module.h#L89
and it compiles & passes with MSVC, now I need to figure out gcc & clang 🤷♂
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.
Seems like it was a namespace issue
https://github.com/nodejs/node/blob/c178598d309319e9a9e9692d6560a9205cd1b307/src/node_native_module.h#L89
This comment has been minimized.
This comment has been minimized.
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. Nice work.
tools/js2c.py
Outdated
template = TWO_BYTE_STRING | ||
# Treat non-ASCII as UTF-8 and encode as UTF-16 Little Endian. | ||
encoded_source = bytearray(source, 'utf-16le') | ||
code_points = [encoded_source[i] + (encoded_source[i + 1] * 256) for i in range(0, len(encoded_source), 2)] |
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.
Can you wrap this, e.g. by putting the for i in ...
on its own line, lining it up with the e
in [encoded_source
?
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.
Done.
8494bba
to
6b0295c
Compare
Landed in cb92d24 |
PR-URL: nodejs#27980 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: #27980 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Fix a regression that was introduced in #25518 and causes the binary to bloat by ~10%.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes