Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Small fix for parsing type parameter declarations #83

Merged
merged 1 commit into from
Aug 3, 2016

Conversation

gabelevi
Copy link
Contributor

When you eat a token, it looks like Babylon automatically lexes the next token. Setting this.state.inType changes the behavior of the lexer, so it needs to be set before eating the type. This was causing trouble, since

type Foo<T = void> = T;

wouldn't parse, since we would eat the = token before setting this.state.inType = true, which meant void was lexed as an expression instead as a type.

However, the whole type parameter declaration should be parsed with this.state.inType = true anyway. Sometimes it was, like for functions and arrow functions, but often it was not. This change makes all type parameter declarations be parsed with this.state.inType = true.

@codecov-io
Copy link

codecov-io commented Jul 29, 2016

Current coverage is 96.91% (diff: 100%)

Merging #83 into master will decrease coverage by <.01%

@@             master        #83   diff @@
==========================================
  Files            19         19          
  Lines          2923       2920     -3   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           2833       2830     -3   
  Misses           90         90          
  Partials          0          0          

Powered by Codecov. Last update 4811d61...3f9265b

@sebmck sebmck merged commit c9a7bed into babel:master Aug 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants