Typeof can refer to block-scoped values before declaration#15239
Merged
Conversation
mhegazy
reviewed
Apr 17, 2017
Contributor
mhegazy
left a comment
There was a problem hiding this comment.
LGTM.
Can you run the perf tests to make sure the new polymorphic function does not impact performance adversely.
alfaproject
reviewed
Apr 18, 2017
| * At that point findAncestor returns undefined. | ||
| */ | ||
| export function findAncestor<T>(node: Node, callback: (element: Node) => T | undefined, done?: (element: Node) => boolean): Node { | ||
| if (node) { |
There was a problem hiding this comment.
You don't need this condition, because it's being checked in the while loop again
Member
Author
|
With the PR as it stands now, total time of Monaco was 0.01 seconds faster and TFS was 0.37 seconds faster. Neither of those are significant, if I'm reading the output correctly. I'm going to update the PR suggestions from @alfaproject and @Andy-MS and then re-run the perf test. I'll also try to get Angular correctly added to the perf test. |
Previously there was a 'found' callback and a 'quit' callback.
Member
Author
|
Perf tests are about the same with the changes suggested by @Andy-MS. There's some variance but the average is right around 0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15102 by allowing references to block-scoped values before declaration inside of a type query.
Also adds
findAncestor, which iterates up a parent pointer chain. I updated the parent pointer walks in checker to usefindAncestor.