I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
This commit is contained in:
Sebastian McKenzie
2015-10-29 17:51:24 +00:00
parent 3974dd762d
commit ae7d5367f1
1501 changed files with 16477 additions and 19786 deletions

View File

@@ -82,7 +82,8 @@ export function Binary(node: Object, parent: Object): boolean {
return true;
}
if (parentPos === nodePos && parent.right === node) {
// Logical expressions with the same precedence don't need parens.
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {
return true;
}
}
@@ -119,6 +120,10 @@ export function SequenceExpression(node: Object, parent: Object): boolean {
return false;
}
if (t.isReturnStatement(parent)) {
return false;
}
// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;

View File

@@ -163,7 +163,8 @@ exports.nodes = {
* Test if Property or SpreadProperty needs whitespace.
*/
exports.nodes.Property =
exports.nodes.ObjectProperty =
exports.nodes.ObjectMethod =
exports.nodes.SpreadProperty = function (node, parent) {
if (parent.properties[0] === node) {
return {