Assign another temp var when parsing assignment patterns in destructuring (#7333)
This commit is contained in:
5
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/exec.js
vendored
Normal file
5
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/exec.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const getState = () => ({});
|
||||
|
||||
const { data: { courses: oldCourses = [] } = {} } = getState();
|
||||
|
||||
assert.deepEqual(oldCourses, []);
|
||||
1
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/input.js
vendored
Normal file
1
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
const { data: { courses: oldCourses = [] } = {} } = getState();
|
||||
3
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/options.json
vendored
Normal file
3
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-destructuring"]
|
||||
}
|
||||
5
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/output.js
vendored
Normal file
5
packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/const/output.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const _getState = getState(),
|
||||
_getState$data = _getState.data,
|
||||
_getState$data2 = _getState$data === void 0 ? {} : _getState$data,
|
||||
_getState$data2$cours = _getState$data2.courses,
|
||||
oldCourses = _getState$data2$cours === void 0 ? [] : _getState$data2$cours;
|
||||
Reference in New Issue
Block a user