Add optionality to catch bindings (#634)
* Add optionality to catch bindings (plus tests) * Update ast/spec, README, set param to null if no param with plugin optionalCatchBinding * Fix: wrap param = null in else case * Fix tests for optional catch binding; add tests which include finally clause
This commit is contained in:
parent
77bdb9ae3e
commit
c88af90c0a
@ -146,6 +146,7 @@ require("babylon").parse("code", {
|
||||
| `optionalChaining` ([proposal](https://github.com/tc39/proposal-optional-chaining)) | `a?.b` |
|
||||
| `importMeta` ([proposal](https://github.com/tc39/proposal-import-meta)) | `import.meta.url` |
|
||||
| `bigInt` ([proposal](https://github.com/tc39/proposal-bigint)) | `100n` |
|
||||
| `optionalCatchBinding` ([proposal](https://github.com/babel/proposals/issues/7)) | `try {throw 0;} catch{do();}` |
|
||||
|
||||
### FAQ
|
||||
|
||||
|
||||
@ -442,7 +442,7 @@ A `try` statement. If `handler` is `null` then `finalizer` must be a `BlockState
|
||||
```js
|
||||
interface CatchClause <: Node {
|
||||
type: "CatchClause";
|
||||
param: Pattern;
|
||||
param: Pattern | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
```
|
||||
|
||||
@ -491,12 +491,14 @@ export default class StatementParser extends ExpressionParser {
|
||||
if (this.match(tt._catch)) {
|
||||
const clause = this.startNode();
|
||||
this.next();
|
||||
|
||||
this.expect(tt.parenL);
|
||||
clause.param = this.parseBindingAtom();
|
||||
this.checkLVal(clause.param, true, Object.create(null), "catch clause");
|
||||
this.expect(tt.parenR);
|
||||
|
||||
if (this.match(tt.parenL) || !this.hasPlugin("optionalCatchBinding")) {
|
||||
this.expect(tt.parenL);
|
||||
clause.param = this.parseBindingAtom();
|
||||
this.checkLVal(clause.param, true, Object.create(null), "catch clause");
|
||||
this.expect(tt.parenR);
|
||||
} else {
|
||||
clause.param = null;
|
||||
}
|
||||
clause.body = this.parseBlock();
|
||||
node.handler = this.finishNode(clause, "CatchClause");
|
||||
}
|
||||
|
||||
9
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding-finally/actual.js
vendored
Normal file
9
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding-finally/actual.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
3
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding-finally/options.json
vendored
Normal file
3
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding-finally/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ( (4:6)"
|
||||
}
|
||||
6
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding/actual.js
vendored
Normal file
6
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding/actual.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
3
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding/options.json
vendored
Normal file
3
test/fixtures/experimental/optional-catch-binding/no-plugin-no-binding/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected ( (4:6)"
|
||||
}
|
||||
4
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding-finally/actual.js
vendored
Normal file
4
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding-finally/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
try {
|
||||
} catch (err) {
|
||||
} finally {
|
||||
}
|
||||
133
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding-finally/expected.json
vendored
Normal file
133
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding-finally/expected.json
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 8,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"param": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "err"
|
||||
},
|
||||
"name": "err"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 20,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": {
|
||||
"type": "BlockStatement",
|
||||
"start": 32,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
2
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding/actual.js
vendored
Normal file
2
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
try {
|
||||
} catch (err) {}
|
||||
117
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding/expected.json
vendored
Normal file
117
test/fixtures/experimental/optional-catch-binding/no-plugin-yes-binding/expected.json
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 8,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"param": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "err"
|
||||
},
|
||||
"name": "err"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": null
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
9
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/actual.js
vendored
Normal file
9
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/actual.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
117
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/expected.json
vendored
Normal file
117
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/expected.json
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 9,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"param": null,
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 15,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": {
|
||||
"type": "BlockStatement",
|
||||
"start": 28,
|
||||
"end": 34,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/options.json
vendored
Normal file
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding-finally/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["optionalCatchBinding"]
|
||||
}
|
||||
6
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/actual.js
vendored
Normal file
6
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/actual.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
try {
|
||||
|
||||
}
|
||||
catch {
|
||||
|
||||
}
|
||||
101
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/expected.json
vendored
Normal file
101
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/expected.json
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 9,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"param": null,
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 15,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": null
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/options.json
vendored
Normal file
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-no-binding/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["optionalCatchBinding"]
|
||||
}
|
||||
4
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding-finally/actual.js
vendored
Normal file
4
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding-finally/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
try {
|
||||
} catch (err) {
|
||||
} finally {
|
||||
}
|
||||
133
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding-finally/expected.json
vendored
Normal file
133
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding-finally/expected.json
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 8,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"param": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "err"
|
||||
},
|
||||
"name": "err"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 20,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": {
|
||||
"type": "BlockStatement",
|
||||
"start": 32,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["optionalCatchBinding"]
|
||||
}
|
||||
2
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/actual.js
vendored
Normal file
2
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/actual.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
try {
|
||||
} catch (err) {}
|
||||
117
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/expected.json
vendored
Normal file
117
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/expected.json
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "TryStatement",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"block": {
|
||||
"type": "BlockStatement",
|
||||
"start": 4,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
},
|
||||
"handler": {
|
||||
"type": "CatchClause",
|
||||
"start": 8,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"param": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "err"
|
||||
},
|
||||
"name": "err"
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"guardedHandlers": [],
|
||||
"finalizer": null
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/options.json
vendored
Normal file
3
test/fixtures/experimental/optional-catch-binding/yes-plugin-yes-binding/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["optionalCatchBinding"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user