@babel/generator
Advanced tools
Comparing version 7.0.0-beta.39 to 7.0.0-beta.40
@@ -14,2 +14,4 @@ "use strict"; | ||
exports.Decorator = Decorator; | ||
exports.OptionalMemberExpression = OptionalMemberExpression; | ||
exports.OptionalCallExpression = OptionalCallExpression; | ||
exports.CallExpression = CallExpression; | ||
@@ -119,3 +121,33 @@ exports.Import = Import; | ||
function CallExpression(node) { | ||
function OptionalMemberExpression(node) { | ||
this.print(node.object, node); | ||
if (!node.computed && t.isMemberExpression(node.property)) { | ||
throw new TypeError("Got a MemberExpression for MemberExpression property"); | ||
} | ||
var computed = node.computed; | ||
if (t.isLiteral(node.property) && typeof node.property.value === "number") { | ||
computed = true; | ||
} | ||
if (node.optional) { | ||
this.token("?."); | ||
} | ||
if (computed) { | ||
this.token("["); | ||
this.print(node.property, node); | ||
this.token("]"); | ||
} else { | ||
if (!node.optional) { | ||
this.token("."); | ||
} | ||
this.print(node.property, node); | ||
} | ||
} | ||
function OptionalCallExpression(node) { | ||
this.print(node.callee, node); | ||
@@ -133,2 +165,10 @@ this.print(node.typeParameters, node); | ||
function CallExpression(node) { | ||
this.print(node.callee, node); | ||
this.print(node.typeParameters, node); | ||
this.token("("); | ||
this.printList(node.arguments, node); | ||
this.token(")"); | ||
} | ||
function Import() { | ||
@@ -222,6 +262,2 @@ this.word("import"); | ||
if (node.optional) { | ||
this.token("?."); | ||
} | ||
if (computed) { | ||
@@ -232,6 +268,3 @@ this.token("["); | ||
} else { | ||
if (!node.optional) { | ||
this.token("."); | ||
} | ||
this.token("."); | ||
this.print(node.property, node); | ||
@@ -238,0 +271,0 @@ } |
@@ -28,3 +28,2 @@ "use strict"; | ||
_this = _Printer.call(this, format, map) || this; | ||
_this.ast = void 0; | ||
_this.ast = ast; | ||
@@ -31,0 +30,0 @@ return _this; |
@@ -28,5 +28,3 @@ "use strict"; | ||
function Printer(format, map) { | ||
this.format = void 0; | ||
this.inForStatementInitCounter = 0; | ||
this._buf = void 0; | ||
this._printStack = []; | ||
@@ -33,0 +31,0 @@ this._indent = 0; |
{ | ||
"name": "@babel/generator", | ||
"version": "7.0.0-beta.39", | ||
"version": "7.0.0-beta.40", | ||
"description": "Turns an AST into code.", | ||
@@ -14,3 +14,3 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"dependencies": { | ||
"@babel/types": "7.0.0-beta.39", | ||
"@babel/types": "7.0.0-beta.40", | ||
"jsesc": "^2.5.1", | ||
@@ -22,5 +22,5 @@ "lodash": "^4.2.0", | ||
"devDependencies": { | ||
"@babel/helper-fixtures": "7.0.0-beta.39", | ||
"babylon": "7.0.0-beta.39" | ||
"@babel/helper-fixtures": "7.0.0-beta.40", | ||
"babylon": "7.0.0-beta.40" | ||
} | ||
} |
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
106590
3357
+ Added@babel/types@7.0.0-beta.40(transitive)
- Removed@babel/types@7.0.0-beta.39(transitive)
Updated@babel/types@7.0.0-beta.40