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

Fix crash when access modifiers are used in constructor param defaults #531

Merged
merged 1 commit into from May 10, 2020

Conversation

alangpierce
Copy link
Owner

Fixes #522

Previously, the logic to compile TS constructor param assignments walked through
all tokens in the constructor looking for access modifiers, but this can cause
problems if default values include access modifiers. Now, we mark commas
associated with the constructor and only emit assignments when we see an
open-paren or comma followed by an access modifier.

Fixes #522

Previously, the logic to compile TS constructor param assignments walked through
all tokens in the constructor looking for access modifiers, but this can cause
problems if default values include access modifiers. Now, we mark commas
associated with the constructor and only emit assignments when we see an
open-paren or comma followed by an access modifier.
@codecov-io
Copy link

Codecov Report

Merging #531 into master will increase coverage by 0.00%.
The diff coverage is 76.92%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #531   +/-   ##
=======================================
  Coverage   81.50%   81.51%           
=======================================
  Files          55       55           
  Lines        5710     5713    +3     
  Branches     1287     1289    +2     
=======================================
+ Hits         4654     4657    +3     
  Misses        766      766           
  Partials      290      290           
Impacted Files Coverage Δ
src/util/getClassInfo.ts 85.24% <70.00%> (+0.12%) ⬆️
src/parser/traverser/lval.ts 98.82% <100.00%> (+0.02%) ⬆️
src/parser/traverser/statement.ts 83.06% <100.00%> (ø)

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 9a67974...888b67e. Read the comment docs.

@alangpierce alangpierce merged commit 0a8413a into master May 10, 2020
@alangpierce alangpierce deleted the fix-access-modifier-constructor-param-crash branch May 10, 2020 23:34
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.

Parse error when constructor argument has negative number default value
2 participants