Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move close-paren to before arrow when removing arrow return types #393

Merged
merged 1 commit into from
Jan 6, 2019

Conversation

alangpierce
Copy link
Owner

Fixes #391

It's a bit ugly, but we now do a lookahead whenever we see a ): with the :
as a type token. If the next non-type is an arrow, we move the ) to just
before the arrow. This seems to work and seems to agree with
processBalancedCode.

I also added a new type of test that actually executes the resulting code and
asserts the output value from the code, which will probably be useful in the
future as well.

Fixes #391

It's a bit ugly, but we now do a lookahead whenever we see a `):` with the `:`
as a type token. If the next non-type is an arrow, we move the `)` to just
before the arrow. This seems to work and seems to agree with
`processBalancedCode`.

I also added a new type of test that actually executes the resulting code and
asserts the output value from the code, which will probably be useful in the
future as well.
@codecov-io
Copy link

Codecov Report

Merging #393 into master will increase coverage by 0.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #393     +/-   ##
=========================================
+ Coverage   79.81%   79.91%   +0.1%     
=========================================
  Files          45       45             
  Lines        4939     5173    +234     
  Branches     1148     1152      +4     
=========================================
+ Hits         3942     4134    +192     
- Misses        699      739     +40     
- Partials      298      300      +2
Impacted Files Coverage Δ
src/transformers/FlowTransformer.ts 100% <100%> (ø) ⬆️
src/transformers/TypeScriptTransformer.ts 95% <100%> (ø) ⬆️
src/transformers/RootTransformer.ts 92.48% <100%> (+0.51%) ⬆️
src/util/formatTokens.ts 70.58% <0%> (-10.06%) ⬇️
src/parser/util/identifier.ts 90.9% <0%> (-4.1%) ⬇️
src/parser/plugins/jsx/index.ts 87.33% <0%> (-1.88%) ⬇️
src/parser/plugins/flow.ts 62.21% <0%> (-1.59%) ⬇️
src/util/getClassInfo.ts 85.12% <0%> (-1.21%) ⬇️
src/identifyShadowedGlobals.ts 87.8% <0%> (-1.09%) ⬇️
src/parser/traverser/statement.ts 80.28% <0%> (-0.77%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6aa6cc6...cfa0df3. Read the comment docs.

@alangpierce alangpierce merged commit bb90113 into master Jan 6, 2019
@alangpierce alangpierce deleted the fix-arrow-param-end-syntax-error branch January 6, 2019 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants