-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
existentialism
commented
Jan 23, 2017
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, 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. |
Current coverage is 89.22% (diff: 100%)@@ 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
|
export function ArrowFunctionExpression(node: Object, parent: Object): boolean { | ||
// export default (function () {}); | ||
if (t.isExportDeclaration(parent)) { | ||
if (t.isTaggedTemplateExpression(parent)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(){}``);
74b9375
to
f0ba77e
Compare