support patterns in constants
This commit is contained in:
2
test/fixtures/syntax/constants/destructuring-assignment/actual.js
vendored
Normal file
2
test/fixtures/syntax/constants/destructuring-assignment/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
const [a, b] = [1, 2];
|
||||
a = 3;
|
||||
3
test/fixtures/syntax/constants/destructuring-assignment/options.json
vendored
Normal file
3
test/fixtures/syntax/constants/destructuring-assignment/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "a is read-only"
|
||||
}
|
||||
4
test/fixtures/syntax/constants/destructuring/actual.js
vendored
Normal file
4
test/fixtures/syntax/constants/destructuring/actual.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const [a, b] = [1, 2];
|
||||
const [c, d] = [3, 4];
|
||||
const { e, f } = { e: 5, f: 6 };
|
||||
const { a: g, b: h } = { a: 7, b: 8 };
|
||||
23
test/fixtures/syntax/constants/destructuring/expected.js
vendored
Normal file
23
test/fixtures/syntax/constants/destructuring/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(function () {
|
||||
var _ref = [1, 2];
|
||||
var a = _ref[0];
|
||||
var b = _ref[1];
|
||||
|
||||
var _ref2 = [3, 4];
|
||||
var c = _ref2[0];
|
||||
var d = _ref2[1];
|
||||
|
||||
var _ref3 = {
|
||||
e: 5,
|
||||
f: 6
|
||||
};
|
||||
var e = _ref3.e;
|
||||
var f = _ref3.f;
|
||||
|
||||
var _ref4 = {
|
||||
a: 7,
|
||||
b: 8
|
||||
};
|
||||
var g = _ref4.a;
|
||||
var h = _ref4.b;
|
||||
})();
|
||||
Reference in New Issue
Block a user