function can_rename(fn, name) {
if (!fn.name) return !fn.variables.get(name);
old_def = fn.name.definition();
- if (old_def.assignments > 0) return false;
- if (old_def.name == name) return true;
+ if (old_def.orig.length > 1) {
+ old_def = null;
+ } else {
+ if (old_def.assignments > 0) return false;
+ if (old_def.name == name) return true;
+ }
if (name == "await" && is_async(fn)) return false;
if (name == "yield" && is_generator(fn)) return false;
- return all(old_def.references, function(ref) {
+ return !old_def || all(old_def.references, function(ref) {
return ref.scope.find_variable(name) === sym;
});
}
}
function createValue() {
- return VALUES[rng(VALUES.length)];
+ var v;
+ do {
+ v = VALUES[rng(VALUES.length)];
+ } while (v == "new.target" && rng(200));
+ return v;
}
function createBinaryOp(noComma, canThrow) {