Comparing version 1.13.9 to 1.13.10
@@ -0,1 +1,3 @@ | ||
// TODO: Clean up | ||
var t = require("../../types"); | ||
@@ -186,6 +188,34 @@ var _ = require("lodash"); | ||
exports.AssignmentExpression = function (node, parent, file) { | ||
exports.AssignmentExpression = function (node, parent, file, scope) { | ||
if (parent.type === "ExpressionStatement") return; | ||
if (!t.isPattern(node.left)) return; | ||
throw file.errorWithNode(node, "AssignmentExpression destructuring outside of a ExpressionStatement is forbidden due to current 6to5 limitations"); | ||
var tempName = file.generateUid("temp", scope); | ||
var temp = t.identifier(tempName); | ||
scope.push(tempName, temp); | ||
var nodes = []; | ||
nodes.push(t.assignmentExpression("=", temp, node.right)); | ||
push({ | ||
kind: false, | ||
file: file, | ||
scope: scope | ||
}, nodes, node.left, temp); | ||
nodes.push(temp); | ||
nodes = nodes.map(function (node) { | ||
if (t.isExpressionStatement(node)) { | ||
return node.expression; | ||
} else if (t.isVariableDeclaration(node)) { | ||
var declar = node.declarations[0]; | ||
scope.push(declar.id.name, declar.id); | ||
return t.assignmentExpression("=", declar.id, declar.init); | ||
} else { | ||
return node; | ||
} | ||
}); | ||
return t.sequenceExpression(nodes); | ||
}; | ||
@@ -192,0 +222,0 @@ |
@@ -115,3 +115,3 @@ module.exports = Scope; | ||
} else { | ||
throw new Error("wtf"); | ||
throw new TypeError("cannot add a declaration here in node type " + block.type); | ||
} | ||
@@ -118,0 +118,0 @@ }; |
{ | ||
"name": "6to5", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "1.13.9", | ||
"version": "1.13.10", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/6to5/6to5", |
Sorry, the diff of this file is too big to display
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
3016959
8699