Skip to content

Avoid exporting anonymous identifiers#756

Merged
Perryvw merged 5 commits intoTypeScriptToLua:masterfrom
hazzard993:no-export-anonymous
Dec 3, 2019
Merged

Avoid exporting anonymous identifiers#756
Perryvw merged 5 commits intoTypeScriptToLua:masterfrom
hazzard993:no-export-anonymous

Conversation

@hazzard993
Copy link
Contributor

Closes #695

createLocalOrExportedOrGlobalDeclaration's logic couldn't tell if an identifier was an OmittedExpression so it treated it like any other identifier and put ____exports in front of it.

For this particular case I added an exportable flag to identifiers to indicate whether or not the identifier is intended to be exported / accessible.

@@ -0,0 +1 @@
export const [x, , y] = [1, 2, 3];
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a (disabled) test in destructuring.spec.ts:

test.each(testCases.filter(x => x.binding !== "[x, , y]" && x.binding !== "{ x, ...rest }"))(

Co-Authored-By: ark120202 <ark120202@gmail.com>
Co-Authored-By: ark120202 <ark120202@gmail.com>
Copy link
Contributor

@ark120202 ark120202 left a comment

Choose a reason for hiding this comment

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

I'm not a huge fan of adding such a flag to something as generic as an identifier, but I don't see any better solutions

@Perryvw Perryvw merged commit 757302b into TypeScriptToLua:master Dec 3, 2019
GameStreakerDE added a commit to NxeGamingNetwork/TypeScriptToLua that referenced this pull request Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exported array destructuring variable declaration with omitted expressions exports anonymous symbol

3 participants