Compare commits

...

7 Commits

Author SHA1 Message Date
Sebastian McKenzie
115dca56b6 v1.10.9 2014-10-31 21:39:17 +11:00
Sebastian McKenzie
251e4d01c8 join together declarations in destructuring to return a single node if possible - fixes #113 2014-10-31 21:38:22 +11:00
Sebastian McKenzie
530ad78428 fix & html entity in travis badge branch url - thanks @davidchambers 2014-10-31 11:51:49 +11:00
Sebastian McKenzie
51f72ace57 Merge pull request #112 from thejameskyle/travis-badge
Add ?branch=master to Travis CI badge
2014-10-31 11:47:50 +11:00
James Kyle
2fa36b30d5 Add ?branch=master to Travis CI badge 2014-10-30 17:46:08 -07:00
Sebastian McKenzie
6f8cbf0ad1 v1.10.8 2014-10-31 11:43:36 +11:00
Sebastian McKenzie
6696d5fcf4 fix rest parameters in arrow functions containing wrong arguments reference - fixes #11 2014-10-31 11:42:09 +11:00
7 changed files with 36 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
<p align="center">
<a href="https://travis-ci.org/sebmck/6to5">
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?style=flat&amp;label=travis">
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?branch=master&amp;style=flat&amp;label=travis">
</a>
<a href="https://codeclimate.com/github/sebmck/6to5">

View File

@@ -35,6 +35,8 @@ var go = function (getBody, node, file) {
}
}
if (node._ignoreAliasFunctions) return;
var getId;
if (node.type === "Identifier" && node.name === "arguments") {

View File

@@ -148,5 +148,22 @@ exports.VariableDeclaration = function (node, parent, file) {
}
});
if (parent.type !== "Program" && parent.type !== "BlockStatement") {
var declar;
_.each(nodes, function (node) {
declar = declar || b.variableDeclaration(node.kind, []);
if (node.type !== "VariableDeclaration" && declar.kind !== node.kind) {
throw util.errorWithNode(node, "Cannot use this node within the current parent");
}
declar.declarations = declar.declarations.concat(node.declarations);
});
return declar;
}
return nodes;
};

View File

@@ -11,9 +11,14 @@ exports.Function = function (node, parent, file) {
if (node.params.length) templateName += "-arg";
util.ensureBlock(node);
node.body.body.unshift(util.template(templateName, {
var template = util.template(templateName, {
SLICE_KEY: file.addDeclaration("slice"),
VARIABLE_NAME: rest,
SLICE_ARG: b.literal(node.params.length)
}));
});
template.declarations[0].init.arguments[0]._ignoreAliasFunctions = true;
node.body.body.unshift(template);
};

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "1.10.7",
"version": "1.10.9",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/sebmck/6to5",
"repository": {

View File

@@ -0,0 +1,3 @@
var concat = (...arrs) => {
};

View File

@@ -0,0 +1,5 @@
"use strict";
var _slice = Array.prototype.slice;
var concat = function () {
var arrs = _slice.call(arguments);
};