Always expand first argument if the second argument is also a call expression (#4657)

This commit is contained in:
Lucas Duailibe authored and GitHub committed 2018-06-08 15:16:12 -03:00
1 parent cb1c52ad08
commit d013983d8a
4 files changed
+18 -1

No files matched your search

+2
View File
@@ -3415,6 +3415,8 @@ function shouldGroupFirstArg(args) {
(firstArg.type === "FunctionExpression" ||
(firstArg.type === "ArrowFunctionExpression" &&
firstArg.body.type === "BlockStatement")) &&
secondArg.type !== "FunctionExpression" &&
secondArg.type !== "ArrowFunctionExpression" &&
!couldGroupArg(secondArg)
);
}
@@ -88,6 +88,10 @@ setTimeout(
setTimeout(/* blip */ function() {
thing();
}, 500);
func((args) => {
execute(args);
}, result => result && console.log("success"))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setTimeout(function() {
thing();
@@ -200,4 +204,11 @@ setTimeout(
500
);
func(
args => {
execute(args);
},
result => result && console.log("success")
);
`;
+1 -1
View File
@@ -1 +1 @@
run_spec(__dirname, ["flow", "typescript"]);
run_spec(__dirname, ["babylon", "flow", "typescript"]);
+4
View File
@@ -85,3 +85,7 @@ setTimeout(
setTimeout(/* blip */ function() {
thing();
}, 500);
func((args) => {
execute(args);
}, result => result && console.log("success"))