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

util: add prototype support for boxed primitives #27351

Closed

Conversation

BridgeAR
Copy link
Member

This makes sure manipulated prototypes from boxed primitives will
be highlighted. It also makes sure that a potential Symbol.toStringTag
is taken into account.

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

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot nodejs-github-bot added the util Issues and PRs related to the built-in util module. label Apr 22, 2019
@BridgeAR
Copy link
Member Author

@nodejs/util PTAL

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

This makes sure manipulated prototypes from boxed primitives will
be highlighted. It also makes sure that a potential `Symbol.toStringTag`
is taken into account.
@BridgeAR BridgeAR force-pushed the add-prototype-support-boxed-primitive branch from 2d7d167 to 21656b1 Compare April 25, 2019 08:33
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 25, 2019
@nodejs-github-bot

This comment has been minimized.

{ value: 'Foobar' }
)
),
'[Number (Array): -0] [Foobar]'
Copy link
Member

Choose a reason for hiding this comment

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

👆 😮

let base = `[${type}`;
if (type !== constructor) {
if (constructor === null) {
base += ' (null prototype)';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Not a blocking comment.. But my thoughts..For objects, null prototype is showed as [Object: null prototype] {}, looks like for primitives, we show as [Boolean (null prototype): true] (like in test), may be we can show like [Boolean: null prototype] true, so that reading is consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that as well but I think it would be less obvious that it's a boxed primitive in that case (obviously, e.g., 5 is a number, so it might also just stand for extra information?).

The inconsistency is not ideal but this is likely going to be a super rare case anyway.

Copy link
Contributor

@antsmartian antsmartian left a comment

Choose a reason for hiding this comment

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

LGTM

@nodejs-github-bot
Copy link
Collaborator

BridgeAR added a commit to BridgeAR/node that referenced this pull request Apr 26, 2019
This makes sure manipulated prototypes from boxed primitives will
be highlighted. It also makes sure that a potential `Symbol.toStringTag`
is taken into account.

PR-URL: nodejs#27351
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: John-David Dalton <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
@BridgeAR
Copy link
Member Author

Landed in 55147d7.

@BridgeAR BridgeAR closed this Apr 26, 2019
targos pushed a commit that referenced this pull request Apr 27, 2019
This makes sure manipulated prototypes from boxed primitives will
be highlighted. It also makes sure that a potential `Symbol.toStringTag`
is taken into account.

PR-URL: #27351
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: John-David Dalton <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
@targos targos mentioned this pull request Apr 27, 2019
@BridgeAR BridgeAR deleted the add-prototype-support-boxed-primitive branch January 20, 2020 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants