Support more node types in generateUidBasedOnNode (#11260)

* Support more node types in generateUidBasedOnNode

* More nodes
This commit is contained in:
Justin Ridgewell
2020-03-14 11:24:50 -04:00
committed by GitHub
parent b85d9f57f6
commit 661ffbd830
13 changed files with 192 additions and 101 deletions

View File

@@ -6,11 +6,11 @@ var _$a = {
1: 1,
a: 1
},
_ref = key++,
_key = key++,
{
[_ref]: y
[_key]: y
} = _$a,
x = babelHelpers.objectWithoutProperties(_$a, [_ref].map(babelHelpers.toPropertyKey));
x = babelHelpers.objectWithoutProperties(_$a, [_key].map(babelHelpers.toPropertyKey));
expect(x).toEqual({
a: 1
@@ -24,13 +24,13 @@ var _$ = {
2: 2,
3: 3
},
_ref2 = ++key,
_ref3 = ++key,
_key2 = ++key,
_key3 = ++key,
{
[_ref2]: y,
[_ref3]: z
[_key2]: y,
[_key3]: z
} = _$,
rest = babelHelpers.objectWithoutProperties(_$, [_ref2, _ref3].map(babelHelpers.toPropertyKey));
rest = babelHelpers.objectWithoutProperties(_$, [_key2, _key3].map(babelHelpers.toPropertyKey));
expect(y).toBe(2);
expect(z).toBe(3); // pure, computed property should remain as-is

View File

@@ -2,9 +2,9 @@ var key, x, y, z; // impure
key = 1;
var _ref = key++,
var _key = key++,
{
[_ref]: {
[_key]: {
y
}
} = {
@@ -18,7 +18,7 @@ var _ref = key++,
a: 1,
y: 1
}
}[_ref], ["y"]);
}[_key], ["y"]);
expect(x).toEqual({
a: 1
@@ -38,18 +38,18 @@ var _$ = {
z: 3
}
},
_ref2 = ++key,
_ref3 = ++key,
_key2 = ++key,
_key3 = ++key,
{
[_ref3]: {
[_key3]: {
y
},
[_ref2]: {
[_key2]: {
z
}
} = _$,
rest_y = babelHelpers.objectWithoutProperties(_$[_ref3], ["y"]),
rest_z = babelHelpers.objectWithoutProperties(_$[_ref2], ["z"]);
rest_y = babelHelpers.objectWithoutProperties(_$[_key3], ["y"]),
rest_z = babelHelpers.objectWithoutProperties(_$[_key2], ["z"]);
expect(y).toBe(2);
expect(rest_y).toEqual({