rename LetScoping to BlockScoping

This commit is contained in:
Sebastian McKenzie 2015-02-03 10:23:56 +11:00
parent 4163d1372a
commit 706797eb47

View File

@ -45,15 +45,15 @@ exports.Loop = function (node, parent, scope, context, file) {
t.ensureBlock(node);
node.body._letDeclarators = [init];
}
var letScoping = new LetScoping(node, node.body, parent, scope, file);
letScoping.run();
var blockScoping = new BlockScoping(node, node.body, parent, scope, file);
blockScoping.run();
};
exports.Program =
exports.BlockStatement = function (block, parent, scope, context, file) {
if (!t.isLoop(parent)) {
var letScoping = new LetScoping(false, block, parent, scope, file);
letScoping.run();
var blockScoping = new BlockScoping(false, block, parent, scope, file);
blockScoping.run();
}
};
@ -67,7 +67,7 @@ exports.BlockStatement = function (block, parent, scope, context, file) {
* @param {File} file
*/
function LetScoping(loopParent, block, parent, scope, file) {
function BlockScoping(loopParent, block, parent, scope, file) {
this.loopParent = loopParent;
this.parent = parent;
this.scope = scope;
@ -84,7 +84,7 @@ function LetScoping(loopParent, block, parent, scope, file) {
* Start the ball rolling.
*/
LetScoping.prototype.run = function () {
BlockScoping.prototype.run = function () {
var block = this.block;
if (block._letDone) return;
block._letDone = true;
@ -133,7 +133,7 @@ function traverseReplace(node, parent, scope, remaps) {
* Description
*/
LetScoping.prototype.remap = function () {
BlockScoping.prototype.remap = function () {
var hasRemaps = false;
var letRefs = this.letReferences;
var scope = this.scope;
@ -179,7 +179,7 @@ LetScoping.prototype.remap = function () {
* Description
*/
LetScoping.prototype.needsClosure = function () {
BlockScoping.prototype.needsClosure = function () {
var block = this.block;
// if we're inside of a for loop then we search to see if there are any
@ -249,7 +249,7 @@ var letReferenceBlockVisitor = {
* Description
*/
LetScoping.prototype.getLetReferences = function () {
BlockScoping.prototype.getLetReferences = function () {
var block = this.block;
var declarators = block._letDeclarators || [];
@ -374,7 +374,7 @@ var loopLabelVisitor = {
* @returns {Object}
*/
LetScoping.prototype.checkLoop = function () {
BlockScoping.prototype.checkLoop = function () {
var state = {
hasBreakContinue: false,
ignoreLabeless: false,
@ -413,7 +413,7 @@ var hoistVarDeclarationsVisitor = {
* once we wrap everything in a closure.
*/
LetScoping.prototype.hoistVarDeclarations = function () {
BlockScoping.prototype.hoistVarDeclarations = function () {
traverse(this.block, hoistVarDeclarationsVisitor, this.scope, this);
};
@ -425,7 +425,7 @@ LetScoping.prototype.hoistVarDeclarations = function () {
* @returns {Array}
*/
LetScoping.prototype.pushDeclar = function (node) {
BlockScoping.prototype.pushDeclar = function (node) {
this.body.push(t.variableDeclaration(node.kind, node.declarations.map(function (declar) {
return t.variableDeclarator(declar.id);
})));
@ -450,7 +450,7 @@ LetScoping.prototype.pushDeclar = function (node) {
* @param {Node} call CallExpression
*/
LetScoping.prototype.build = function (ret, call) {
BlockScoping.prototype.build = function (ret, call) {
var has = this.has;
if (has.hasReturn || has.hasBreakContinue) {
this.buildHas(ret, call);
@ -466,7 +466,7 @@ LetScoping.prototype.build = function (ret, call) {
* @param {Node} call CallExpression
*/
LetScoping.prototype.buildHas = function (ret, call) {
BlockScoping.prototype.buildHas = function (ret, call) {
var body = this.body;
body.push(t.variableDeclaration("var", [