Skip to content

Fixed inconsistent scoping of top-level variable declarations#795

Merged
Perryvw merged 10 commits intomasterfrom
bugfix/inconsistent-scoping-non-module
Jan 17, 2020
Merged

Fixed inconsistent scoping of top-level variable declarations#795
Perryvw merged 10 commits intomasterfrom
bugfix/inconsistent-scoping-non-module

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented Jan 9, 2020

We have the convention of treating files without imports or exports as 'global' scripts where all top-level variables are considered global.

Variable declarations however did not adhere to this convention, that has been corrected.

Fixes #720, closes #790

@Perryvw Perryvw requested a review from ark120202 January 9, 2020 21:16
const value1 = obj.value1;
const { value2 } = obj;

let noValueLet;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if it would be better to transform it to a nil assignment instead of just dropping it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe we should decide and do this in another PR

@Perryvw Perryvw merged commit 0f82db6 into master Jan 17, 2020
@Perryvw Perryvw deleted the bugfix/inconsistent-scoping-non-module branch January 17, 2020 17:25
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.

Destructuring leaks in blocks (do/end in Lua) Inconsistentcy in top-level variable handling in non-module files

2 participants