Support defaults in Flow's type parameter declarations

The primary goal of this commit is to add the ability to parse type parameter
declarations with defaults, like `type Foo<T = string> = T`. While I was in the
code, I fixed a few small things, like

* Type parameter declarations need 1 or more type parameters.
* The existential type `*` is not a valid type parameter.
* The existential type `*` is a primary type
* The param list for type parameter declarations now consists of
  `TypeParameter` nodes
This commit is contained in:
Gabe Levi
2016-04-27 15:00:54 -04:00
parent b926e401c6
commit fe5193a40a
38 changed files with 3457 additions and 133 deletions

View File

@@ -74,7 +74,7 @@
},
"params": [
{
"type": "Identifier",
"type": "TypeParameter",
"start": 12,
"end": 13,
"loc": {
@@ -253,6 +253,7 @@
}
}
],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 34,
@@ -272,7 +273,7 @@
"indexers": []
}
}
]
},
"comments": []
],
"directives": []
}
}