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

`function.sent` proposal prevents other plugins from transforming subsequent code in the generator function scope #9825

Open
myuseringithub opened this Issue Apr 5, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@myuseringithub
Copy link

commented Apr 5, 2019

Subsequent transforms after using function.sent in the generator scope are ignored when using shorthand syntax method definition.

When using @babel/babel-plugin-proposal-function-sent together with:

or

The Issue

In a generator function using the shorthand syntax, logical assignments after function.sent usage are being ignored and not transformed.

let t;
const o = {
  *s(){
    t ||= 'value'; // former logical assignment - ✔ Transformed 
    function.sent;
    t ||= 'value'; // latter logical assignment - ❌ Not transformed
  }
}

Example where function bind isn't being transformed:

babeljs.io/repl example

Work around

Use named property instead of shorthand syntax for method definition
i.e. the following works:

let t;
const o = {
  s: function*(){ // ❗ notice the named property method definition
    t ||= 'value'; // former logical assignment - ✔ Transformed 
    function.sent;
    t ||= 'value'; // latter logical assignment - ✔ Transformed 
  }
}

Version

Babel 7.4.3

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Apr 5, 2019

Hey @myuseringithub! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@myuseringithub myuseringithub changed the title `function.sent` proposal prevents other plugins from transforming subsequent code in the function scope `function.sent` proposal prevents other plugins from transforming subsequent code in the generator function scope Apr 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.