}
if (node instanceof AST_Try) {
push();
+ segment.block = node;
walk_body(node, tw);
- pop();
if (node.bcatch) {
references[node.bcatch.argname.definition().id] = false;
+ pop();
push();
walk_body(node.bcatch, tw);
- pop();
}
+ pop();
if (node.bfinally) node.bfinally.walk(tw);
return true;
}
var head = first.pop();
var def = head.definition;
if (!(def.id in prev)) continue;
- if (!references[def.id]) continue;
+ var head_refs = references[def.id];
+ if (!head_refs) continue;
while (def.id in merged) def = merged[def.id];
var skipped = [];
do {
if (!tail) continue;
if (tail.index > head.index) continue;
var id = tail.definition.id;
- if (!references[id]) continue;
- if (!mergeable()) {
+ var tail_refs = references[id];
+ if (!tail_refs) continue;
+ if (!mergeable(head_refs, tail_refs)) {
skipped.unshift(tail);
continue;
}
var orig = [], refs = [];
- references[id].forEach(function(sym) {
+ tail_refs.forEach(function(sym) {
sym.thedef = def;
sym.name = def.name;
if (sym instanceof AST_SymbolRef) {
return base === segment || base.isPrototypeOf(segment);
}
- function mergeable() {
- var head = references[def.id];
- var tail = references[id];
+ function mergeable(head, tail) {
if (head.start.block !== tail.start.block) return false;
return must_visit(head.start, head.end) || must_visit(head.start, tail.start);
}