Fixes export destructured variables reference#32007
Merged
rbuckton merged 4 commits intomicrosoft:masterfrom Aug 5, 2019
Merged
Fixes export destructured variables reference#32007rbuckton merged 4 commits intomicrosoft:masterfrom
rbuckton merged 4 commits intomicrosoft:masterfrom
Conversation
ajafff
reviewed
Jun 21, 2019
| return p.name !== node ? undefined : | ||
| p.parent.kind === SyntaxKind.CatchClause ? undefined : p.parent.parent.kind === SyntaxKind.VariableStatement ? p.parent.parent : undefined; | ||
| } | ||
| else if (parent.parent && parent.parent.parent && parent.parent.parent.kind === SyntaxKind.VariableDeclaration) { |
Contributor
There was a problem hiding this comment.
does this work for binding elements of arbitrary nesting?
export const {foo: [bar, {baz: bas}]} = someObj;You probably want to use walkUpBindingElementsAndPatterns to get the VariableDeclaration of the BindingElement.
| path: "/mod.ts", | ||
| content: `export const value = 0; | ||
| export const [valueA, valueB] = [0, 1]; | ||
| export const { valueC, valueD } = { valueC: 0, valueD: 1 };`, |
Contributor
There was a problem hiding this comment.
can you add a test that renames the destructured property export const {foo: bar} = {foo: 2} to make sure this works as expected
85771cf to
58ebc92
Compare
Contributor
Author
|
@ajafff Thank you for your review, I fixed them |
f2758db to
7c1dcb7
Compare
f53d3e5 to
7953690
Compare
rbuckton
suggested changes
Jun 28, 2019
| ...override, | ||
| }); | ||
|
|
||
| it("should get const variable decralation references", () => { |
Contributor
There was a problem hiding this comment.
Suggested change
| it("should get const variable decralation references", () => { | |
| it("should get const variable declaration references", () => { |
| assert.deepEqual(response, expectResponse); | ||
| }); | ||
|
|
||
| it("should get array destructuring decralation references", () => { |
Contributor
There was a problem hiding this comment.
Suggested change
| it("should get array destructuring decralation references", () => { | |
| it("should get array destructuring declaration references", () => { |
| assert.deepEqual(response, expectResponse); | ||
| }); | ||
|
|
||
| it("should get object destructuring decralation references", () => { |
Contributor
There was a problem hiding this comment.
Suggested change
| it("should get object destructuring decralation references", () => { | |
| it("should get object destructuring declaration references", () => { |
| assert.deepEqual(response, expectResponse); | ||
| }); | ||
|
|
||
| it("should get object decralation references that renames destructured property", () => { |
Contributor
There was a problem hiding this comment.
Suggested change
| it("should get object decralation references that renames destructured property", () => { | |
| it("should get object declaration references that renames destructured property", () => { |
| assert.deepEqual(response, expectResponse); | ||
| }); | ||
|
|
||
| it("should get nested object decralation references", () => { |
Contributor
There was a problem hiding this comment.
Suggested change
| it("should get nested object decralation references", () => { | |
| it("should get nested object declaration references", () => { |
7953690 to
55e8ba9
Compare
Contributor
Author
|
@rbuckton Thank you for your review, I fixed each commits to use rebase and edit. |
b2fcb06 to
a1c5600
Compare
b9810ad to
1829d7b
Compare
878d7f5 to
9cecb5d
Compare
9cecb5d to
02294a7
Compare
02294a7 to
c04ef90
Compare
rbuckton
approved these changes
Aug 5, 2019
Contributor
|
Thanks for the contribution! |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #31922