Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Correctly create visitorKeysMap #453

Closed
wants to merge 1 commit into from
Closed

Correctly create visitorKeysMap #453

wants to merge 1 commit into from

Conversation

zertosh
Copy link
Member

@zertosh zertosh commented Mar 23, 2017

visitorKeysMap has always been a copy of t.VISITOR_KEYS. After doing some archeology, it seems like there's been confusion wrt lodash's pick vs pickBy, which led to this.

When visitorKeysMap was first introduced in #109, it used lodash.pick@3. In that version, the predicate was called with (value, key, object). It was later switched to lodash.pickby@4 in #301. Because in lodash@4, pick switched to calling the predicate with (key, value, object), and pickby kept the old pick behavior. Throughout this, the value passed to indexOf was always an array (those are the values of t.VISITOR_KEYS), and indexOf was comparing that to strings (the values of t.FLIPPED_ALIAS_KEYS.Flow). So that meant that -1 === -1 and visitorKeysMap became a shallow copy of t.VISITOR_KEYS. #450 didn't help because it copied the same behavior.

This is a very big change. I ran this against the tests in https://github.com/gajus/eslint-plugin-flowtype and on a full eslint run of https://github.com/facebook/nuclide - and babel-eslint continues to work.

@zertosh
Copy link
Member Author

zertosh commented Mar 25, 2017

Abandoning this since I have a PR coming up that removes all of this.

@zertosh zertosh closed this Mar 25, 2017
@zertosh zertosh deleted the use-t-visitor-keys branch March 25, 2017 23:27
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.

1 participant