Skip to content

System modules - Hoist classes like other variables#9639

Merged
nicolo-ribaudo merged 1 commit intobabel:masterfrom
guybedford:system-class-hoist
Mar 10, 2019
Merged

System modules - Hoist classes like other variables#9639
nicolo-ribaudo merged 1 commit intobabel:masterfrom
guybedford:system-class-hoist

Conversation

@guybedford
Copy link
Contributor

@guybedford guybedford commented Mar 5, 2019

Q                       A
Fixed Issues? No tracking issue
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link N/A
Any Dependency Changes? No
License MIT

The system module format hoists all variables, but does not currently hoist classes.

These leads to code like the following executing incorrectly:

export function test () {
  return X;
}
class X {}

as the function is hoisted, but its reference to the class isn't.

Bug fix and tests included here.

In the process I've also combined _export calls where possible.

@babel-bot
Copy link
Collaborator

babel-bot commented Mar 5, 2019

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

@guybedford guybedford force-pushed the system-class-hoist branch from 3137c80 to dacd930 Compare March 5, 2019 20:48
@danez danez added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Mar 5, 2019
@nicolo-ribaudo
Copy link
Member

Thank you!

@nicolo-ribaudo nicolo-ribaudo merged commit a891b73 into babel:master Mar 10, 2019
mAAdhaTTah added a commit to mAAdhaTTah/babel that referenced this pull request Mar 15, 2019
* master: (58 commits)
  Remove dependency on home-or-tmp package (babel#9678)
  [proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys (babel#9628)
  Partial application plugin (babel#9474)
  Private Static Class Methods (Stage 3) (babel#9446)
  gulp-uglify@3.0.2
  rollup@1.6.0
  eslint@5.15.1
  jest@24.5.0
  regexpu-core@4.5.4
  Remove input and length from state (babel#9646)
  Switch from rollup-stream to rollup and update deps (babel#9640)
  System modules - Hoist classes like other variables (babel#9639)
  fix: Don't transpile ES2018 symbol properties (babel#9650)
  Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (babel#9647)
  Update regexpu-core dependency (babel#9642)
  Add placeholders support to @babel/types and @babel/generator (babel#9542)
  Generate plugins file
  Make babel-standalone an ESModule and enable flow (babel#9025)
  Reorganize token types and use a map for them (babel#9645)
  [TS] Allow context type annotation on getters/setters (babel#9641)
  ...
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants