-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
nicolo-ribaudo
merged 12 commits into
babel:main
from
SuperSodaSea:fix/computed-properties-order
Dec 5, 2022
+188
−82
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4061dae
fix: Computed properties should keep order
SuperSodaSea ed1f8c3
Merge remote-tracking branch 'upstream/main' into fix/computed-proper…
SuperSodaSea 86acf87
Rename test
SuperSodaSea 16758f3
Update new-version-checklist
SuperSodaSea 1fd56a3
Change parameter order of defineAccessor
SuperSodaSea c735135
Update test spec/definition-order
SuperSodaSea 71a045c
Merge branch 'main' into fix/computed-properties-order
SuperSodaSea b8acd2e
Add fallback for helper function
SuperSodaSea 8a6ccb4
Better helper fallback
liuxingbaoyu 666e7de
Apply suggestions from code review
SuperSodaSea dac736c
Cleanup
SuperSodaSea b16daaf
Merge remote-tracking branch 'upstream/main' into fix/computed-proper…
SuperSodaSea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rename test
- Loading branch information
commit 86acf8769736bc6cae605dfb231e01f213953743
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
packages/babel-plugin-transform-computed-properties/test/fixtures/regression/15140/exec.js
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/babel-plugin-transform-computed-properties/test/fixtures/regression/15140/input.js
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
packages/babel-plugin-transform-computed-properties/test/fixtures/regression/15140/output.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...es/babel-plugin-transform-computed-properties/test/fixtures/spec/definition-order/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; | ||
expect(x.x).toBe(undefined); | ||
x.x = 1; | ||
expect(x.x).toBe(1); |
12 changes: 12 additions & 0 deletions
12
...s/babel-plugin-transform-computed-properties/test/fixtures/spec/definition-order/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
.../babel-plugin-transform-computed-properties/test/fixtures/spec/definition-order/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c735135.