default newName in scope.rename to a new uid

This commit is contained in:
Sebastian McKenzie 2015-02-11 00:13:21 +11:00
parent 0c1e1e757c
commit 7b8118d8bd
2 changed files with 3 additions and 3 deletions

View File

@ -17,9 +17,7 @@ CommonJSFormatter.prototype.init = function () {
var file = this.file;
var scope = file.scope;
if (scope.hasBinding("module")) {
scope.rename("module", file.generateUidIdentifier("module").name);
}
scope.rename("module");
if (!this.noInteropRequireImport && this.hasNonDefaultExports) {
file.ast.program.body.push(util.template("exports-module-declaration", true));

View File

@ -146,6 +146,8 @@ Scope.prototype.checkBlockScopedCollisions = function (kind, name, id) {
};
Scope.prototype.rename = function (oldName, newName) {
newName = newName || this.generateUidIdentifier(oldName).name;
var info = this.getBindingInfo(oldName);
if (!info) return;