Skip to content

Conversation

DanielRosenwasser
Copy link
Member

Might be overkill but worth just sending a PR.

* For example, searching for a `SourceFile` in a `SourceFile[]` wouldn't work.
*/
export function indexOfNode(nodeArray: ReadonlyArray<Node>, node: Node) {
return binarySearch(nodeArray, node, compareNodePos);
Copy link
Member Author

Choose a reason for hiding this comment

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

One place this wouldn't work is with synthesized nodes. Not sure if those cases can pop up where it's been used so far.

@ghost ghost merged commit c220ebb into indexof Sep 21, 2017
@ghost ghost deleted the indexOfInNodeLists branch September 21, 2017 14:31
ghost pushed a commit that referenced this pull request Sep 22, 2017
* Avoid calling `indexOf` when checking array element types

* Add 'indexOfNode' and use it in cases which may handle long lists. (#18635)

* Fix bug where contextual type was not reused if undefined
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants