-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow][dev-tools] Hermes-parser based
getAST
for error suppression
Summary: This diff removes our dependence on `flow ast` command for error suppression. Previously, we rely on it to get the AST of the source code, so we can choose what kind of suppressions to add (e.g. we special case jsx elements since it's not always valid to add line comment above it). `flow ast` doesn't read from flowconfig and the parser configuration can become out of sync with the rest of the setup. In this diff, I switched us to use hermes-parser instead. We can remove all of our dependency on flow-bin as a result. There is an important change: we can just use normal js string indexing to get characters, rather than going through the Buffer, since hermes-parser, like most of the other js tools (including the js_of_ocaml compiled flow.js, but not flow-bin ...), encode the string as utf-16 (the js string encoding), so we don't need to worry about these longer-than-1-byte characters. flow-bin handles it differently, probably as a result of negligence, but js_of_ocaml happens to correct it, because there is no straightforward way to get a byte out of a string in the JS. Changelog: [internal] Reviewed By: pieterv Differential Revision: D56796632 fbshipit-source-id: fbe1f923d3b37614e7fd5274a9401a7c4749cc77
- Loading branch information
1 parent
8948694
commit f727f42
Showing
6 changed files
with
85 additions
and
177 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.