Fix parens around anonymous functions (#297)

This commit is contained in:
Brian Ng authored and Christopher Chedeau committed 2017-01-18 11:12:57 -08:00
1 parent c02bd6a8d5
commit 87b0ed3042
5 files changed
+13 -8

No files matched your search

+1
View File
@@ -373,6 +373,7 @@ FPp.needsParens = function(assumeExpressionContext) {
}
switch (parent.type) {
case "ExpressionStatement":
case "MemberExpression":
case "TaggedTemplateExpression":
case "UnaryExpression":
@@ -40,11 +40,11 @@ async function* delegate_yield() {
}
yield* inner();
}
async () => {
(async () => {
for await (const x of delegate_yield()) {
(x: void); // error: number ~> void
}
};
});
async function* delegate_return() {
async function* inner() {
@@ -197,13 +197,13 @@ async function* catch_return() {
}
}
async () => {
(async () => {
catch_return().throw(\"\").then(({ value }) => {
if (value !== undefined) {
(value: void); // error: number ~> void
}
});
};
});
async function* yield_return() {
try {
@@ -214,12 +214,12 @@ async function* yield_return() {
}
}
async () => {
(async () => {
yield_return().throw(\"\").then(({ value }) => {
if (value !== undefined) {
(value: void); // error: number ~> void
}
});
};
});
"
`;
@@ -370,6 +370,7 @@ export default (function() {})();
(function() {})()\`\`;
(function() {})\`\`;
new (function() {});
(function() {})
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(function() {
}).length;
@@ -383,6 +384,8 @@ export default (function() {
})\`\`;
new (function() {
})();
(function() {
});
"
`;
+1
View File
@@ -4,3 +4,4 @@ export default (function() {})();
(function() {})()``;
(function() {})``;
new (function() {});
(function() {})
@@ -112,14 +112,14 @@ var a0 = (x: mixed) => x !== null;
var a1 = (x: mixed): %checks => x !== null;
(x): %checks => x !== null;
((x): %checks => x !== null);
const insert_a_really_big_predicated_arrow_function_name_here = (x): %checks =>
x !== null;
declare var x;
x;
checks => 123;
(checks => 123);
type checks = any;