Uh oh!
There was an error while loading. Please reload this page.
util: correctly inspect Map/Set Iterators - #3119
Conversation
There was a problem hiding this comment.
This will consume iterator entirely and make it useless
There was a problem hiding this comment.
If you print an iterator, python just prints the type of iterator. May be we should do the same. Otherwise we'll exhaust the iterator as vkurchatkin pointed out.
There was a problem hiding this comment.
Ah yea, I see what you mean.
There was a problem hiding this comment.
So I guess that means that we will have to use Debug.MakeMirror and fetch the values?
There was a problem hiding this comment.
Style nit. Or operator should be in the previous line.
There was a problem hiding this comment.
@thefourtheye Do we have an eslint rule for that, btw?
There was a problem hiding this comment.
make lint passes with both. Be happy to change if that is the preferred way though
There was a problem hiding this comment.
Doesn't it fit on one line? It works out to exactly 80 characters, doesn't it?
evanlucas
commented
Sep 30, 2015
Updated to use |
There was a problem hiding this comment.
Can you rebase and use ensureDebugIsInitialized() here?
evanlucas
commented
Oct 5, 2015
Updated to utilize |
There was a problem hiding this comment.
Can you name this binding? That's more in line with other source files.
bnoordhuis
commented
Oct 5, 2015
Mostly LGTM. I think the |
66169e3 to
c7d7eabCompareevanlucas
commented
Oct 5, 2015
Alright, broke out the |
evanlucas
commented
Oct 5, 2015
bnoordhuis
commented
Oct 5, 2015
LGTM |
In the event an Array is created in a Debug context, the constructor will be Array, but !== Array. This adds a check constructor.name === 'Array' to handle edge cases like that. PR-URL: nodejs#3119 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Previously, a MapIterator or SetIterator would not be inspected properly. This change makes it possible to inspect them by creating a Debug Mirror and previewing the iterators to not consume the actual iterator that we are trying to inspect. This change also adds a node_util binding that uses v8's Value::IsSetIterator and Value::IsMapIterator to verify that the values passed in are actual iterators. Fixes: nodejs#3107 PR-URL: nodejs#3119 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
evanlucas
commented
Oct 6, 2015
In the event an Array is created in a Debug context, the constructor will be Array, but !== Array. This adds a check constructor.name === 'Array' to handle edge cases like that. PR-URL: #3119 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Previously, a MapIterator or SetIterator would not be inspected properly. This change makes it possible to inspect them by creating a Debug Mirror and previewing the iterators to not consume the actual iterator that we are trying to inspect. This change also adds a node_util binding that uses v8's Value::IsSetIterator and Value::IsMapIterator to verify that the values passed in are actual iterators. Fixes: #3107 PR-URL: #3119 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Currently, inspecting
new Map().keys()or other iterators will return an empty object.I am opening more for discussion of how we want (if at all) to address not being able to inspect map and set iterators. I first had first attempting using
Debug.MakeMirrorbut the performance of doing it this way was about 10x better.Related: #3107