From dc101adad33ebca92e9d53654fcc6a4930f4beb9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 13 May 2015 01:13:08 +0100 Subject: [PATCH] more es6.tailCall transformer cleanup --- .../transformation/transformers/es6/tail-call.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/babel/transformation/transformers/es6/tail-call.js b/src/babel/transformation/transformers/es6/tail-call.js index 8d80f462ce..46e1819616 100644 --- a/src/babel/transformation/transformers/es6/tail-call.js +++ b/src/babel/transformation/transformers/es6/tail-call.js @@ -1,4 +1,3 @@ -import blockScopedFunctions from "../spec/block-scoped-functions"; import reduceRight from "lodash/collection/reduceRight"; import * as messages from "../../../messages"; import flatten from "lodash/array/flatten"; @@ -47,13 +46,13 @@ var visitor = { ThisExpression(node, parent, scope, state) { state.needsThis = true; - state.thises.push(this); + state.thisPaths.push(this); }, ReferencedIdentifier(node, parent, scope, state) { if (node.name === "arguments") { state.needsArguments = true; - state.arguments.push(this); + state.argumentsPaths.push(this); } } }; @@ -63,11 +62,11 @@ class TailCallTransformer { this.hasTailRecursion = false; this.needsArguments = false; + this.argumentsPaths = []; this.setsArguments = false; - this.arguments = []; this.needsThis = false; - this.thises = []; + this.thisPaths = []; this.ownerId = path.node.id; this.vars = []; @@ -195,7 +194,7 @@ class TailCallTransformer { var topVars = []; if (this.needsThis) { - for (var path of (this.thises: Array)) { + for (var path of (this.thisPaths: Array)) { path.replaceWith(this.getThisId()); } @@ -203,7 +202,7 @@ class TailCallTransformer { } if (this.needsArguments || this.setsArguments) { - for (var path of (this.arguments: Array)) { + for (var path of (this.argumentsPaths: Array)) { path.replaceWith(this.argumentsId); }