Skip to content

Hotfix: Do not deconflict "undefined"#2291

Merged
lukastaegert merged 2 commits into
masterfrom
do-not-deconflict-undefined
Jun 21, 2018
Merged

Hotfix: Do not deconflict "undefined"#2291
lukastaegert merged 2 commits into
masterfrom
do-not-deconflict-undefined

Conversation

@lukastaegert

Copy link
Copy Markdown
Member

@guybedford guybedford left a comment

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.

Thanks for fixing this up.

Comment thread src/ast/scopes/Scope.ts Outdated
this?: ThisVariable | LocalVariable;
default?: ExportDefaultVariable;
arguments?: ArgumentsVariable;
undefined?: UndefinedVariable;

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 left this out previously, because undefined can actually be redefined as a variable identifier, so in theory we should allow it to be deshadowed.

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.

Ah yes, removed the type from the list. I think redeclarations should be handled properly, though, as a local declaration would of course shadow the global one now.

}

getLiteralValueAtPath(): LiteralValueOrUnknown {
return undefined;

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.

What cases would this apply to?

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.

This applies to all situations where the global undefined variable is used.

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.

That is all situations where undefined is accessed and has not been redeclared.

@lukastaegert lukastaegert force-pushed the do-not-deconflict-undefined branch from 824332b to c498dd2 Compare June 21, 2018 10:11
@lukastaegert

Copy link
Copy Markdown
Member Author

Added a simple test where "undefined" is used as a function parameter and set to "true" via the function call to make sure we do not break this important functionality in the future 😜

@lukastaegert lukastaegert added this to the 0.61.1 milestone Jun 21, 2018
@guybedford

Copy link
Copy Markdown
Contributor

Glad to know we're covering that important treeshaking scenario for our users!

@lukastaegert lukastaegert merged commit 5b352ce into master Jun 21, 2018
@lukastaegert lukastaegert deleted the do-not-deconflict-undefined branch June 21, 2018 11:19
calebeby referenced this pull request in Pigmice2733/scouting-frontend Jun 21, 2018
This Pull Request updates dependency [rollup](https://github.com/rollup/rollup) from `v0.60.7` to `v0.61.1`



<details>
<summary>Release Notes</summary>

### [`v0.61.1`](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#&#8203;0611)
[Compare Source](rollup/rollup@v0.61.0...697f36d)
*2018-06-21*
* Do not try to deconflict "undefined" ([#&#8203;2291](`https://github.com/rollup/rollup/pull/2291`))
* Properly track values for loop interator declarations and reassigned namespaces, add smoke test ([#&#8203;2292](`https://github.com/rollup/rollup/pull/2292`))

---

### [`v0.61.0`](https://github.com/rollup/rollup/blob/master/CHANGELOG.md#&#8203;0610)
[Compare Source](rollup/rollup@v0.60.7...v0.61.0)
*2018-06-20*
* Declare file dependencies via transform plugin hooks ([#&#8203;2259](`https://github.com/rollup/rollup/pull/2259`))
* Handle undefined values when evaluating conditionals ([#&#8203;2264](`https://github.com/rollup/rollup/pull/2264`))
* Handle known undefined properties when evaluating conditionals ([#&#8203;2265](`https://github.com/rollup/rollup/pull/2265`))
* Access watch events via the plugin context ([#&#8203;2261](`https://github.com/rollup/rollup/pull/2261`))
* Add option to suppress `__esModule` flag in output ([#&#8203;2287](`https://github.com/rollup/rollup/pull/2287`))
* Fix issue when re-declaring variables, track reassignments in more cases ([#&#8203;2279](`https://github.com/rollup/rollup/pull/2279`))
* Add VSCode debug settings ([#&#8203;2276](`https://github.com/rollup/rollup/pull/2276`))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
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.

Rollup adds $0 to undefined

2 participants