Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7736fa11f2 | ||
|
|
d203924541 | ||
|
|
cd23e500a1 | ||
|
|
bf24a0d6b5 |
@@ -13,7 +13,7 @@ function DefaultFormatter(file) {
|
||||
|
||||
this.remapAssignments();
|
||||
|
||||
this.checkCollisions();
|
||||
//this.checkCollisions();
|
||||
}
|
||||
|
||||
DefaultFormatter.prototype.getLocalExports = function () {
|
||||
|
||||
@@ -39,6 +39,8 @@ transform.moduleFormatters = {
|
||||
};
|
||||
|
||||
_.each({
|
||||
specNoForInOfAssignment: require("./transformers/spec-no-for-in-of-assignment"),
|
||||
|
||||
// playground
|
||||
methodBinding: require("./transformers/playground-method-binding"),
|
||||
memoizationOperator: require("./transformers/playground-memoization-operator"),
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
var t = require("../../types");
|
||||
|
||||
exports.ForInStatement =
|
||||
exports.ForOfStatement = function (node, parent, file) {
|
||||
var left = node.left;
|
||||
if (t.isVariableDeclaration(left)) {
|
||||
var declar = left.declarations[0];
|
||||
if (declar.init) throw file.errorWithNode(declar, "No assignments allowed in for-in/of head");
|
||||
}
|
||||
};
|
||||
@@ -146,10 +146,10 @@ exports.template = function (name, nodes, keepExpression) {
|
||||
var node = template.body[0];
|
||||
|
||||
if (!keepExpression && t.isExpressionStatement(node)) {
|
||||
node = node.expression;
|
||||
return node.expression;
|
||||
} else {
|
||||
return node;
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
exports.codeFrame = function (lines, lineNumber, colNumber) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "2.7.1",
|
||||
"version": "2.7.2",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://github.com/6to5/6to5",
|
||||
"repository": {
|
||||
|
||||
3
test/fixtures/transformation/spec/for-in-assignment/actual.js
vendored
Normal file
3
test/fixtures/transformation/spec/for-in-assignment/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0 in obj) {
|
||||
|
||||
}
|
||||
3
test/fixtures/transformation/spec/for-in-assignment/options.json
vendored
Normal file
3
test/fixtures/transformation/spec/for-in-assignment/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "No assignments allowed in for-in/of head"
|
||||
}
|
||||
3
test/fixtures/transformation/spec/for-of-assignment/actual.js
vendored
Normal file
3
test/fixtures/transformation/spec/for-of-assignment/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
for (var i = 0 of obj) {
|
||||
|
||||
}
|
||||
3
test/fixtures/transformation/spec/for-of-assignment/options.json
vendored
Normal file
3
test/fixtures/transformation/spec/for-of-assignment/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "No assignments allowed in for-in/of head"
|
||||
}
|
||||
Reference in New Issue
Block a user