Navigation Menu

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

Fix missing parens when function expressions is tag #5193

Merged
merged 2 commits into from Jan 23, 2017

Conversation

existentialism
Copy link
Member

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

@existentialism existentialism added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jan 23, 2017
@mention-bot
Copy link

@existentialism, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo, @loganfsmyth and @bjouhier to be potential reviewers.

@codecov-io
Copy link

codecov-io commented Jan 23, 2017

Current coverage is 89.22% (diff: 100%)

Merging #5193 into master will increase coverage by <.01%

@@             master      #5193   diff @@
==========================================
  Files           203        203          
  Lines          9835       9838     +3   
  Methods        1071       1071          
  Messages          0          0          
  Branches       2620       2624     +4   
==========================================
+ Hits           8775       8778     +3   
  Misses         1060       1060          
  Partials          0          0          

Powered by Codecov. Last update d76092b...f0ba77e

export function ArrowFunctionExpression(node: Object, parent: Object): boolean {
// export default (function () {});
if (t.isExportDeclaration(parent)) {
if (t.isTaggedTemplateExpression(parent)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the function expression case is fine, it's only the arrow function that needs fixing.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, I see why you added this.

function(){}`foo`

is fine as long as it is in an expression context, so I'd be in favor of expanding isFirstInStatement to handle functions in tagged templates, are you up for that? So your test output would be

(() => {})``;
(function(){}``);

@loganfsmyth loganfsmyth merged commit b69dc51 into babel:master Jan 23, 2017
@existentialism existentialism deleted the issue5192 branch January 23, 2017 16:46
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 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.

Missing Parens. Syntax Error after transforming ArrowFn as Callee
5 participants