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

Add new.target transform #5906

Merged
merged 10 commits into from Jul 7, 2017

Conversation

Projects
None yet
5 participants
@jridgewell
Member

jridgewell commented Jun 30, 2017

Q A
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? Yes
Deprecations? No
Spec Compliancy? Yes?
Tests Added/Pass? Yes
Fixed Tickets Fixes #1088
License MIT
Doc PR
Dependency Changes

Transforms new.target into a (correct in most cases) this.constructor expression.

@xtuc

xtuc approved these changes Jun 30, 2017

@jridgewell

This comment has been minimized.

Member

jridgewell commented Jul 1, 2017

I realized we could transform all Class uses of new.target, because the constructors have to be called as constructors. Now the only real edge cases are using new.target before super(), and ES5-style function class inheritance.

@existentialism

This comment has been minimized.

Member

existentialism commented Jul 7, 2017

/cc: @getify @stevenvachon

@existentialism

👍

@jridgewell jridgewell merged commit 628061c into babel:7.0 Jul 7, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/project 85.68% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jridgewell jridgewell deleted the jridgewell:new-target branch Jul 7, 2017

GulajavaMinistudio added a commit to GulajavaMinistudio/babel that referenced this pull request Jul 7, 2017

Merge pull request #61 from babel/7.0
Update upstream Add new.target transform (babel#5906)
class Bar {
constructor() {
var _newtarget2 = this.constructor;

This comment has been minimized.

@bergus

bergus Jul 11, 2017

Not sure why this variable should have a 2 suffix?

This comment has been minimized.

@jridgewell

jridgewell Jul 11, 2017

Member

That's how babel generateUidIdentifier works, it's unique globally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment