Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fdb2ce939 | ||
|
|
fe57eb554c | ||
|
|
3b798943e3 | ||
|
|
4ff66a5cfc | ||
|
|
5477a990bc | ||
|
|
656ca422a5 | ||
|
|
7a3071a094 | ||
|
|
77361582f4 | ||
|
|
f585039430 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -11,6 +11,19 @@
|
||||
|
||||
_Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
## 3.0.7
|
||||
|
||||
* **Internal**
|
||||
* Upgrade `core-js` to `0.4.9`.
|
||||
* **Bug Fix**
|
||||
* Add id to function express scope tracking.
|
||||
|
||||
## 3.0.6
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix block scope variable tracking stopping whenever it hits a new scope.
|
||||
* Fix block scope variable tracking breaking on all block statement scopes that have a for loop parent.
|
||||
|
||||
## 3.0.5
|
||||
|
||||
* **Internal**
|
||||
|
||||
@@ -325,7 +325,7 @@ File.prototype.transform = function (ast) {
|
||||
|
||||
this.ast = ast;
|
||||
this.lastStatements = t.getLastStatements(ast.program);
|
||||
this.scope = new Scope(ast.program, null, this);
|
||||
this.scope = new Scope(ast.program, ast, null, this);
|
||||
this.moduleFormatter = this.getModuleFormatter(this.opts.modules);
|
||||
|
||||
var astRun = function (key) {
|
||||
|
||||
@@ -111,7 +111,7 @@ TraversalContext.prototype.visitNode = function (obj, key, opts, scope, parent,
|
||||
var ourScope = scope;
|
||||
// we're entering a new scope so let's construct it!
|
||||
if (t.isScope(node)) {
|
||||
ourScope = new Scope(node, scope);
|
||||
ourScope = new Scope(node, parent, scope);
|
||||
}
|
||||
|
||||
node = this.enterNode(obj, key, node, opts.enter, parent, ourScope, state);
|
||||
|
||||
@@ -14,15 +14,18 @@ var FOR_KEYS = ["left", "init"];
|
||||
* within.
|
||||
*
|
||||
* @param {Node} block
|
||||
* @param {Node} parentBlock
|
||||
* @param {Scope} [parent]
|
||||
* @param {File} [file]
|
||||
*/
|
||||
|
||||
function Scope(block, parent, file) {
|
||||
function Scope(block, parentBlock, parent, file) {
|
||||
this.parent = parent;
|
||||
this.block = block;
|
||||
this.file = parent ? parent.file : file;
|
||||
|
||||
this.parentBlock = parentBlock;
|
||||
this.block = block;
|
||||
|
||||
var info = this.getInfo();
|
||||
this.references = info.references;
|
||||
this.declarations = info.declarations;
|
||||
@@ -171,7 +174,7 @@ var blockVariableVisitor = {
|
||||
if (t.isBlockScoped(node)) {
|
||||
add(node, false, t.isLet(node));
|
||||
} else if (t.isScope(node)) {
|
||||
context.stop();
|
||||
context.skip();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -196,7 +199,8 @@ Scope.prototype.getInfo = function () {
|
||||
}
|
||||
};
|
||||
|
||||
if (parent && t.isBlockStatement(block) && t.isFor(parent.block)) {
|
||||
if (parent && t.isBlockStatement(block) && t.isFor(parent.block, { body: block })) {
|
||||
// delegate block let declarations to the parent loop
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -240,6 +244,14 @@ Scope.prototype.getInfo = function () {
|
||||
});
|
||||
}
|
||||
|
||||
if (t.isFunctionExpression(block) && block.id) {
|
||||
if (!t.isProperty(this.parentBlock, { method: true })) {
|
||||
// SpiderMonkey AST doesn't use MethodDefinition here when it probably
|
||||
// should since they should be semantically the same?
|
||||
add(block.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Program
|
||||
|
||||
if (t.isProgram(block)) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
var toFastProperties = require("../helpers/to-fast-properties");
|
||||
var esutils = require("esutils");
|
||||
var object = require("../helpers/object");
|
||||
var Node = require("./node");
|
||||
var _ = require("lodash");
|
||||
|
||||
@@ -455,7 +456,7 @@ t.getIds = function (node, map, ignoreTypes) {
|
||||
ignoreTypes = ignoreTypes || [];
|
||||
|
||||
var search = [].concat(node);
|
||||
var ids = {};
|
||||
var ids = object();
|
||||
|
||||
while (search.length) {
|
||||
var id = search.shift();
|
||||
|
||||
14
package.json
14
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "6to5",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "3.0.5",
|
||||
"version": "3.0.7",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://6to5.org/",
|
||||
"repository": "6to5/6to5",
|
||||
@@ -37,28 +37,28 @@
|
||||
"chalk": "^0.5.1",
|
||||
"chokidar": "0.12.6",
|
||||
"commander": "2.6.0",
|
||||
"core-js": "0.4.6",
|
||||
"detect-indent": "^3.0.0",
|
||||
"core-js": "^0.4.9",
|
||||
"detect-indent": "3.0.0",
|
||||
"estraverse": "1.9.1",
|
||||
"esutils": "1.1.6",
|
||||
"esvalid": "1.1.0",
|
||||
"fs-readdir-recursive": "0.1.0",
|
||||
"js-tokenizer": "^1.3.3",
|
||||
"js-tokenizer": "1.3.3",
|
||||
"lodash": "3.0.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
"output-file-sync": "1.1.0",
|
||||
"private": "0.1.6",
|
||||
"regenerator-6to5": "0.8.9-6",
|
||||
"regexpu": "1.1.0",
|
||||
"roadrunner": "1.0.4",
|
||||
"source-map": "0.1.43",
|
||||
"source-map-support": "0.2.9",
|
||||
"supports-color": "^1.2.0"
|
||||
"supports-color": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "8.1.1",
|
||||
"chai": "1.10.0",
|
||||
"istanbul": "0.3.5",
|
||||
"jscs": "^1.10.0",
|
||||
"jscs": "1.10.0",
|
||||
"jshint": "2.6.0",
|
||||
"jshint-stylish": "1.0.0",
|
||||
"matcha": "0.6.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "6to5-runtime",
|
||||
"description": "6to5 selfContained runtime",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.6",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>"
|
||||
}
|
||||
Reference in New Issue
Block a user