| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/47913 ✔ Done loading data for nodejs/node/pull/47913 ----------------------------------- PR info ------------------------------------ Title src: avoid prototype access in binding templates (#47913) Author Joyee Cheung (@joyeecheung) Branch joyeecheung:binding -> nodejs:main Labels c++, lib / src, needs-ci Commits 1 - src: avoid prototype access in binding templates Committers 1 - Joyee Cheung PR-URL: https://github.com/nodejs/node/pull/47913 Reviewed-By: Chengzhong Wu Reviewed-By: James M Snell ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/47913 Reviewed-By: Chengzhong Wu Reviewed-By: James M Snell -------------------------------------------------------------------------------- ℹ This PR was created on Mon, 08 May 2023 03:16:57 GMT ✔ Approvals: 2 ✔ - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/47913#pullrequestreview-1418106668 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/47913#pullrequestreview-1419744904 ✘ Last GitHub CI failed ℹ Last Full PR CI on 2023-05-10T11:42:30Z: https://ci.nodejs.org/job/node-test-pull-request/51743/ - Querying data for job/node-test-pull-request/51743/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/4948851579 |
Sorry, something went wrong.
|
I think what would be nice for the PR description/commit message is a motivation for why this change is right, not just what it does. |
Sorry, something went wrong.
Do you have any suggestions? I am not sure how to formulate the motivation (because falling back to prototype lookup for these is unnecessary and a bit awkward?). It's like when you define a module.exports you don't do this weird dance: function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
and just do module.exports = { property: ... };
|
Sorry, something went wrong.
|
Ping @addaleax Do you have any specific suggestions about the commit message? Or should I just use that example above to explain it? |
Sorry, something went wrong.
|
@joyeecheung No strong preferences, just wanted to make sure that it’s just a simplification of the code and otherwise doesn’t really change anything |
Sorry, something went wrong.
|
Yeah, I believe this is a simplification of the code. The cpp format linter is complaining. A re-format might be needed. |
Sorry, something went wrong.
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
PR-URL: #47913
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in c0365fd with the commit message fixed. |
Sorry, something went wrong.
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
PR-URL: #47913
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
PR-URL: nodejs#47913
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This patch makes the binding templates ObjectTemplates, since we
don't actually need the constructor function. This also avoids
setting the properties on prototype, and instead initializes them
directly on the object template.
Previously the initialization was similar to:
```
function Binding() {}
Binding.prototype.property = ...;
module.exports = new Binding;
```
Now it's similar to:
```
module.exports = { property: ... };
```
PR-URL: nodejs#47913
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
This patch makes the binding templates ObjectTemplates, since we don't actually need the constructor function. This also avoids setting the properties on prototype, and instead initializes them directly on the object template.