babel-generator
Advanced tools
Comparing version 6.3.20 to 6.3.21
@@ -47,3 +47,3 @@ "use strict"; | ||
var needsBlock = node.alternate && t.isIfStatement(node.consequent); | ||
var needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent)); | ||
if (needsBlock) { | ||
@@ -70,2 +70,8 @@ this.push("{"); | ||
// Recursively get the last statement. | ||
function getLastStatement(statement) { | ||
if (!t.isStatement(statement.body)) return statement; | ||
return getLastStatement(statement.body); | ||
} | ||
function ForStatement(node /*: Object*/) { | ||
@@ -72,0 +78,0 @@ this.keyword("for"); |
@@ -0,1 +1,3 @@ | ||
/* @noflow */ | ||
"use strict"; | ||
@@ -25,6 +27,2 @@ | ||
var _lodashCollectionSome = require("lodash/collection/some"); | ||
var _lodashCollectionSome2 = _interopRequireDefault(_lodashCollectionSome); | ||
var _babelTypes = require("babel-types"); | ||
@@ -52,2 +50,14 @@ | ||
function isOrHasCallExpression(node) { | ||
if (t.isCallExpression(node)) { | ||
return true; | ||
} | ||
if (t.isMemberExpression(node)) { | ||
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property); | ||
} else { | ||
return false; | ||
} | ||
} | ||
var Node = (function () { | ||
@@ -99,8 +109,3 @@ function Node(node /*: Object*/, parent /*: Object*/) { | ||
if (t.isNewExpression(parent) && parent.callee === node) { | ||
if (t.isCallExpression(node)) return true; | ||
var hasCall = _lodashCollectionSome2["default"](node, function (val) { | ||
return t.isCallExpression(val); | ||
}); | ||
if (hasCall) return true; | ||
if (isOrHasCallExpression(node)) return true; | ||
} | ||
@@ -107,0 +112,0 @@ |
@@ -200,3 +200,8 @@ /* @flow */ | ||
return ArrowFunctionExpression(node, parent); | ||
// export default (function () {}); | ||
if (t.isExportDeclaration(parent)) { | ||
return true; | ||
} | ||
return UnaryLike(node, parent); | ||
} | ||
@@ -210,2 +215,6 @@ | ||
if (t.isBinaryExpression(parent) || t.isLogicalExpression(parent)) { | ||
return true; | ||
} | ||
return UnaryLike(node, parent); | ||
@@ -212,0 +221,0 @@ } |
{ | ||
"name": "babel-generator", | ||
"version": "6.3.20", | ||
"version": "6.3.21", | ||
"description": "Turns an AST into code.", | ||
@@ -16,3 +16,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"babel-runtime": "^5.0.0", | ||
"babel-types": "^6.3.20", | ||
"babel-types": "^6.3.21", | ||
"detect-indent": "^3.0.1", | ||
@@ -27,4 +27,4 @@ "is-integer": "^1.0.4", | ||
"babel-helper-fixtures": "^6.3.13", | ||
"babylon": "^6.3.20" | ||
"babylon": "^6.3.21" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100692
23
3038
Updatedbabel-types@^6.3.21