Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Computed properties should keep original definition order #15232

Merged
merged 12 commits into from
Dec 5, 2022
Prev Previous commit
Next Next commit
Rename test
  • Loading branch information
SuperSodaSea committed Nov 29, 2022
commit 86acf8769736bc6cae605dfb231e01f213953743

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var a = {
get ["x"]() { return 0; },
["y"]: 1,
};
expect(Object.keys(a)).toStrictEqual(["x", "y"]);

var b = {
get ["x"]() { return 0; },
["x"]: 1,
};
expect(b.x).toBe(1);

var x = { x, get x() { return 0; }, x };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, can you use two different variables?

var y = { x, get x() { return 0; }, x };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c735135.

expect(x.x).toBe(undefined);
x.x = 1;
expect(x.x).toBe(1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var a = {
get ["x"]() { return 0; },
["y"]: 1,
};

var b = {
get ["x"]() { return 0; },
["x"]: 1,
};

var x = { x, get x() { return 0; }, x };
x.x = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var _a, _b, _x;
var a = (_a = {}, babelHelpers.defineAccessor(_a, "x", "get", function () {
return 0;
}), babelHelpers.defineProperty(_a, "y", 1), _a);
var b = (_b = {}, babelHelpers.defineAccessor(_b, "x", "get", function () {
return 0;
}), babelHelpers.defineProperty(_b, "x", 1), _b);
var x = (_x = {
x
}, babelHelpers.defineAccessor(_x, "x", "get", function () {
return 0;
}), babelHelpers.defineProperty(_x, "x", x), _x);
x.x = 1;