Fix cases of missing parens with NewExpression (#230)
parent
0e1afd6312
commit
340a39b414
|
@ -239,6 +239,7 @@ FPp.needsParens = function(assumeExpressionContext) {
|
|||
case "LogicalExpression":
|
||||
switch (parent.type) {
|
||||
case "CallExpression":
|
||||
case "NewExpression":
|
||||
return name === "callee" && parent.callee === node;
|
||||
|
||||
case "UnaryExpression":
|
||||
|
@ -340,6 +341,7 @@ FPp.needsParens = function(assumeExpressionContext) {
|
|||
case "SpreadProperty":
|
||||
case "BinaryExpression":
|
||||
case "LogicalExpression":
|
||||
case "NewExpression":
|
||||
return true;
|
||||
|
||||
case "CallExpression":
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
exports[`test new_expression.js 1`] = `
|
||||
"new (memoize.Cache || MapCache)
|
||||
new (typeof this == \"function\" ? this : Dict())
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
new (memoize.Cache || MapCache)();
|
||||
new (typeof this == \"function\" ? this : Dict())();
|
||||
"
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname);
|
|
@ -0,0 +1,2 @@
|
|||
new (memoize.Cache || MapCache)
|
||||
new (typeof this == "function" ? this : Dict())
|
Loading…
Reference in New Issue