babel-types: Add missing field, fix incorrect definitions (#6083)

* babel-types: Add missing field, fix incorrect definitions

* Regenerate babel-types readme
This commit is contained in:
Andy
2017-08-09 13:56:19 -07:00
committed by Justin Ridgewell
parent b41fe4efb1
commit a74b307752
2 changed files with 9 additions and 6 deletions

View File

@@ -244,7 +244,7 @@ t.catchClause(param, body)
See also `t.isCatchClause(node, opts)` and `t.assertCatchClause(node, opts)`.
Aliases: `Scopable`
Aliases: `Scopable`, `BlockParent`
- `param`: `Identifier` (default: `null`)
- `body`: `BlockStatement` (required)
@@ -1561,6 +1561,7 @@ Aliases: `Scopable`, `BlockParent`, `Block`
- `body`: `Array<Statement>` (required)
- `directives`: `Array<Directive>` (default: `[]`)
- `sourceFile`: `string` (default: `null`)
- `sourceType`: `'script' | 'module'` (default: `null`)
---
@@ -2505,10 +2506,9 @@ See also `t.isTryStatement(node, opts)` and `t.assertTryStatement(node, opts)`.
Aliases: `Statement`
- `block` (required)
- `handler`: `BlockStatement` (default: `null`)
- `block`: `BlockStatement` (required)
- `handler`: `CatchClause` (default: `null`)
- `finalizer`: `BlockStatement` (default: `null`)
- `body`: `BlockStatement` (default: `null`)
---

View File

@@ -518,6 +518,9 @@ defineType("Program", {
sourceFile: {
validate: assertValueType("string"),
},
sourceType: {
validate: assertOneOf("script", "module"),
},
directives: {
validate: chain(
assertValueType("array"),
@@ -739,12 +742,12 @@ defineType("TryStatement", {
visitor: ["block", "handler", "finalizer"],
aliases: ["Statement"],
fields: {
body: {
block: {
validate: assertNodeType("BlockStatement"),
},
handler: {
optional: true,
validate: assertNodeType("BlockStatement"),
validate: assertNodeType("CatchClause"),
},
finalizer: {
optional: true,