fix a catch param property identifier incorrectly being replaced when exploding statements in generators - fixes #301

This commit is contained in:
Sebastian McKenzie
2014-12-16 08:08:06 +11:00
parent 49578fe223
commit 882ed48438

View File

@@ -297,7 +297,8 @@ exports.TryStatement = function (path, stmt) {
types.visit(bodyPath, {
visitIdentifier: function (path) {
if (path.value.name === catchParamName &&
if (t.isReferenced(path.value, path.parentPath.node) &&
path.value.name === catchParamName &&
path.scope.lookup(catchParamName) === catchScope) {
return safeParam;
}