Skip to content
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

Correctly update bindings of decorated class declarations #8566

Merged
merged 4 commits into from Sep 27, 2022

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Aug 28, 2018

Q                       A
Fixed Issues? Fixes #8559
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This commit adds a small utility (Scope#updateOwnBinding) which
should be used whenever you replace a declaration with a new
delaration which defines the same binding (e.g. class Foo {} ->
let Foo = class Foo {}). Since our scope system isn't currently
synchrinized with the AST, doing this automatically would add too
much overhead to the replaceWith* functions.

That function probably needs to be used in many more places, but we
can add them when users find bugs related to non-updated bingins.

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: traverse (scope) Spec: Decorators (Legacy) labels Aug 28, 2018
@babel-bot
Copy link
Collaborator

babel-bot commented Aug 28, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/53035/

@babel-bot
Copy link
Collaborator

babel-bot commented Aug 28, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8958/

@nicolo-ribaudo nicolo-ribaudo force-pushed the bug-8559 branch 3 times, most recently from c4dec1c to 0131e08 Compare Aug 30, 2018
@TrejGun
Copy link

TrejGun commented Oct 28, 2018

any chance to get this merged?

@agrasley
Copy link

agrasley commented Jan 31, 2019

I'm running into this issue while trying to upgrade to Babel 7. Would appreciate an update.

@VincentMolinie
Copy link

VincentMolinie commented Sep 8, 2022

Can I help in some way on that subject ? Could be nice to see this merge, it has been 4 years now 😅

@liuxingbaoyu liuxingbaoyu changed the base branch from master to main Sep 26, 2022
@liuxingbaoyu liuxingbaoyu force-pushed the bug-8559 branch 2 times, most recently from 698ebce to 6f34112 Compare Sep 26, 2022
@nicolo-ribaudo nicolo-ribaudo merged commit e0685ad into babel:main Sep 27, 2022
43 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the bug-8559 branch Sep 27, 2022
cbush pushed a commit to mongodb/docs-realm that referenced this pull request Nov 23, 2022
<h3>Snyk has created this PR to upgrade @babel/core from 7.19.3 to
7.19.6.</h3>

ℹ️ Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.
<hr/>

- The recommended version is **1 version** ahead of your current
version.
- The recommended version was released **22 days ago**, on 2022-10-20.


<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@babel/core</b></summary>
    <ul>
      <li>
<b>7.19.6</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.19.6">2022-10-20</a></br><h2>v7.19.6
(2022-10-20)</h2>
<p>Thanks <a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/lomirus/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://snyk.io/redirect/github/lomirus">@ lomirus</a> for your
first PR!</p>
<h4><g-emoji class="g-emoji" alias="eyeglasses"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f453.png">👓</g-emoji>
Spec Compliance</h4>
<ul>
<li><code>babel-plugin-proposal-decorators</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15059"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15059/hovercard">#15059</a> Ensure
non-static decorators are applied when a class is instantiated. (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="bug"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji>
Bug Fix</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15062"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15062/hovercard">#15062</a> Fix
parsing of block comments nested in flow comments (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15052"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15052/hovercard">#15052</a> fix:
improve module block program location tracking (<a
href="https://snyk.io/redirect/github/JLHwung">@ JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-plugin-transform-runtime</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15060"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15060/hovercard">#15060</a> Ensure
<code>@ babel/runtime-corejs3/core-js/*.js</code> can be imported on
Node.js 17+ (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
</ul>
</li>
<li><code>babel-preset-env</code>, <code>babel-traverse</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15043"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15043/hovercard">#15043</a> fix:
preserve this for <code>super.*</code> template tags (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="nail_care"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f485.png">💅</g-emoji>
Polish</h4>
<ul>
<li><code>babel-generator</code>,
<code>babel-plugin-transform-flow-comments</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15037"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15037/hovercard">#15037</a>
Improve generation of comments without location (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="memo"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4dd.png">📝</g-emoji>
Documentation</h4>
<ul>
<li><code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15055"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15055/hovercard">#15055</a> Fix
missing <code>transformSync</code> function name (<a
href="https://snyk.io/redirect/github/lomirus">@ lomirus</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="house"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f3e0.png">🏠</g-emoji>
Internal</h4>
<ul>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15056"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15056/hovercard">#15056</a> Use
<code>startLoc.index</code> instead of carrying around
<code>start</code> (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li>Other
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15035"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15035/hovercard">#15035</a> chore:
Update yarn 3.2.4 (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="running_woman"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f3c3-2640.png">🏃‍♀️</g-emoji>
Performance</h4>
<ul>
<li><code>babel-core</code>, <code>babel-standalone</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/15023"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/15023/hovercard">#15023</a> Don't
bundle unnecessary plugins in <code>@ babel/standalone</code> (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 4</h4>
<ul>
<li>Huáng Jùnliàng (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
<li>Lomírus (<a href="https://snyk.io/redirect/github/lomirus">@
lomirus</a>)</li>
<li>Nicolò Ribaudo (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a></li>
</ul>
      </li>
      <li>
<b>7.19.3</b> - <a
href="https://snyk.io/redirect/github/babel/babel/releases/tag/v7.19.3">2022-09-27</a></br><h2>v7.19.3
(2022-09-27)</h2>
<h4><g-emoji class="g-emoji" alias="bug"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f41b.png">🐛</g-emoji>
Bug Fix</h4>
<ul>
<li><code>babel-plugin-proposal-decorators</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/8566"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/8566/hovercard">#8566</a>
Correctly update bindings of decorated class declarations (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
<li><code>babel-parser</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14974"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14974/hovercard">#14974</a> fix:
Normal parsing of <code>JSXText</code> following
<code>JSXSpreadChild</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14941"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14941/hovercard">#14941</a> fix:
Support local exports in TS <code>declare module</code>s (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14940"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14940/hovercard">#14940</a> fix:
allow ts redeclaration with <code>import =</code> and <code>var</code>
(<a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
<li><code>babel-generator</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14962"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14962/hovercard">#14962</a> Fix
printing of Flow internal slot functions (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
<li><code>babel-cli</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14950"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14950/hovercard">#14950</a> Emit
<code>@ babel/cli</code> source maps based on configuration files (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
<li><code>babel-plugin-transform-typescript</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14946"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14946/hovercard">#14946</a> fix:
ts exported vars are shadowed by <code>declare</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="nail_care"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f485.png">💅</g-emoji>
Polish</h4>
<ul>
<li><code>babel-core</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14954"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14954/hovercard">#14954</a>
Optional filename when preset uses fn test/include/exclude (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="house"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f3e0.png">🏠</g-emoji>
Internal</h4>
<ul>
<li><code>babel-helper-compilation-targets</code>,
<code>babel-helper-transform-fixture-test-runner</code>,
<code>babel-parser</code>, <code>babel-preset-env</code>,
<code>babel-traverse</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14961"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14961/hovercard">#14961</a> chore:
use <code>c8</code> for coverage testing (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4><g-emoji class="g-emoji" alias="microscope"
fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f52c.png">🔬</g-emoji>
Output optimization</h4>
<ul>
<li><code>babel-plugin-transform-typescript</code>
<ul>
<li><a href="https://snyk.io/redirect/github/babel/babel/pull/14952"
data-hovercard-type="pull_request"
data-hovercard-url="/babel/babel/pull/14952/hovercard">#14952</a> [ts]
remove nested <code>declare namespace</code> (<a
href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 4</h4>
<ul>
<li>Babel Bot (<a href="https://snyk.io/redirect/github/babel-bot">@
babel-bot</a>)</li>
<li>Huáng Jùnliàng (<a href="https://snyk.io/redirect/github/JLHwung">@
JLHwung</a>)</li>
<li>Nicolò Ribaudo (<a
href="https://snyk.io/redirect/github/nicolo-ribaudo">@
nicolo-ribaudo</a>)</li>
<li><a href="https://snyk.io/redirect/github/liuxingbaoyu">@
liuxingbaoyu</a></li>
</ul>
      </li>
    </ul>
from <a
href="https://snyk.io/redirect/github/babel/babel/releases">@babel/core
GitHub release notes</a>
  </details>
</details>
<hr/>

**Note:** *You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs.*

For more information: <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI4YTI0ZDU1Zi0xM2Y3LTRhZjUtODhmNi1jNTk4ZTU3M2UyOTkiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjhhMjRkNTVmLTEzZjctNGFmNS04OGY2LWM1OThlNTczZTI5OSJ9fQ=="
width="0" height="0"/>

🧐 [View latest project
report](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55/settings/integration?pkg&#x3D;@babel/core&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

<!---
(snyk:metadata:{"prId":"8a24d55f-13f7-4af5-88f6-c598e573e299","prPublicId":"8a24d55f-13f7-4af5-88f6-c598e573e299","dependencies":[{"name":"@babel/core","from":"7.19.3","to":"7.19.6"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/sandbox-2ba/project/852e6e4f-be96-45c8-b370-1060f5ebee55?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"852e6e4f-be96-45c8-b370-1060f5ebee55","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2022-10-20T09:03:36.074Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]})
--->

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: traverse (scope) PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Decorators (Legacy)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate declaration error in 7.0.0 with decorators, nested functions, ES6 modules, and a node target
7 participants