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

Computed class properties #4500

Merged
merged 5 commits into from Sep 26, 2016
Merged

Conversation

motiz88
Copy link
Contributor

@motiz88 motiz88 commented Sep 11, 2016

Q A
Bug fix? yes1
Breaking change? no (but see note2)
New feature? no1
Deprecations? no
Spec compliancy? yes
Tests added/pass? yes 3, 4
Fixed tickets #4499
License MIT
Documentation included (babel-types README only)

Comments on the above table

1: As a first-time contributor it's kinda hard for me to classify this change 😄
It tracks a roughly year-old update to a stage 2 proposal (tc39/proposal-class-public-fields), which is otherwise already implemented.

2: I suppose the addition of computed as the third (and not last) builder argument in babel-types/src/definitions/flow.js#L47 may be considered a breaking change to clients of that package (but what was the behavior there in the absence of the builder property, anyway?). I'll happily change it to whatever you people prefer. Superseded by the latest commit per @danez's suggestion.

3: I did not add tests for my changes to babel-types, because I could not find any existing tests for this package. (Am I missing something?)

4: The full test suite doesn't run to completion on my Windows dev machine, but what did run seems OK.

Notes on the change

Depends on babel/babylon#121 which has been released in Babylon v6.11.0.

Changes to individual modules:

  • babel-types: Add computed field to ClassProperty
  • babel-plugin-transform-class-properties: handle computed property names correctly
  • babel-generator: add tests for class properties (computed/literal, static/instance)

** Depends on babel/babylon#121 **

* `babel-types`: Add `computed` field to `ClassProperty`

* `babel-plugin-transform-class-properties`: handle computed property names correctly

* `babel-generator`: add tests for class properties (computed/literal, static/instance)
motiz88 added a commit to motiz88/babel-plugin-transform-hoist-nested-functions that referenced this pull request Sep 11, 2016
…ue`)

See README.md for documentation.

This feature is blocked on the following Babel PRs/issues:
* babel/babel#4500
* babel/babylon#121
* babel/babel#4337
* babel/babel#4230 (partially)
@hzoo hzoo added PR: New Feature 🚀 A type of pull request used for our changelog categories es-proposal labels Sep 14, 2016
@danez
Copy link
Member

danez commented Sep 22, 2016

2: If there is no builder entry in the type it defaults to visitors: https://github.com/babel/babel/blob/master/packages/babel-types/src/definitions/index.js#L135 This is definitely a breaking change, would it be okey to make computes the last argument?

@codecov-io
Copy link

Current coverage is 88.38% (diff: 100%)

Merging #4500 into master will increase coverage by 0.02%

@@             master      #4500   diff @@
==========================================
  Files           194        194          
  Lines         13628      13635     +7   
  Methods        1427       1427          
  Messages          0          0          
  Branches       3152       3155     +3   
==========================================
+ Hits          12041      12051    +10   
+ Misses         1587       1584     -3   
  Partials          0          0          

Powered by Codecov. Last update c07919b...37fad77

Copy link
Member

@danez danez left a comment

Choose a reason for hiding this comment

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

We should really consider writing tests for babel-types especially the logic for validators, but I wouldn't block this PR because of that.

@danez danez merged commit 03d772c into babel:master Sep 26, 2016
@danez
Copy link
Member

danez commented Sep 26, 2016

thanks.

@hzoo
Copy link
Member

hzoo commented Sep 26, 2016

@danez can make an issue for that

@motiz88 motiz88 deleted the computed-class-properties branch September 26, 2016 16:06
panagosg7 pushed a commit to panagosg7/babel that referenced this pull request Jan 17, 2017
* Support computed class property names (babel#4499)

** Depends on babel/babylon#121 **

* `babel-types`: Add `computed` field to `ClassProperty`

* `babel-plugin-transform-class-properties`: handle computed property names correctly

* `babel-generator`: add tests for class properties (computed/literal, static/instance)

* doc: Update babel-types with ClassProperty.computed

* chore(package): update babylon to v6.11.0

* babel-types: move ClassProperty.computed to be last builder arg
motiz88 added a commit to motiz88/babel-plugin-transform-hoist-nested-functions that referenced this pull request Apr 2, 2017
…ue`)

See README.md for documentation.

This feature is blocked on the following Babel PRs/issues:
* babel/babel#4500
* babel/babylon#121
* babel/babel#4337
* babel/babel#4230 (partially)
motiz88 added a commit to motiz88/babel-plugin-transform-hoist-nested-functions that referenced this pull request Apr 2, 2017
…ue`)

See README.md for documentation.

This feature is blocked on the following Babel PRs/issues:
* babel/babel#4500
* babel/babylon#121
* babel/babel#4337
* babel/babel#4230 (partially)
motiz88 added a commit to motiz88/babel-plugin-transform-hoist-nested-functions that referenced this pull request Apr 2, 2017
…ue`)

See README.md for documentation.

This feature is blocked on the following Babel PRs/issues:
* babel/babel#4500
* babel/babylon#121
* babel/babel#4337
* babel/babel#4230 (partially)
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 7, 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: New Feature 🚀 A type of pull request used for our changelog categories Spec: Class Fields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants