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

First pass at implementation of optional chaining #490

Merged
merged 1 commit into from Dec 28, 2019

Conversation

alangpierce
Copy link
Owner

@alangpierce alangpierce commented Dec 28, 2019

Progress toward #461

Tech plan: https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan

The parser now associates each access operation with the start token for the
chain, and marks each chain containing an optional chain operation so that we
can wrap it in a function call.

This does not yet handle optional deletion, and there are a number of follow-up
tests that would be good to write, but the feature seems to be working with this
implementation.

The parser now associates each access operation with the start token for the
chain, and marks each chain containing an optional chain operation so that we
can wrap it in a function call.

This does not yet handle optional deletion, and there are a number of follow-up
tests that would be good to write, but the feature seems to be working with this
implementation.
@codecov-io
Copy link

Codecov Report

Merging #490 into master will increase coverage by 0.14%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #490      +/-   ##
==========================================
+ Coverage   82.28%   82.42%   +0.14%     
==========================================
  Files          53       54       +1     
  Lines        5464     5508      +44     
  Branches     1214     1225      +11     
==========================================
+ Hits         4496     4540      +44     
  Misses        681      681              
  Partials      287      287
Impacted Files Coverage Δ
src/HelperManager.ts 100% <ø> (ø) ⬆️
src/transformers/RootTransformer.ts 92.38% <100%> (-0.04%) ⬇️
src/parser/plugins/typescript.ts 80.36% <100%> (ø) ⬆️
src/parser/tokenizer/index.ts 77.31% <100%> (+0.15%) ⬆️
src/TokenProcessor.ts 91.66% <100%> (+0.45%) ⬆️
src/parser/plugins/flow.ts 63.72% <66.66%> (ø) ⬆️
...transformers/OptionalChainingNullishTransformer.ts 85.18% <85.18%> (ø)
src/parser/traverser/expression.ts 86.96% <86.95%> (+1.15%) ⬆️

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 8b9ceab...e5f6f8f. Read the comment docs.

@alangpierce alangpierce merged commit 4f8efe9 into master Dec 28, 2019
@alangpierce alangpierce deleted the implement-optional-chaining branch December 28, 2019 01:58
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.

None yet

2 participants