parent
5f73ba29ed
commit
f9e324c4d0
|
@ -411,6 +411,7 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
(n.body.type === "ArrayExpression" ||
|
||||
n.body.type === "ObjectExpression" ||
|
||||
n.body.type === "BlockStatement" ||
|
||||
n.body.type === "SequenceExpression" ||
|
||||
isTemplateOnItsOwnLine(n.body, options.originalText) ||
|
||||
n.body.type === "ArrowFunctionExpression")
|
||||
) {
|
||||
|
@ -1033,8 +1034,28 @@ function genericPrintNoParens(path, options, print, args) {
|
|||
}
|
||||
|
||||
return concat(parts);
|
||||
case "SequenceExpression":
|
||||
return join(", ", path.map(print, "expressions"));
|
||||
case "SequenceExpression": {
|
||||
const parent = path.getParentNode();
|
||||
const shouldInline =
|
||||
parent.type === "ReturnStatement" ||
|
||||
parent.type === "ForStatement" ||
|
||||
parent.type === "ExpressionStatement";
|
||||
|
||||
if (shouldInline) {
|
||||
return join(", ", path.map(print, "expressions"));
|
||||
}
|
||||
return group(
|
||||
concat([
|
||||
indent(
|
||||
concat([
|
||||
softline,
|
||||
join(concat([",", line]), path.map(print, "expressions"))
|
||||
])
|
||||
),
|
||||
softline
|
||||
])
|
||||
);
|
||||
}
|
||||
case "ThisExpression":
|
||||
return "this";
|
||||
case "Super":
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`break.js 1`] = `
|
||||
const f = (argument1, argument2, argument3) =>
|
||||
(doSomethingWithArgument(argument1), doSomethingWithArgument(argument2),argument1)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const f = (argument1, argument2, argument3) => (
|
||||
doSomethingWithArgument(argument1),
|
||||
doSomethingWithArgument(argument2),
|
||||
argument1
|
||||
);
|
||||
|
||||
`;
|
|
@ -0,0 +1,2 @@
|
|||
const f = (argument1, argument2, argument3) =>
|
||||
(doSomethingWithArgument(argument1), doSomethingWithArgument(argument2),argument1)
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname);
|
Loading…
Reference in New Issue